Split createImage from addImage

This commit is contained in:
GriffinR 2021-12-01 10:33:18 -05:00 committed by huderlem
parent 83a7ccac8b
commit 6a5e4fe247
2 changed files with 10 additions and 2 deletions

View file

@ -74,7 +74,8 @@ public:
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 color = "#000000", int layer = 0);
Q_INVOKABLE void addFilledRect(int x, int y, int width, int height, QString color = "#000000", int layer = 0);
Q_INVOKABLE void addImage(int x, int y, QString filepath, int width = -1, int height = -1, unsigned offset = 0, bool hflip = false, bool vflip = false, bool setTransparency = false, int layer = 0);
Q_INVOKABLE void addImage(int x, int y, QString filepath, int layer = 0);
Q_INVOKABLE void createImage(int x, int y, QString filepath, int width = -1, int height = -1, unsigned offset = 0, bool hflip = false, bool vflip = false, bool setTransparency = false, int layer = 0);
void refreshAfterPaletteChange(Tileset *tileset);
void setTilesetPalette(Tileset *tileset, int paletteIndex, QList<QList<int>> colors);
Q_INVOKABLE void setPrimaryTilesetPalette(int paletteIndex, QList<QList<int>> colors);

View file

@ -277,7 +277,14 @@ void MainWindow::addFilledRect(int x, int y, int width, int height, QString colo
this->ui->graphicsView_Map->scene()->update();
}
void MainWindow::addImage(int x, int y, QString filepath, int width, int height, unsigned offset, bool hflip, bool vflip, bool setTransparency, int layer) {
void MainWindow::addImage(int x, int y, QString filepath, int layer) {
if (!this->ui || !this->ui->graphicsView_Map || layer == INT_MAX)
return;
if (this->ui->graphicsView_Map->getOverlay(layer)->addImage(x, y, filepath, -1, -1, 0, false, false, false))
this->ui->graphicsView_Map->scene()->update();
}
void MainWindow::createImage(int x, int y, QString filepath, int width, int height, unsigned offset, bool hflip, bool vflip, bool setTransparency, int layer) {
if (!this->ui || !this->ui->graphicsView_Map || layer == INT_MAX)
return;
if (this->ui->graphicsView_Map->getOverlay(layer)->addImage(x, y, filepath, width, height, offset, hflip, vflip, setTransparency))