multiple intricate implementations

This commit is contained in:
Geoffray Levasseur committed 2026-11-04 11:41:01 +01:00
1 parent 7aa4ea4425
commit 77690cbd96
109 files changed
+2045 -56

No files matched your search

+50
View File
@@ -935,4 +935,54 @@ void numberBar(Dpi::Canvas &canvas, int x, int y, const QString &cap, int val, c
risedTextOut(canvas, x + 170 - biColorTextWidth(canvas, s), y, s);
}
void underlinedTitleValue(Dpi::Canvas &canvas, const QString &title, const QString &value, int x, int y, int width)
{
dLine(canvas, x, x + width, y + 19, MainTexture->colorBevelLight, MainTexture->colorBevelShade);
risedTextOut(canvas, x, y, title);
risedTextOut(canvas, x + width - biColorTextWidth(canvas, value), y, value);
}
void paintLogo(Dpi::Canvas &canvas, int x, int y, QColor lightColor, QColor shadeColor)
{
GraphicSetItem *logo = Templates ? Templates->searchByName(QStringLiteral("Logo")) : nullptr;
if (!logo)
return;
drawBufferEnsureSize(logo->width, logo->height);
drawBuffer.canvas().begin();
drawBuffer.canvas().copyRect(QRect(0, 0, logo->width, logo->height), canvas, QRect(x, y, logo->width, logo->height));
drawBuffer.canvas().end();
imageOpBCC(drawBuffer, Templates->data, 0, 0, logo->left, logo->top, logo->width, logo->height,
colorToDelphi(lightColor), colorToDelphi(shadeColor));
canvas.copyRect(QRect(x, y, logo->width, logo->height), drawBuffer.canvas(), QRect(0, 0, logo->width, logo->height));
}
namespace {
bool ornamentInitialized = false;
}
void initOrnament()
{
GraphicSetItem *ornament = HGrSystem2 ? HGrSystem2->searchByName(QStringLiteral("Ornament")) : nullptr;
if (ornamentInitialized || !ornament || !MainTexture)
return;
const QColor light = MainTexture->colorBevelLight;
const auto mix = [](int shade, int lightValue) { return ((shade & 0xFC) >> 2) * 3 + ((lightValue & 0xFC) >> 2); };
const QColor shade(mix(MainTexture->colorBevelShade.red(), light.red()),
mix(MainTexture->colorBevelShade.green(), light.green()),
mix(MainTexture->colorBevelShade.blue(), light.blue()));
QImage &image = HGrSystem2->data.image();
const int left = Dpi::scaleToNative(ornament->left);
const int top = Dpi::scaleToNative(ornament->top);
for (int y = top; y < top + Dpi::scaleToNative(ornament->height) && y < image.height(); ++y) {
for (int x = left; x < left + Dpi::scaleToNative(ornament->width) && x < image.width(); ++x) {
const QRgb pixel = image.pixel(x, y) & 0xFFFFFFu;
if (pixel == 0xFF0000u) // pure red marks the light part
image.setPixelColor(x, y, light);
else if (pixel == 0x0000FFu) // pure blue marks the shade part
image.setPixelColor(x, y, shade);
}
}
ornamentInitialized = true;
}
} // namespace Cevo