added missing tools
This commit is contained in:
1 parent
e71c06ee31
commit
f9f00c8622
2 files changed
+76
-2
No files matched your search
@@ -46,6 +46,7 @@ GraphicSet *HGrSystem2 = nullptr;
|
||||
GraphicSet *Templates = nullptr;
|
||||
Dpi::Bitmap *Colors = nullptr;
|
||||
Dpi::Bitmap *bigImp = nullptr;
|
||||
Dpi::Bitmap paper;
|
||||
|
||||
QColor colorFromDelphi(int value)
|
||||
{
|
||||
@@ -152,8 +153,6 @@ GraphicSet *loadGraphicSet(const QString &name, bool transparency)
|
||||
result->resetPixUsed();
|
||||
|
||||
if (transparency) {
|
||||
constexpr QRgb TransparentColor1 = 0xFF00FF;
|
||||
constexpr QRgb TransparentColor2 = 0x7F007F;
|
||||
result->mask.setSize(result->data.width(), result->data.height());
|
||||
Dpi::PixelPointer dataPixel(&result->data.image(), 0, 0);
|
||||
Dpi::PixelPointer maskPixel(&result->mask.image(), 0, 0);
|
||||
@@ -341,6 +340,62 @@ void fill(Dpi::Canvas &canvas, const QRect &rect, const QPoint &offset)
|
||||
fill(canvas, rect.left(), rect.top(), rect.width(), rect.height(), offset.x(), offset.y());
|
||||
}
|
||||
|
||||
void fillSeamless(Dpi::Canvas &canvas, int left, int top, int width, int height, int xOffset, int yOffset,
|
||||
Dpi::Bitmap &texture)
|
||||
{
|
||||
if (texture.width() <= 0 || texture.height() <= 0)
|
||||
return;
|
||||
while (xOffset < 0)
|
||||
xOffset += texture.width();
|
||||
while (yOffset < 0)
|
||||
yOffset += texture.height();
|
||||
|
||||
for (int y = (top + yOffset) / texture.height(); y <= (top + yOffset + height - 1) / texture.height(); ++y) {
|
||||
int y0cut = top + yOffset - y * texture.height();
|
||||
if (y0cut < 0)
|
||||
y0cut = 0;
|
||||
int y1cut = (y + 1) * texture.height() - (top + yOffset + height);
|
||||
if (y1cut < 0)
|
||||
y1cut = 0;
|
||||
for (int x = (left + xOffset) / texture.width(); x <= (left + xOffset + width - 1) / texture.width(); ++x) {
|
||||
int x0cut = left + xOffset - x * texture.width();
|
||||
if (x0cut < 0)
|
||||
x0cut = 0;
|
||||
int x1cut = (x + 1) * texture.width() - (left + xOffset + width);
|
||||
if (x1cut < 0)
|
||||
x1cut = 0;
|
||||
canvas.copyRect(QRect(x * texture.width() + x0cut - xOffset, y * texture.height() + y0cut - yOffset,
|
||||
texture.width() - x0cut - x1cut, texture.height() - y0cut - y1cut),
|
||||
texture.canvas(), QRect(x0cut, y0cut, texture.width() - x0cut - x1cut,
|
||||
texture.height() - y0cut - y1cut));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fillRectSeamless(Dpi::Canvas &canvas, int x0, int y0, int x1, int y1, int xOffset, int yOffset,
|
||||
Dpi::Bitmap &texture)
|
||||
{
|
||||
fillSeamless(canvas, x0, y0, x1 - x0, y1 - y0, xOffset, yOffset, texture);
|
||||
}
|
||||
|
||||
void texturize(Dpi::Bitmap &dest, Dpi::Bitmap &texture, QColor transparentColor)
|
||||
{
|
||||
if (texture.width() <= 0 || texture.height() <= 0)
|
||||
return;
|
||||
const QRgb transparentRgb = transparentColor.rgb() & 0xFFFFFFu;
|
||||
Dpi::PixelPointer dstPixel(&dest.image(), 0, 0);
|
||||
for (int y = 0; y < dest.height(); ++y) {
|
||||
for (int x = 0; x < dest.width(); ++x) {
|
||||
if ((dstPixel.pixelRGB() & 0xFFFFFFu) == transparentRgb) {
|
||||
Dpi::PixelPointer srcPixel(&texture.image(), x % texture.width(), y % texture.height());
|
||||
dstPixel.setPixelRGB(srcPixel.pixelRGB());
|
||||
}
|
||||
dstPixel.nextPixel();
|
||||
}
|
||||
dstPixel.nextLine();
|
||||
}
|
||||
}
|
||||
|
||||
void paintBackground(Dpi::Canvas &canvas, int left, int top, int width, int height, int formWidth, int formHeight)
|
||||
{
|
||||
Q_UNUSED(formWidth);
|
||||
|
||||
Reference in new issue
Block a user