17 #ifndef BITMAP_IMAGE_H
18 #define BITMAP_IMAGE_H
38 void loadFile()
override;
39 void unloadFile()
override;
40 bool isLoaded()
override;
41 quint64 memoryUsage()
override;
47 void setImage(
QImage* pImg);
53 void moveTopLeft(
QPoint point);
55 void transform(
QRect rectangle,
bool smoothTransform);
56 void transform(
QRectF rectangle,
bool smoothTransform) { transform(rectangle.
toRect(), smoothTransform); }
59 BitmapImage transformed(
QRectF rectangle,
bool smoothTransform) {
return transformed(rectangle.
toRect(), smoothTransform); }
65 QRgb pixel(
int x,
int y);
67 void setPixel(
int x,
int y, QRgb color);
68 void setPixel(
QPoint p, QRgb color);
69 void fillNonAlphaPixels(
const QRgb color);
71 QRgb constScanLine(
int x,
int y)
const;
72 void scanLine(
int x,
int y, QRgb color);
74 void clear(
QRect rectangle);
75 void clear(
QRectF rectangle) { clear(rectangle.
toRect()); }
78 static void floodFill(
BitmapImage* targetImage,
QRect cameraRect,
QPoint point, QRgb newColor,
int tolerance);
115 void enableAutoCrop(
bool b) { mEnableAutoCrop = b; }
121 void extend(
const QPoint& p);
122 void extend(
QRect rectangle);
128 std::unique_ptr<QImage> mImage;
133 bool mEnableAutoCrop =
false;
QPoint topRight() const const
QRect toRect() const const
QPoint bottomRight() const const
QPoint bottomLeft() const const
void setCompositionModeBounds(BitmapImage *source, QPainter::CompositionMode cm)
Updates the bounds after a drawImage operation with the composition mode cm.
void autoCrop()
Removes any transparent borders by reducing the boundaries.
bool contains(const QRect &rectangle, bool proper) const const
QPoint toPoint() const const
QPoint topLeft() const const
void updateBounds(QRect rectangle)
Update image bounds.
static bool compareColor(QRgb newColor, QRgb oldColor, int tolerance, QHash< QRgb, bool > *cache)
Compare colors for the purposes of flood filling.
bool isMinimallyBounded() const
Determines if the BitmapImage is minimally bounded.