ImageData: limited support for integer pixel formats.

For now this doesn't support conversions (get/set/mapPixel, etc). Just the ability for ImageData to contain integer pixel contents, for example via Canvas:newImageData.
This commit is contained in:
Alex Szpakowski
2022-04-18 10:46:02 -03:00
parent 8d3730361b
commit e61a664a8b
5 changed files with 42 additions and 53 deletions
+12
View File
@@ -240,11 +240,23 @@ const PixelFormatInfo &getPixelFormatInfo(PixelFormat format)
return formatInfo[format];
}
const char *getPixelFormatName(PixelFormat format)
{
const char *name = "unknown";
getConstant(format, name);
return name;
}
bool isPixelFormatCompressed(PixelFormat format)
{
return formatInfo[format].compressed;
}
bool isPixelFormatColor(PixelFormat format)
{
return formatInfo[format].color;
}
bool isPixelFormatDepthStencil(PixelFormat format)
{
const PixelFormatInfo &info = formatInfo[format];
+10
View File
@@ -157,11 +157,21 @@ bool getConstant(const char *in, PixelFormat &out);
const PixelFormatInfo &getPixelFormatInfo(PixelFormat format);
/**
* Gets the name of the specified pixel format.
**/
const char *getPixelFormatName(PixelFormat format);
/**
* Gets whether the specified pixel format is a compressed type.
**/
bool isPixelFormatCompressed(PixelFormat format);
/**
* Gets whether the specified pixel format is a color type.
**/
bool isPixelFormatColor(PixelFormat format);
/**
* Gets whether the specified pixel format is a depth or stencil type.
**/