Inheritance diagram for BitmapImage:
Collaboration diagram for BitmapImage:Public Member Functions | |
| BitmapImage (const BitmapImage &) | |
| BitmapImage (const QRect &rectangle, const QColor &color) | |
| BitmapImage (const QPoint &topLeft, const QImage &image) | |
| BitmapImage (const QPoint &topLeft, const QString &path) | |
| BitmapImage & | operator= (const BitmapImage &a) |
| BitmapImage * | clone () const override |
| void | loadFile () override |
| Loads the backing image data from disk and into memory if it exists but hasn't been loaded yet. | |
| void | unloadFile () override |
| Unloads the image data from memory if there's valid backing data on disk and the latest state has been stored. | |
| bool | isLoaded () const override |
| Checks whether the keyframe holds valid image data. | |
| quint64 | memoryUsage () override |
| void | paintImage (QPainter &painter) |
| void | paintImage (QPainter &painter, QImage &image, QRect sourceRect, QRect destRect) |
| QImage * | image () |
| void | setImage (QImage *pImg) |
| BitmapImage | copy () |
| BitmapImage | copy (QRect rectangle) |
| void | paste (BitmapImage *, QPainter::CompositionMode cm=QPainter::CompositionMode_SourceOver) |
| void | paste (const TiledBuffer *tiledBuffer, QPainter::CompositionMode cm=QPainter::CompositionMode_SourceOver) |
| void | moveTopLeft (QPoint point) |
| void | moveTopLeft (QPointF point) |
| void | transform (QRect rectangle, bool smoothTransform) |
| void | transform (QRectF rectangle, bool smoothTransform) |
| BitmapImage | transformed (QRect selection, QTransform transform, bool smoothTransform) |
| BitmapImage | transformed (QRect rectangle, bool smoothTransform) |
| BitmapImage | transformed (QRectF rectangle, bool smoothTransform) |
| bool | contains (QPoint P) |
| bool | contains (QPointF P) |
| void | autoCrop () |
| Removes any transparent borders by reducing the boundaries. | |
| QRgb | pixel (int x, int y) |
| QRgb | pixel (QPoint p) |
| void | setPixel (int x, int y, QRgb color) |
| void | setPixel (QPoint p, QRgb color) |
| void | fillNonAlphaPixels (const QRgb color) |
| QRgb | constScanLine (int x, int y) const |
| void | scanLine (int x, int y, QRgb color) |
| void | clear () |
| void | clear (QRect rectangle) |
| void | clear (QRectF rectangle) |
| void | drawLine (QPointF P1, QPointF P2, QPen pen, QPainter::CompositionMode cm, bool antialiasing) |
| void | drawRect (QRectF rectangle, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing) |
| void | drawEllipse (QRectF rectangle, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing) |
| void | drawPath (QPainterPath path, QPen pen, QBrush brush, QPainter::CompositionMode cm, bool antialiasing) |
| QPoint | topLeft () |
| QPoint | topRight () |
| QPoint | bottomLeft () |
| QPoint | bottomRight () |
| int | left () |
| int | right () |
| int | top () |
| int | bottom () |
| int | width () |
| int | height () |
| QSize | size () |
| BitmapImage * | scanToTransparent (BitmapImage *img, int threshold, bool redEnabled, bool greenEnabled, bool blueEnabled) |
| QRect & | bounds () |
| bool | isMinimallyBounded () const |
| Determines if the BitmapImage is minimally bounded. | |
| void | enableAutoCrop (bool b) |
| void | setOpacity (qreal opacity) |
| qreal | getOpacity () const |
| Status | writeFile (const QString &filename) |
Public Member Functions inherited from KeyFrame | |
| KeyFrame (const KeyFrame &k2) | |
| KeyFrame & | operator= (const KeyFrame &k2) |
| int | pos () const |
| void | setPos (int position) |
| int | length () const |
| void | setLength (int len) |
| void | modification () |
| void | setModified (bool b) |
| bool | isModified () const |
| QString | fileName () const |
| void | setFileName (QString strFileName) |
| void | addEventListener (KeyFrameEventListener *) |
| void | removeEventListner (KeyFrameEventListener *) |
| virtual KeyFrame * | clone () const |
| virtual void | loadFile () |
| Loads the backing file into memory if it exists, otherwise it does nothing. | |
| virtual void | unloadFile () |
| Unloads the data from memory in order to save memory. | |
| virtual bool | isLoaded () const |
| A check to ensure that the keyframe holds valid data. | |
| virtual quint64 | memoryUsage () |
Static Public Member Functions | |
| static bool | floodFill (BitmapImage **replaceImage, const BitmapImage *targetImage, const QRect &cameraRect, const QPoint &point, const QRgb &fillColor, int tolerance, const int expandValue) |
| static bool * | floodFillPoints (const BitmapImage *targetImage, const QRect &searchBounds, QPoint point, const int tolerance, QRect &newBounds) |
| static void | expandFill (bool *fillPixels, const QRect &searchBounds, const QRect &maxBounds, int expand) |
| Finds all pixels closest to the input color and applies the input color to the image. | |
| static bool | compareColor (QRgb newColor, QRgb oldColor, int tolerance, QHash< QRgb, bool > *cache) |
| Compare colors for the purposes of flood filling. | |
Public Attributes | |
| const QRgb | transp = qRgba(0, 0, 0, 0) |
| const QRgb | blackline = qRgba(1, 1, 1, 255) |
| const QRgb | redline = qRgba(254,0,0,255) |
| const QRgb | greenline = qRgba(0,254,0,255) |
| const QRgb | blueline = qRgba(0,0,254,255) |
Protected Member Functions | |
| void | updateBounds (QRect rectangle) |
| Update image bounds. | |
| void | extend (const QPoint &p) |
| void | extend (QRect rectangle) |
| void | setCompositionModeBounds (BitmapImage *source, QPainter::CompositionMode cm) |
| Updates the bounds after a drawImage operation with the composition mode cm. | |
| void | setCompositionModeBounds (QRect sourceBounds, bool isSourceMinBounds, QPainter::CompositionMode cm) |
| Updates the bounds after a draw operation with the composition mode cm. | |
Private Attributes | |
| QImage | mImage |
| QRect | mBounds {0, 0, 0, 0} |
| bool | mMinBound = true |
| bool | mEnableAutoCrop = false |
| const int | LOW_THRESHOLD = 30 |
| const int | COLORDIFF = 5 |
| const int | GRAYSCALEDIFF = 15 |
| qreal | mOpacity = 1.0 |
Definition at line 27 of file bitmapimage.h.
| BitmapImage::BitmapImage | ( | ) |
Definition at line 31 of file bitmapimage.cpp.
| BitmapImage::BitmapImage | ( | const BitmapImage & | a | ) |
Definition at line 35 of file bitmapimage.cpp.
Definition at line 44 of file bitmapimage.cpp.
Definition at line 52 of file bitmapimage.cpp.
Definition at line 59 of file bitmapimage.cpp.
|
override |
Definition at line 69 of file bitmapimage.cpp.
| void BitmapImage::autoCrop | ( | ) |
Removes any transparent borders by reducing the boundaries.
This function reduces the bounds of an image until the top and bottom rows, and the left and right columns of pixels each contain at least one pixel with a non-zero alpha value (i.e. non-transparent pixel). Both mBounds and the size of mImage are updated.
Definition at line 433 of file bitmapimage.cpp.
|
inline |
Definition at line 116 of file bitmapimage.h.
|
inline |
Definition at line 111 of file bitmapimage.h.
|
inline |
Definition at line 112 of file bitmapimage.h.
|
inline |
Definition at line 123 of file bitmapimage.h.
| void BitmapImage::clear | ( | ) |
Definition at line 828 of file bitmapimage.cpp.
| void BitmapImage::clear | ( | QRect | rectangle | ) |
Definition at line 854 of file bitmapimage.cpp.
|
inline |
Definition at line 94 of file bitmapimage.h.
|
overridevirtual |
Reimplemented from KeyFrame.
Definition at line 98 of file bitmapimage.cpp.
|
inlinestatic |
Compare colors for the purposes of flood filling.
Calculates the Eulcidian difference of the RGB channels of the image and compares it to the tolerance
| [in] | newColor | The first color to compare |
| [in] | oldColor | The second color to compare |
| [in] | tolerance | The threshold limit between a matching and non-matching color |
| [in,out] | cache | Contains a mapping of previous results of compareColor with rule that cache[someColor] = compareColor(someColor, oldColor, tolerance) |
Definition at line 156 of file bitmapimage.h.
| QRgb BitmapImage::constScanLine | ( | int | x, |
| int | y | ||
| ) | const |
Definition at line 836 of file bitmapimage.cpp.
|
inline |
Definition at line 80 of file bitmapimage.h.
|
inline |
Definition at line 81 of file bitmapimage.h.
| BitmapImage BitmapImage::copy | ( | ) |
Definition at line 182 of file bitmapimage.cpp.
| BitmapImage BitmapImage::copy | ( | QRect | rectangle | ) |
Definition at line 187 of file bitmapimage.cpp.
| void BitmapImage::drawEllipse | ( | QRectF | rectangle, |
| QPen | pen, | ||
| QBrush | brush, | ||
| QPainter::CompositionMode | cm, | ||
| bool | antialiasing | ||
| ) |
Definition at line 638 of file bitmapimage.cpp.
| void BitmapImage::drawLine | ( | QPointF | P1, |
| QPointF | P2, | ||
| QPen | pen, | ||
| QPainter::CompositionMode | cm, | ||
| bool | antialiasing | ||
| ) |
Definition at line 596 of file bitmapimage.cpp.
| void BitmapImage::drawPath | ( | QPainterPath | path, |
| QPen | pen, | ||
| QBrush | brush, | ||
| QPainter::CompositionMode | cm, | ||
| bool | antialiasing | ||
| ) |
Definition at line 662 of file bitmapimage.cpp.
| void BitmapImage::drawRect | ( | QRectF | rectangle, |
| QPen | pen, | ||
| QBrush | brush, | ||
| QPainter::CompositionMode | cm, | ||
| bool | antialiasing | ||
| ) |
Definition at line 612 of file bitmapimage.cpp.
|
inline |
Definition at line 136 of file bitmapimage.h.
|
static |
Finds all pixels closest to the input color and applies the input color to the image.
An example:
0 is where the color was found 1 is the distance from the nearest pixel of that color
211112 100001 100001 211112
| bitmapImage | Image to search |
| searchColor | Color to find |
Definition at line 1029 of file bitmapimage.cpp.
|
protected |
Definition at line 320 of file bitmapimage.cpp.
|
protected |
Definition at line 328 of file bitmapimage.cpp.
| void BitmapImage::fillNonAlphaPixels | ( | const QRgb | color | ) |
Definition at line 588 of file bitmapimage.cpp.
|
static |
Definition at line 869 of file bitmapimage.cpp.
|
static |
Definition at line 927 of file bitmapimage.cpp.
|
inline |
Definition at line 138 of file bitmapimage.h.
|
inline |
Definition at line 118 of file bitmapimage.h.
| QImage * BitmapImage::image | ( | ) |
Definition at line 176 of file bitmapimage.cpp.
|
overridevirtual |
Checks whether the keyframe holds valid image data.
true if the keyframe holds a valid image, otherwise returns false Reimplemented from KeyFrame.
Definition at line 148 of file bitmapimage.cpp.
|
inline |
Determines if the BitmapImage is minimally bounded.
A BitmapImage is minimally bounded if all edges contain at least 1 non-transparent pixel (alpha > 0). In other words, the size of the image cannot be decreased without cropping visible data.
Definition at line 135 of file bitmapimage.h.
|
inline |
Definition at line 113 of file bitmapimage.h.
|
overridevirtual |
Loads the backing image data from disk and into memory if it exists but hasn't been loaded yet.
Reimplemented from KeyFrame.
Definition at line 130 of file bitmapimage.cpp.
|
overridevirtual |
Reimplemented from KeyFrame.
Definition at line 155 of file bitmapimage.cpp.
| void BitmapImage::moveTopLeft | ( | QPoint | point | ) |
Definition at line 238 of file bitmapimage.cpp.
|
inline |
Definition at line 73 of file bitmapimage.h.
| BitmapImage & BitmapImage::operator= | ( | const BitmapImage & | a | ) |
Definition at line 82 of file bitmapimage.cpp.
| void BitmapImage::paintImage | ( | QPainter & | painter | ) |
Definition at line 164 of file bitmapimage.cpp.
| void BitmapImage::paintImage | ( | QPainter & | painter, |
| QImage & | image, | ||
| QRect | sourceRect, | ||
| QRect | destRect | ||
| ) |
Definition at line 169 of file bitmapimage.cpp.
| void BitmapImage::paste | ( | BitmapImage * | bitmapImage, |
| QPainter::CompositionMode | cm = QPainter::CompositionMode_SourceOver |
||
| ) |
Definition at line 197 of file bitmapimage.cpp.
| void BitmapImage::paste | ( | const TiledBuffer * | tiledBuffer, |
| QPainter::CompositionMode | cm = QPainter::CompositionMode_SourceOver |
||
| ) |
Definition at line 216 of file bitmapimage.cpp.
| QRgb BitmapImage::pixel | ( | int | x, |
| int | y | ||
| ) |
Definition at line 560 of file bitmapimage.cpp.
| QRgb BitmapImage::pixel | ( | QPoint | p | ) |
Definition at line 565 of file bitmapimage.cpp.
|
inline |
Definition at line 114 of file bitmapimage.h.
| void BitmapImage::scanLine | ( | int | x, |
| int | y, | ||
| QRgb | color | ||
| ) |
Definition at line 845 of file bitmapimage.cpp.
| BitmapImage * BitmapImage::scanToTransparent | ( | BitmapImage * | img, |
| int | threshold, | ||
| bool | redEnabled, | ||
| bool | greenEnabled, | ||
| bool | blueEnabled | ||
| ) |
Definition at line 709 of file bitmapimage.cpp.
|
protected |
Updates the bounds after a drawImage operation with the composition mode cm.
| [in] | source | The source image used for the drawImage call. |
| [in] | cm | The composition mode that will be used for the draw image |
Definition at line 361 of file bitmapimage.cpp.
|
protected |
Updates the bounds after a draw operation with the composition mode cm.
| [in] | sourceBounds | The bounds of the source used for drawcall. |
| [in] | isSourceMinBounds | Is sourceBounds the minimal bounds for the source image |
| [in] | cm | The composition mode that will be used for the draw image |
For a call to draw image of a QPainter (initialized with mImage) with an argument of source, this function intelligently calculates the bounds. It will attempt to preserve minimum bounds based on the composition mode.
This works baed on the principle that some minimal bounds can be determined solely by the minimal bounds of this and source, depending on the value of cm. Some composition modes only expand, or have no affect on the bounds.
Definition at line 388 of file bitmapimage.cpp.
| void BitmapImage::setImage | ( | QImage * | pImg | ) |
Definition at line 73 of file bitmapimage.cpp.
|
inline |
Definition at line 137 of file bitmapimage.h.
| void BitmapImage::setPixel | ( | int | x, |
| int | y, | ||
| QRgb | color | ||
| ) |
Definition at line 573 of file bitmapimage.cpp.
| void BitmapImage::setPixel | ( | QPoint | p, |
| QRgb | color | ||
| ) |
Definition at line 578 of file bitmapimage.cpp.
|
inline |
Definition at line 119 of file bitmapimage.h.
|
inline |
Definition at line 115 of file bitmapimage.h.
|
inline |
Definition at line 109 of file bitmapimage.h.
|
inline |
Definition at line 110 of file bitmapimage.h.
| void BitmapImage::transform | ( | QRect | rectangle, |
| bool | smoothTransform | ||
| ) |
Definition at line 245 of file bitmapimage.cpp.
|
inline |
Definition at line 75 of file bitmapimage.h.
| BitmapImage BitmapImage::transformed | ( | QRect | rectangle, |
| bool | smoothTransform | ||
| ) |
Definition at line 282 of file bitmapimage.cpp.
| BitmapImage BitmapImage::transformed | ( | QRect | selection, |
| QTransform | transform, | ||
| bool | smoothTransform | ||
| ) |
Definition at line 263 of file bitmapimage.cpp.
|
inline |
Definition at line 78 of file bitmapimage.h.
|
overridevirtual |
Unloads the image data from memory if there's valid backing data on disk and the latest state has been stored.
Reimplemented from KeyFrame.
Definition at line 140 of file bitmapimage.cpp.
|
protected |
Update image bounds.
| [in] | newBoundaries | the new bounds |
Sets this image's bounds to rectangle. Modifies mBounds and crops mImage.
Definition at line 300 of file bitmapimage.cpp.
|
inline |
Definition at line 117 of file bitmapimage.h.
Definition at line 791 of file bitmapimage.cpp.
| const QRgb BitmapImage::blackline = qRgba(1, 1, 1, 255) |
Definition at line 31 of file bitmapimage.h.
| const QRgb BitmapImage::blueline = qRgba(0,0,254,255) |
Definition at line 34 of file bitmapimage.h.
|
private |
Definition at line 201 of file bitmapimage.h.
|
private |
Definition at line 202 of file bitmapimage.h.
| const QRgb BitmapImage::greenline = qRgba(0,254,0,255) |
Definition at line 33 of file bitmapimage.h.
|
private |
Definition at line 200 of file bitmapimage.h.
|
private |
Definition at line 194 of file bitmapimage.h.
|
private |
Definition at line 198 of file bitmapimage.h.
|
private |
Definition at line 193 of file bitmapimage.h.
|
private |
Definition at line 197 of file bitmapimage.h.
|
private |
Definition at line 204 of file bitmapimage.h.
| const QRgb BitmapImage::redline = qRgba(254,0,0,255) |
Definition at line 32 of file bitmapimage.h.
| const QRgb BitmapImage::transp = qRgba(0, 0, 0, 0) |
Definition at line 30 of file bitmapimage.h.