CanvasFormat
Available since LÖVE 0.9.2 |
This enum is not supported in earlier versions. |
Canvas formats.
Contents
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.
- rgba5a1
- 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.
Notes
The 16 bpp formats use half as much VRAM as the 32 bpp formats, but they have significantly lower quality than regular rgba8
.
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 are then interpreted and used in a shader, as long as you draw the right things to the canvas.
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.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info