mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-12 19:05:37 -05:00
Add rotation and scale to overlay API
This commit is contained in:
@@ -44,6 +44,17 @@ public:
|
||||
Q_INVOKABLE int getOpacity(int layer = 0);
|
||||
Q_INVOKABLE void setOpacity(int opacity, int layer);
|
||||
Q_INVOKABLE void setOpacity(int opacity);
|
||||
Q_INVOKABLE int getHorizontalScale(int layer);
|
||||
Q_INVOKABLE int getVerticalScale(int layer);
|
||||
Q_INVOKABLE void setHorizontalScale(int scale, int layer);
|
||||
Q_INVOKABLE void setHorizontalScale(int scale);
|
||||
Q_INVOKABLE void setVerticalScale(int scale, int layer);
|
||||
Q_INVOKABLE void setVerticalScale(int scale);
|
||||
Q_INVOKABLE int getRotation(int layer);
|
||||
Q_INVOKABLE void setRotation(int rotation, int layer);
|
||||
Q_INVOKABLE void setRotation(int rotation);
|
||||
Q_INVOKABLE void rotate(int degrees, int layer);
|
||||
Q_INVOKABLE void rotate(int degrees);
|
||||
Q_INVOKABLE void addText(QString text, int x, int y, QString color = "#000000", int fontSize = 12, int layer = 0);
|
||||
Q_INVOKABLE void addRect(int x, int y, int width, int height, QString borderColor = "#000000", QString fillColor = "transparent", int rounding = 0, int layer = 0);
|
||||
Q_INVOKABLE void addPath(QList<int> x, QList<int> y, QString borderColor = "#000000", QString fillColor = "transparent", int layer = 0);
|
||||
|
||||
@@ -11,7 +11,7 @@ class OverlayItem {
|
||||
public:
|
||||
OverlayItem() {}
|
||||
virtual ~OverlayItem() {};
|
||||
virtual void render(QPainter *, int, int) {};
|
||||
virtual void render(QPainter *) {};
|
||||
};
|
||||
|
||||
class OverlayText : public OverlayItem {
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
this->fontSize = fontSize;
|
||||
}
|
||||
~OverlayText() {}
|
||||
virtual void render(QPainter *painter, int x, int y);
|
||||
virtual void render(QPainter *painter);
|
||||
private:
|
||||
const QStaticText text;
|
||||
int x;
|
||||
@@ -37,17 +37,13 @@ private:
|
||||
class OverlayPath : public OverlayItem {
|
||||
public:
|
||||
OverlayPath(QPainterPath path, QColor borderColor, QColor fillColor) {
|
||||
this->prevX = 0;
|
||||
this->prevY = 0;
|
||||
this->path = path;
|
||||
this->borderColor = borderColor;
|
||||
this->fillColor = fillColor;
|
||||
}
|
||||
~OverlayPath() {}
|
||||
virtual void render(QPainter *painter, int x, int y);
|
||||
virtual void render(QPainter *painter);
|
||||
private:
|
||||
int prevX;
|
||||
int prevY;
|
||||
QPainterPath path;
|
||||
QColor borderColor;
|
||||
QColor fillColor;
|
||||
@@ -61,7 +57,7 @@ public:
|
||||
this->image = image;
|
||||
}
|
||||
~OverlayImage() {}
|
||||
virtual void render(QPainter *painter, int x, int y);
|
||||
virtual void render(QPainter *painter);
|
||||
private:
|
||||
int x;
|
||||
int y;
|
||||
@@ -74,6 +70,9 @@ public:
|
||||
Overlay() {
|
||||
this->x = 0;
|
||||
this->y = 0;
|
||||
this->rotation = 0;
|
||||
this->hScale = 1.0;
|
||||
this->vScale = 1.0;
|
||||
this->hidden = false;
|
||||
this->opacity = 1.0;
|
||||
this->clippingRect = nullptr;
|
||||
@@ -89,6 +88,13 @@ public:
|
||||
int getY();
|
||||
void setX(int x);
|
||||
void setY(int y);
|
||||
int getHScale();
|
||||
int getVScale();
|
||||
void setHScale(int scale);
|
||||
void setVScale(int scale);
|
||||
int getRotation();
|
||||
void setRotation(int rotation);
|
||||
void rotate(int degrees);
|
||||
void setClippingRect(QRectF rect);
|
||||
void clearClippingRect();
|
||||
void setPosition(int x, int y);
|
||||
@@ -100,12 +106,15 @@ public:
|
||||
bool addRect(int x, int y, int width, int height, QString borderColorStr, QString fillColorStr, int rounding);
|
||||
bool addImage(int x, int y, QString filepath, bool useCache = true, int width = -1, int height = -1, int xOffset = 0, int yOffset = 0, qreal hScale = 1, qreal vScale = 1, QList<QRgb> palette = QList<QRgb>(), bool setTransparency = false);
|
||||
bool addImage(int x, int y, QImage image);
|
||||
bool addPath(QList<int> x, QList<int> y, QString borderColorStr, QString fillColorStr);
|
||||
bool addPath(QList<int> xCoords, QList<int> yCoords, QString borderColorStr, QString fillColorStr);
|
||||
private:
|
||||
QColor getColor(QString colorStr);
|
||||
QList<OverlayItem*> items;
|
||||
int x;
|
||||
int y;
|
||||
int rotation;
|
||||
qreal hScale;
|
||||
qreal vScale;
|
||||
bool hidden;
|
||||
qreal opacity;
|
||||
QRectF *clippingRect;
|
||||
|
||||
Reference in New Issue
Block a user