Add transparency to addTileImage
This commit is contained in:
parent
ac988968b3
commit
1adc489bc0
2 changed files with 4 additions and 2 deletions
|
@ -76,7 +76,7 @@ public:
|
|||
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 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);
|
||||
Q_INVOKABLE void addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int palette, int layer = 0);
|
||||
Q_INVOKABLE void addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int palette, bool setTransparency = false, int layer = 0);
|
||||
Q_INVOKABLE void addTilesImage(int x, int y, QJSValue tilesObj, int layer = 0);
|
||||
Q_INVOKABLE void addMetatileImage(int x, int y, int metatileId, int layer = 0);
|
||||
void refreshAfterPaletteChange(Tileset *tileset);
|
||||
|
|
|
@ -292,7 +292,7 @@ void MainWindow::createImage(int x, int y, QString filepath, int width, int heig
|
|||
this->ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
|
||||
void MainWindow::addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int palette, int layer) {
|
||||
void MainWindow::addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int palette, bool setTransparency, int layer) {
|
||||
if (!this->ui || !this->ui->graphicsView_Map || layer == INT_MAX
|
||||
|| !this->editor || !this->editor->map || !this->editor->map->layout
|
||||
|| !this->editor->map->layout->tileset_primary || !this->editor->map->layout->tileset_secondary)
|
||||
|
@ -302,6 +302,8 @@ void MainWindow::addTileImage(int x, int y, int tileId, bool xflip, bool yflip,
|
|||
this->editor->map->layout->tileset_secondary,
|
||||
palette)
|
||||
.mirrored(xflip, yflip);
|
||||
if (setTransparency)
|
||||
image.setColor(0, qRgba(0, 0, 0, 0));
|
||||
if (this->ui->graphicsView_Map->getOverlay(layer)->addImage(x, y, image))
|
||||
this->ui->graphicsView_Map->scene()->update();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue