implemented additional requirement
This commit is contained in:
1 parent
84eea05553
commit
9212be15f4
2 files changed
+18
No files matched your search
@@ -113,6 +113,9 @@ enum class RasterOp { Copy, And, Paint, Invert };
|
||||
void bitBltBitmap(Dpi::Bitmap &dest, int x, int y, int width, int height,
|
||||
Dpi::Bitmap &src, int xSrc, int ySrc, RasterOp rop = RasterOp::Copy);
|
||||
void unshareBitmap(Dpi::Bitmap &bitmap);
|
||||
// Replaces every pixel equal to oldColor with newColor within the given
|
||||
// rectangle (both already-resolved QColors, not raw Delphi ints).
|
||||
void bitmapReplaceColor(Dpi::Bitmap &dst, int x, int y, int width, int height, QColor oldColor, QColor newColor);
|
||||
|
||||
// Draws a masked sprite (AND then OR, via an internal scratch buffer since
|
||||
// Qt's QPainter has no raster-op compositing against the live canvas).
|
||||
|
||||
@@ -217,6 +217,21 @@ void bitBltBitmap(Dpi::Bitmap &dest, int x, int y, int width, int height,
|
||||
|
||||
void unshareBitmap(Dpi::Bitmap &) {}
|
||||
|
||||
void bitmapReplaceColor(Dpi::Bitmap &dst, int x, int y, int width, int height, QColor oldColor, QColor newColor)
|
||||
{
|
||||
const QRgb oldRgb = oldColor.rgb() & 0xFFFFFFu;
|
||||
const QRgb newRgb = newColor.rgb() & 0xFFFFFFu;
|
||||
Dpi::PixelPointer pixel(&dst.image(), x, y);
|
||||
for (int yy = 0; yy < height; ++yy) {
|
||||
for (int xx = 0; xx < width; ++xx) {
|
||||
if ((pixel.pixelRGB() & 0xFFFFFFu) == oldRgb)
|
||||
pixel.setPixelRGB(newRgb);
|
||||
pixel.nextPixel();
|
||||
}
|
||||
pixel.nextLine();
|
||||
}
|
||||
}
|
||||
|
||||
void sprite(Dpi::Canvas &canvas, GraphicSet &graphicSet, int xDst, int yDst,
|
||||
int width, int height, int xGr, int yGr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user