ImageData (and Images loaded from them) now support different data formats. Resolves issue #1048.

Currently exposed formats are rgba8 and rgba16 (normalized), and rgba16f and rgba32f (floating-point). Some systems, especially mobile ones, won't support every format when creating a love.graphics Image. Use love.graphics.getRawImageFormats to check for support.

love.image.newImageData now takes an optional format parameter as its third argument when creating an empty sized ImageData. It defaults to rgba8.

16-bit PNGs, .hdr images, and floating-point OpenEXR images can now be loaded via love.image.newImageData and love.graphics.newImage.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-05-22 15:28:20 -03:00
parent 3e6d01748e
commit e71f95595c
31 changed files with 12018 additions and 241 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ public:
* @param height The height of the ImageData.
* @return The new ImageData.
**/
virtual ImageData *newImageData(int width, int height) = 0;
virtual ImageData *newImageData(int width, int height, ImageData::Format format = ImageData::FORMAT_RGBA8) = 0;
/**
* Creates empty ImageData with the given size.
@@ -73,7 +73,7 @@ public:
* copy it.
* @return The new ImageData.
**/
virtual ImageData *newImageData(int width, int height, void *data, bool own = false) = 0;
virtual ImageData *newImageData(int width, int height, ImageData::Format format, void *data, bool own = false) = 0;
/**
* Creates new CompressedImageData from FileData.