mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-27 19:16:31 -05:00
fix tile image export
This commit is contained in:
@@ -62,6 +62,12 @@ unsigned long crc(QByteArray buf, int len)
|
||||
// images in porymap, we can effectively avoid that issue.
|
||||
void exportIndexed4BPPPng(QImage image, QString filepath)
|
||||
{
|
||||
// Verify that the image is not empty
|
||||
if (image.isNull()) {
|
||||
logError(QString("Failed to export %1: the image is null.").arg(filepath));
|
||||
return;
|
||||
}
|
||||
|
||||
// Header
|
||||
QByteArray pngHeader;
|
||||
pngHeader.append(static_cast<char>(0x89));
|
||||
|
||||
@@ -200,7 +200,7 @@ QImage TilesetEditorTileSelector::buildPrimaryTilesIndexedImage() {
|
||||
}
|
||||
|
||||
int primaryLength = this->primaryTileset->tiles->length();
|
||||
int height = primaryLength / this->numTilesWide;
|
||||
int height = primaryLength / this->numTilesWide + 1;
|
||||
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
|
||||
|
||||
QPainter painter(&image);
|
||||
@@ -236,7 +236,7 @@ QImage TilesetEditorTileSelector::buildSecondaryTilesIndexedImage() {
|
||||
}
|
||||
|
||||
int secondaryLength = this->secondaryTileset->tiles->length();
|
||||
int height = secondaryLength / this->numTilesWide;
|
||||
int height = secondaryLength / this->numTilesWide + 1;
|
||||
QImage image(this->numTilesWide * 8, height * 8, QImage::Format_RGBA8888);
|
||||
|
||||
QPainter painter(&image);
|
||||
|
||||
Reference in New Issue
Block a user