17 #ifndef BITMAP_IMAGE_H
18 #define BITMAP_IMAGE_H
31 BitmapImage(
const QRect& boundaries,
const QColor& colour );
32 BitmapImage(
const QRect& boundaries,
const QImage& image );
33 BitmapImage(
const QString& path,
const QPoint& topLeft );
38 void paintImage( QPainter& painter );
40 QImage* image() {
return mImage.get(); }
41 void setImage( QImage* pImg );
46 void paste(
BitmapImage*, QPainter::CompositionMode cm );
50 void moveTopLeft( QPoint point );
51 void moveTopLeft( QPointF point ) { moveTopLeft( point.toPoint() ); }
52 void transform( QRect rectangle,
bool smoothTransform );
53 void transform( QRectF rectangle,
bool smoothTransform ) { transform( rectangle.toRect(), smoothTransform ); }
54 BitmapImage transformed( QRect selection, QTransform transform,
bool smoothTransform );
55 BitmapImage transformed( QRect rectangle,
bool smoothTransform );
56 BitmapImage transformed( QRectF rectangle,
bool smoothTransform ) {
return transformed( rectangle.toRect(), smoothTransform ); }
58 bool contains( QPoint P ) {
return mBounds.contains( P ); }
59 bool contains( QPointF P ) {
return contains( P.toPoint() ); }
60 void extend( QPoint P );
61 void extend( QRect rectangle );
63 QRgb pixel(
int x,
int y );
64 QRgb pixel( QPoint P );
65 void setPixel(
int x,
int y, QRgb colour );
66 void setPixel( QPoint P, QRgb colour );
67 QRgb constScanLine(
int x,
int y);
68 void scanLine(
int x,
int y, QRgb colour);
70 void clear( QRect rectangle );
71 void clear( QRectF rectangle ) { clear( rectangle.toRect() ); }
73 static int pow(
int );
74 static bool compareColor(QRgb color1, QRgb color2,
int tolerance);
75 static void floodFill(
BitmapImage* targetImage, QRect cameraRect, QPoint point, QRgb oldColor, QRgb newColor,
int tolerance );
77 void drawLine( QPointF P1, QPointF P2, QPen pen, QPainter::CompositionMode cm,
bool antialiasing );
78 void drawRect( QRectF rectangle, QPen pen, QBrush brush, QPainter::CompositionMode cm,
bool antialiasing );
79 void drawEllipse( QRectF rectangle, QPen pen, QBrush brush, QPainter::CompositionMode cm,
bool antialiasing );
80 void drawPath( QPainterPath path, QPen pen, QBrush brush, QPainter::CompositionMode cm,
bool antialiasing );
82 QPoint topLeft() {
return mBounds.topLeft(); }
83 QPoint topRight() {
return mBounds.topRight(); }
84 QPoint bottomLeft() {
return mBounds.bottomLeft(); }
85 QPoint bottomRight() {
return mBounds.bottomRight(); }
86 int left() {
return mBounds.left(); }
87 int right() {
return mBounds.right(); }
88 int top() {
return mBounds.top(); }
89 int bottom() {
return mBounds.bottom(); }
90 int width() {
return mBounds.width(); }
91 int height() {
return mBounds.height(); }
93 QRect& bounds() {
return mBounds; }
96 std::shared_ptr< QImage > mImage;
98 bool mExtendable =
true;