diff --git a/src/common/utilities/load_save.cpp b/src/common/utilities/load_save.cpp index 5ce951f8c..dce421538 100644 --- a/src/common/utilities/load_save.cpp +++ b/src/common/utilities/load_save.cpp @@ -333,9 +333,37 @@ QImage loadImage(const QString& filename, GLLogStream* log, vcg::CallBackPos* cb } } -QImage getDummyTexture() +QImage getDummyTexture(int imageSize, int checkSize, bool gridFlag) { - return QImage(":/resources/images/dummy.png"); + QImage image(imageSize, imageSize, QImage::Format_RGB32); + if(gridFlag) + { + for (int y = 0; y < imageSize; ++y) { + for (int x = 0; x < imageSize; ++x) { + if ( ((x/checkSize) %2 ) == ((y/checkSize) % 2)) { + image.setPixel(x, y, 0xFFFFFF); + } else { + image.setPixel(x, y, 0x808080); + } + } + } + } + else + { + for (int y = 0; y < imageSize; ++y) { + for (int x = 0; x < imageSize; ++x) { + if ( (x%checkSize) == 0 || (y%checkSize) == 0) + image.setPixel(x, y, 0xFFFFFF); + else + image.setPixel(x, y, 0x808080); + } + } + } + // Save the image to a file. + image.save("checkerboard.png"); + + return image; + // QImage(":/resources/images/dummy.png"); } void saveImage( diff --git a/src/common/utilities/load_save.h b/src/common/utilities/load_save.h index cfc28a28f..faf2b8b98 100644 --- a/src/common/utilities/load_save.h +++ b/src/common/utilities/load_save.h @@ -70,7 +70,7 @@ void saveAllMeshes( QImage loadImage(const QString& filename, GLLogStream* log = nullptr, vcg::CallBackPos* cb = nullptr); -QImage getDummyTexture(); +QImage getDummyTexture(int size=512, int checkNum=8, bool gridFlag=false); void saveImage( const QString& filename,