CompressedImageFormat (Українська)

Доступне починаючи з LÖVE 0.9.0
Це перелічене значення недоступне в попередніх версіях.

Формати даних для стиснених зображень. Огляд багатьох форматів можна знайти тут (англ.) і тут (англ.).

На відміну від традиційних форматів, таких як PNG чи JPEG, ці формати залишаються стисненими в операційній пам'яті комп'ютера (RAM) та в пам'яті відеокарти (VRAM). Це дозволяє економити місце і прискорює роботу, бо графічна карта може тримати більше пікселів в кеші швидкого доступа.

O.png В версіях LÖVE до 0.10.0 всі ці константи називаються малими літерами.  


Constants

DXT1
Формат DXT1. Дані RGB (червоний—зелений—синій), по 4 біта на піксель (порівняйте з 32 бітами в ImageData і зачайних об'єктах Image (англ.).) Цей формат не підходить для зображень з прозорістю та мобільних систем.
DXT3
Формат DXT3. Дані RGBA (червоний, зелений, синій, прозорість) по 8 бітів на піксель. Цей формат не підходить для плавних змін прозорості.
DXT5
Формат DXT5. Дані RGBA по 8 бітів на піксель. Рекомендується для зображень з різною прозорістю на звичайних комп'ютерах (не мобільних системах).
BC4
The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
BC4s
The signed variant of the BC4 format. Same as above but pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.
BC5
The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
BC5s
The signed variant of the BC5 format.
Доступне починаючи з LÖVE 0.9.2
BC6h
The BC6H format. Stores half-precision floating-point RGB data in the range of [0, 65504] at 8 bits per pixel. Suitable for HDR images on desktop systems.
BC6hs
The signed variant of the BC6H format. Stores RGB data in the range of [-65504, +65504].
BC7
The BC7 format (also known as BPTC.) Stores RGB or RGBA data at 8 bits per pixel.


Доступне починаючи з LÖVE 0.10.0
ETC1
The ETC1 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on older Android devices.
ETC2rgb
The RGB variant of the ETC2 format. RGB data at 4 bits per pixel. Suitable for fully opaque images on newer mobile devices.
ETC2rgba
The RGBA variant of the ETC2 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity on newer mobile devices.
ETC2rgba1
The RGBA variant of the ETC2 format where pixels are either fully transparent or fully opaque. RGBA data at 4 bits per pixel.
EACr
The single-channel variant of the EAC format. Stores just the red channel, at 4 bits per pixel.
EACrs
The signed single-channel variant of the EAC format. Same as above but pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.
EACrg
The two-channel variant of the EAC format. Stores red and green channels at 8 bits per pixel.
EACrgs
The signed two-channel variant of the EAC format.
PVR1rgb2
The 2 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 2 bits per pixel. Textures compressed with PVRTC1 formats must be square and power-of-two sized.
PVR1rgb4
The 4 bit per pixel RGB variant of the PVRTC1 format. Stores RGB data at 4 bits per pixel.
PVR1rgba2
The 2 bit per pixel RGBA variant of the PVRTC1 format.
PVR1rgba4
The 4 bit per pixel RGBA variant of the PVRTC1 format.
ASTC4x4
The 4x4 pixels per block variant of the ASTC format. RGBA data at 8 bits per pixel.
ASTC5x4
The 5x4 pixels per block variant of the ASTC format. RGBA data at 6.4 bits per pixel.
ASTC5x5
The 5x5 pixels per block variant of the ASTC format. RGBA data at 5.12 bits per pixel.
ASTC6x5
The 6x5 pixels per block variant of the ASTC format. RGBA data at 4.27 bits per pixel.
ASTC6x6
The 6x6 pixels per block variant of the ASTC format. RGBA data at 3.56 bits per pixel.
ASTC8x5
The 8x5 pixels per block variant of the ASTC format. RGBA data at 3.2 bits per pixel.
ASTC8x6
The 8x6 pixels per block variant of the ASTC format. RGBA data at 2.67 bits per pixel.
ASTC8x8
The 8x8 pixels per block variant of the ASTC format. RGBA data at 2 bits per pixel.
ASTC10x5
The 10x5 pixels per block variant of the ASTC format. RGBA data at 2.56 bits per pixel.
ASTC10x6
The 10x6 pixels per block variant of the ASTC format. RGBA data at 2.13 bits per pixel.
ASTC10x8
The 10x8 pixels per block variant of the ASTC format. RGBA data at 1.6 bits per pixel.
ASTC10x10
The 10x10 pixels per block variant of the ASTC format. RGBA data at 1.28 bits per pixel.
ASTC12x10
The 12x10 pixels per block variant of the ASTC format. RGBA data at 1.07 bits per pixel.
ASTC12x12
The 12x12 pixels per block variant of the ASTC format. RGBA data at 0.89 bits per pixel.


Примітки

Not all formats are supported in love.graphics Images on all systems, although the DXT formats have close to 100% support on desktop operating systems.

The BC4 and BC5 formats are supported on systems with DirectX 10 / OpenGL 3-capable desktop hardware and drivers. The BC6H and BC7 formats are only supported on desktop systems with DirectX 11 / OpenGL 4-capable hardware and very recent drivers. Mac OS X does not support BC6H or BC7 at all currently.

ETC1 is supported by Android devices, as well as newer (OpenGL ES 3-capable) iOS devices.

The PVR1 formats are supported by iOS devices, as well as Android devices with PowerVR GPUs.

The ETC2 and EAC formats are supported by newer (OpenGL ES 3-capable) iOS and Android devices.

ASTC is only supported by very new mobile devices (e.g. the iPhone 6), and the latest Skylake (and newer) integrated Intel GPUs. It has a variety of variants to allow for picking the most compressed possible one that doesn't have any noticeable compression artifacts, for a given texture.

Use love.graphics.getCompressedImageFormats to check for support:

local supportedformats = love.graphics.getCompressedImageFormats()

if not supportedformats["DXT5"] then
    -- Can't load CompressedImageData with the DXT5 format into images!
    -- On some Linux systems with Mesa drivers, the user will need to install a "libtxc-dxtn" package because the DXT (aka S3TC) formats used to be patented.
    -- Support for DXT formats on all other desktop drivers is pretty much guaranteed.
end

if not supportedformats["BC5"] then
    -- Can't load CompressedImageData with the BC5 format into images!
    -- The user likely doesn't have a video card capable of using that format.
end

Див. також


Іншими мовами