added city mark

This commit is contained in:
Geoffray Levasseur committed 2026-11-04 16:13:13 +01:00
1 parent 808b403bba
commit c30531e032
2 files changed
+28

No files matched your search

+2
View File
@@ -254,6 +254,8 @@ void paintLogo(Dpi::Canvas &canvas, int x, int y, QColor lightColor, QColor shad
// ScreenTools.pas's InitOrnament(): recolours the ornament sprite to the
// current texture's bevel colours (once).
void initOrnament();
// ScreenTools.pas's InitCityMark(): tints the city mark sprite (System graphics) with the texture's mark colour.
void initCityMark(const Texture &texture);
// ScreenTools.pas's DarkenImage(): subtracts `change` from every colour channel (clamped at 0).
void darkenImage(Dpi::Bitmap &bitmap, int change);
+26
View File
@@ -1007,6 +1007,32 @@ void paintLogo(Dpi::Canvas &canvas, int x, int y, QColor lightColor, QColor shad
canvas.copyRect(QRect(x, y, logo->width, logo->height), drawBuffer.canvas(), QRect(0, 0, logo->width, logo->height));
}
void initCityMark(const Texture &texture)
{
if (!HGrSystem)
return;
const GraphicSetItem *mark1 = HGrSystem->searchByName(QStringLiteral("CityMark1"));
const GraphicSetItem *mark2 = HGrSystem->searchByName(QStringLiteral("CityMark2"));
if (!mark1 || !mark2)
return;
QImage &data = HGrSystem->data.image();
QImage &mask = HGrSystem->mask.image();
const QColor color = texture.colorMark;
for (int x = 0; x < mark1->width; ++x) {
for (int y = 0; y < mark1->height; ++y) {
if ((mask.pixel(mark1->left + x, mark1->top + y) & 0xFFFFFFu) != 0)
continue;
const int intensity = qRed(data.pixel(mark1->left + x, mark1->top + y));
data.setPixel(mark2->left + x, mark2->top + y,
qRgb(color.red() * intensity / 0xFF, color.green() * intensity / 0xFF,
color.blue() * intensity / 0xFF));
}
}
// (the original copies mark1.Width rows here, which is square anyway)
bitBltBitmap(HGrSystem->mask, mark2->left, mark2->top, mark1->width, mark1->width, HGrSystem->mask, mark1->left,
mark1->top);
}
void darkenImage(Dpi::Bitmap &bitmap, int change)
{
QImage &image = bitmap.image();