mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-15 04:15:36 -05:00
Add rounding to addRect, add fill color to addPath
This commit is contained in:
@@ -45,7 +45,8 @@ public:
|
||||
Q_INVOKABLE void setOpacity(int opacity, int layer);
|
||||
Q_INVOKABLE void setOpacity(int opacity);
|
||||
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 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);
|
||||
Q_INVOKABLE void addImage(int x, int y, QString filepath, int layer = 0, bool useCache = true);
|
||||
Q_INVOKABLE void createImage(int x, int y, QString filepath,
|
||||
int width = -1, int height = -1, int xOffset = 0, int yOffset = 0,
|
||||
@@ -54,7 +55,6 @@ public:
|
||||
Q_INVOKABLE void addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int paletteId, bool setTransparency = false, int layer = 0);
|
||||
Q_INVOKABLE void addTileImage(int x, int y, QJSValue tileObj, bool setTransparency = false, int layer = 0);
|
||||
Q_INVOKABLE void addMetatileImage(int x, int y, int metatileId, bool setTransparency = false, int layer = 0);
|
||||
Q_INVOKABLE void addPath(QList<int> x, QList<int> y, QString color = "#000000", int layer = 0);
|
||||
|
||||
private:
|
||||
QMap<int, Overlay*> overlayMap;
|
||||
|
||||
@@ -34,23 +34,21 @@ private:
|
||||
int fontSize;
|
||||
};
|
||||
|
||||
class OverlayRect : public OverlayItem {
|
||||
class OverlayPath : public OverlayItem {
|
||||
public:
|
||||
OverlayRect(int x, int y, int width, int height, QColor borderColor, QColor fillColor) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
OverlayPath(QPainterPath path, QColor borderColor, QColor fillColor) {
|
||||
this->prevX = 0;
|
||||
this->prevY = 0;
|
||||
this->path = path;
|
||||
this->borderColor = borderColor;
|
||||
this->fillColor = fillColor;
|
||||
}
|
||||
~OverlayRect() {}
|
||||
~OverlayPath() {}
|
||||
virtual void render(QPainter *painter, int x, int y);
|
||||
private:
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int prevX;
|
||||
int prevY;
|
||||
QPainterPath path;
|
||||
QColor borderColor;
|
||||
QColor fillColor;
|
||||
};
|
||||
@@ -70,23 +68,6 @@ private:
|
||||
QImage image;
|
||||
};
|
||||
|
||||
class OverlayPath : public OverlayItem {
|
||||
public:
|
||||
OverlayPath(QPainterPath path, QColor color) {
|
||||
this->prevX = 0;
|
||||
this->prevY = 0;
|
||||
this->path = path;
|
||||
this->color = color;
|
||||
}
|
||||
~OverlayPath() {}
|
||||
virtual void render(QPainter *painter, int x, int y);
|
||||
private:
|
||||
int prevX;
|
||||
int prevY;
|
||||
QPainterPath path;
|
||||
QColor color;
|
||||
};
|
||||
|
||||
class Overlay
|
||||
{
|
||||
public:
|
||||
@@ -115,13 +96,13 @@ public:
|
||||
void renderItems(QPainter *painter);
|
||||
QList<OverlayItem*> getItems();
|
||||
void clearItems();
|
||||
bool addText(const QString text, int x, int y, QString colorStr, int fontSize);
|
||||
bool addRect(int x, int y, int width, int height, QString borderColorStr, QString fillColorStr);
|
||||
void addText(const QString text, int x, int y, QString colorStr, int fontSize);
|
||||
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 colorStr);
|
||||
bool addPath(QList<int> x, QList<int> y, QString borderColorStr, QString fillColorStr);
|
||||
private:
|
||||
QColor getColor(QString colorStr, bool * ok);
|
||||
QColor getColor(QString colorStr);
|
||||
QList<OverlayItem*> items;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
Reference in New Issue
Block a user