new function

This commit is contained in:
Geoffray Levasseur committed 2026-11-03 16:01:54 +01:00
1 parent 72b08a830d
commit 4944243acb
2 files changed
+16

No files matched your search

+5
View File
@@ -142,6 +142,11 @@ void bitmapReplaceColor(Dpi::Bitmap &dst, int x, int y, int width, int height, Q
// A soft radial glow (GlowRange=8 px) painted around a (width,height)
// rectangle at (x0,y0) within dst, tinted by cl.
void glowFrame(Dpi::Bitmap &dst, int x0, int y0, int width, int height, QColor cl);
// ScreenTools.pas's shared `DrawBuffer` scratch bitmap (resized on demand
// by drawBufferEnsureSize()) - used by dialogs that need an off-screen
// compositing surface for a one-off effect.
extern Dpi::Bitmap drawBuffer;
void drawBufferEnsureSize(int width, int height);
// 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).
+11
View File
@@ -47,6 +47,17 @@ GraphicSet *Templates = nullptr;
Dpi::Bitmap *Colors = nullptr;
Dpi::Bitmap *bigImp = nullptr;
Dpi::Bitmap paper;
Dpi::Bitmap drawBuffer;
void drawBufferEnsureSize(int width, int height)
{
if (drawBuffer.width() >= width && drawBuffer.height() >= height)
return;
drawBuffer.setSize(std::max(drawBuffer.width(), width), std::max(drawBuffer.height(), height));
drawBuffer.canvas().begin();
drawBuffer.canvas().fillRect(QRect(0, 0, drawBuffer.width(), drawBuffer.height()));
drawBuffer.canvas().end();
}
QColor colorFromDelphi(int value)
{