2.15 Pixel formats

Hollywood software bitmaps can currently use the following pixel formats:

HWOS_PIXFMT_RGB15:
Two bytes per pixel. Colors are stored as 0rrrrrgg gggbbbbb.

HWOS_PIXFMT_BGR15:
Two bytes per pixel. Colors are stored as 0bbbbbgg gggrrrrr.

HWOS_PIXFMT_RGB15PC:
Two bytes per pixel. Colors are stored as gggbbbbb 0rrrrrgg.

HWOS_PIXFMT_BGR15PC:
Two bytes per pixel. Colors are stored as gggrrrrr 0bbbbbgg.

HWOS_PIXFMT_RGB16:
Two bytes per pixel. Colors are stored as rrrrrggg gggbbbbb.

HWOS_PIXFMT_BGR16:
Two bytes per pixel. Colors are stored as bbbbbggg gggrrrrr.

HWOS_PIXFMT_RGB16PC:
Two bytes per pixel. Colors are stored as gggbbbbb rrrrrggg.

HWOS_PIXFMT_BGR16PC:
Two bytes per pixel. Colors are stored as gggrrrrr bbbbbggg.

HWOS_PIXFMT_RGB24:
Three bytes per pixel. Colors are stored as rrrrrrrr gggggggg bbbbbbbb.

HWOS_PIXFMT_BGR24:
Three bytes per pixel. Colors are stored as bbbbbbbb gggggggg rrrrrrrr.

HWOS_PIXFMT_ARGB32:
Four bytes per pixel. Colors are stored as aaaaaaaa rrrrrrrr gggggggg bbbbbbbb.

HWOS_PIXFMT_BGRA32:
Four bytes per pixel. Colors are stored as bbbbbbbb gggggggg rrrrrrrr aaaaaaaa.

HWOS_PIXFMT_RGBA32:
Four bytes per pixel. Colors are stored as rrrrrrrr gggggggg bbbbbbbb aaaaaaaa.

HWOS_PIXFMT_ABGR32:
Four bytes per pixel. Colors are stored as aaaaaaaa bbbbbbbb gggggggg rrrrrrrr.

HWOS_PIXFMT_CLUT:
One byte per pixel for all CLUT bit depths.

HWOS_PIXFMT_ALPHA8:
One byte per pixel. Stored as aaaaaaaa.

HWOS_PIXFMT_MONO1:
One bit per pixel (visible and invisible).

Please note that although many pixel formats support the storage of alpha channel information next to the color channel information, Hollywood's software bitmaps always store alpha channel information in separate bitmaps for compatibility with 15-bit and 16-bit screen modes. See Bitmap information for details.

Keep in mind that for 16-bit and 32-bit pixel formats the actual byte storage order is dependent on the endianness of the host system. The constants defined above always specify the byte order when reading words or longwords from memory. Thus, in case a little endian system is used, the actual byte order in memory will be inverted for all 16-bit and 32-bit pixel formats, i.e. if you access a bitmap that uses HWOS_PIXFMT_ARGB32 as its pixel format on a little endian system, the bytes will actually be stored in BGRA order in memory so that you get an ARGB pixel whenever you read a longword from the pixel buffer. Conversely, bitmaps that use HWOS_PIXFMT_BGRA32 will store bytes as ARGB on little endian systems so that you get BGRA pixels when reading a longword from the pixel buffer.


Show TOC