mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added support for several specific Canvas formats. Also added love.graphics.hasCanvasFormat.
The list includes RGBA with 4-bit components, RGBA with 10-bit R, G, and B components and a 2-bit alpha component, RGB with 9-bit RGB components and a 5-bit exponent component (for HDR rendering), and several more. --HG-- branch : Canvas-formats
This commit is contained in:
@@ -36,7 +36,7 @@ float Image::maxMipmapSharpness = 0.0f;
|
||||
Texture::FilterMode Image::defaultMipmapFilter = Texture::FILTER_NONE;
|
||||
float Image::defaultMipmapSharpness = 0.0f;
|
||||
|
||||
Image::Image(love::image::ImageData *data, Texture::Format format)
|
||||
Image::Image(love::image::ImageData *data, Format format)
|
||||
: data(data)
|
||||
, cdata(nullptr)
|
||||
, paddedWidth(width)
|
||||
@@ -55,7 +55,7 @@ Image::Image(love::image::ImageData *data, Texture::Format format)
|
||||
preload();
|
||||
}
|
||||
|
||||
Image::Image(love::image::CompressedData *cdata, Texture::Format format)
|
||||
Image::Image(love::image::CompressedData *cdata, Format format)
|
||||
: data(nullptr)
|
||||
, cdata(cdata)
|
||||
, paddedWidth(width)
|
||||
@@ -504,7 +504,7 @@ bool Image::refresh()
|
||||
return true;
|
||||
}
|
||||
|
||||
Texture::Format Image::getFormat() const
|
||||
Image::Format Image::getFormat() const
|
||||
{
|
||||
return format;
|
||||
}
|
||||
@@ -663,6 +663,24 @@ bool Image::hasSRGBSupport()
|
||||
return GLEE_VERSION_2_1 || GLEE_EXT_texture_sRGB;
|
||||
}
|
||||
|
||||
bool Image::getConstant(const char *in, Format &out)
|
||||
{
|
||||
return formats.find(in, out);
|
||||
}
|
||||
|
||||
bool Image::getConstant(Format in, const char *&out)
|
||||
{
|
||||
return formats.find(in, out);
|
||||
}
|
||||
|
||||
StringMap<Image::Format, Image::FORMAT_MAX_ENUM>::Entry Image::formatEntries[] =
|
||||
{
|
||||
{"normal", Image::FORMAT_NORMAL},
|
||||
{"srgb", Image::FORMAT_SRGB},
|
||||
};
|
||||
|
||||
StringMap<Image::Format, Image::FORMAT_MAX_ENUM> Image::formats(Image::formatEntries, sizeof(Image::formatEntries));
|
||||
|
||||
} // opengl
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user