Render API images as pixmaps
This commit is contained in:
parent
971a8b7b49
commit
d674856b18
2 changed files with 9 additions and 9 deletions
|
@ -50,19 +50,19 @@ private:
|
||||||
QColor fillColor;
|
QColor fillColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OverlayImage : public OverlayItem {
|
class OverlayPixmap : public OverlayItem {
|
||||||
public:
|
public:
|
||||||
OverlayImage(int x, int y, QImage image) {
|
OverlayPixmap(int x, int y, QPixmap pixmap) {
|
||||||
this->x = x;
|
this->x = x;
|
||||||
this->y = y;
|
this->y = y;
|
||||||
this->image = image;
|
this->pixmap = pixmap;
|
||||||
}
|
}
|
||||||
~OverlayImage() {}
|
~OverlayPixmap() {}
|
||||||
virtual void render(QPainter *painter);
|
virtual void render(QPainter *painter);
|
||||||
private:
|
private:
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
QImage image;
|
QPixmap pixmap;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Overlay
|
class Overlay
|
||||||
|
|
|
@ -16,8 +16,8 @@ void OverlayPath::render(QPainter *painter) {
|
||||||
painter->drawPath(this->path);
|
painter->drawPath(this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayImage::render(QPainter *painter) {
|
void OverlayPixmap::render(QPainter *painter) {
|
||||||
painter->drawImage(this->x, this->y, this->image);
|
painter->drawPixmap(this->x, this->y, this->pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlay::renderItems(QPainter *painter) {
|
void Overlay::renderItems(QPainter *painter) {
|
||||||
|
@ -244,7 +244,7 @@ bool Overlay::addImage(int x, int y, QString filepath, bool useCache, int width,
|
||||||
if (setTransparency)
|
if (setTransparency)
|
||||||
image.setColor(0, qRgba(0, 0, 0, 0));
|
image.setColor(0, qRgba(0, 0, 0, 0));
|
||||||
|
|
||||||
this->items.append(new OverlayImage(x, y, image));
|
this->items.append(new OverlayPixmap(x, y, QPixmap::fromImage(image)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +253,6 @@ bool Overlay::addImage(int x, int y, QImage image) {
|
||||||
logError(QString("Failed to load custom image"));
|
logError(QString("Failed to load custom image"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->items.append(new OverlayImage(x, y, image));
|
this->items.append(new OverlayPixmap(x, y, QPixmap::fromImage(image)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue