CanvasFormat

Available since LÖVE 0.9.2
This enum is not supported in earlier versions.

Canvas formats.

Constants

normal
The default Canvas format - an alias for the rgba8 format, normally.
rgba8
8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders.)
rgba4
4 bits per channel (16 bpp) RGBA.
rgb5a1
RGB with 5 bits each, and a 1-bit alpha channel (16 bpp.)
rgb565
RGB with 5, 6, and 5 bits each, respectively (16 bpp). There is no alpha channel in this format.
rgb10a2
RGB with 10 bits per channel, and a 2-bit alpha channel (32 bpp.)
hdr
A format suitable for high dynamic range content - an alias for the rgba16f format, normally.
rgba16f
Floating point RGBA with 16 bits per channel (64 bpp.) Color values can range from [-infinity, +infinity].
rgba32f
Floating point RGBA with 32 bits per channel (128 bpp.) Color values can range from [-infinity, +infinity].
rg11b10f
Floating point RGB with 11 bits in the red and green channels, and 10 bits in the blue channel (32 bpp.) There is no alpha channel. Color values can range from [0, +infinity].
srgb
The same as rgba8, but the Canvas is interpreted as being in the sRGB color space. Everything drawn to the Canvas will be converted from linear RGB to sRGB. When the Canvas is drawn (or used in a shader), it will be decoded from sRGB to linear RGB.
Available since LÖVE 0.10.0
These constants are not supported in earlier versions.
r8
Single-channel red format (8 bpp.)
rg8
Two channel red and green format with 8 bits per channel (16 bpp.)
r16f
Floating point 16 bit format with a single red channel (16 bpp.) Color values can range rom [-infinity, +infinity].
rg16f
Floating point 16 bit per channel format with two channels (32 bpp.) Color values can range rom [-infinity, +infinity].
r32f
Floating point 32 bit format with a single red channel (32 bpp.) Color values can range rom [-infinity, +infinity].
rg32f
Floating point 32 bit per channel format with two channels (64 bpp.) Color values can range rom [-infinity, +infinity].

Notes

The 16 bpp RGB and RGBA formats use half as much VRAM as the 32 bpp RGBA formats, but they have significantly lower quality.

The HDR / floating point formats are most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which can then be used in a custom shader.

The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering here, here, and here.

Not all systems support every format. Use love.graphics.getCanvasFormats to check before creating the Canvas.

In general, rgba8, rgba4, rgb5a1, and rgb10a2 are supported everywhere. The floating-point formats (rgba16f, rgba32f, and rg11b10f) and srgb are supported on graphics cards capable of OpenGL 3+ / DirectX 10+ (nvidia GeForce 8000 series and up, ATI/AMD HD 2000 series and up, and the Intel HD 2000 and up.) rgb565 is often only supported on OpenGL ES or very new desktop OpenGL drivers.

See Also

Other Languages