KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
img.h File Reference

Platform-independent image type. More...

#include <sys/cdefs.h>
#include <arch/types.h>

Go to the source code of this file.

Data Structures

struct  kos_img_t
 Platform-indpendent image type. More...
 

Macros

#define KOS_IMG_FMT_I(x)   ((x) & 0xffff)
 Read the platform-independent half of the format.
 
#define KOS_IMG_FMT_D(x)   (((x) >> 16) & 0xffff)
 Read the platform-specific half of the format.
 
#define KOS_IMG_FMT(i, d)   ( ((i) & 0xffff) | (((d) & 0xffff) << 16) )
 Build a format value from a platform-independent half and a platform-specific half of the value.
 
#define KOS_IMG_FMT_NONE   0x00
 Undefined or uninitialized format.
 
#define KOS_IMG_FMT_RGB888   0x01
 24-bpp interleaved R/G/B bytes.
 
#define KOS_IMG_FMT_ARGB8888   0x02
 32-bpp interleaved A/R/G/B bytes.
 
#define KOS_IMG_FMT_RGB565   0x03
 16-bpp interleaved R (5 bits), G (6 bits), B (5 bits).
 
#define KOS_IMG_FMT_ARGB4444   0x04
 16-bpp interleaved A/R/G/B (4 bits each).
 
#define KOS_IMG_FMT_ARGB1555   0x05
 16-bpp interleaved A (1 bit), R (5 bits), G (5 bits), B (5 bits).
 
#define KOS_IMG_FMT_PAL4BPP   0x06
 Paletted, 4 bits per pixel (16 colors).
 
#define KOS_IMG_FMT_PAL8BPP   0x07
 Paletted, 8 bits per pixel (256 colors).
 
#define KOS_IMG_FMT_YUV422   0x08
 8-bit Y (4 bits), U (2 bits), V (2 bits).
 
#define KOS_IMG_FMT_BGR565   0x09
 15-bpp interleaved B (5 bits), G (6 bits), R (5 bits).
 
#define KOS_IMG_FMT_RGBA8888   0x10
 32-bpp interleaved R/G/B/A bytes.
 
#define KOS_IMG_FMT_MASK   0xff
 Basic format mask (not an actual format value).
 
#define KOS_IMG_INVERTED_X   0x0100
 X axis of image data is inverted (stored right to left).
 
#define KOS_IMG_INVERTED_Y   0x0200
 Y axis of image data is inverted (stored bottom to top).
 
#define KOS_IMG_NOT_OWNER   0x0400
 The image is not the owner of the image data buffer.
 

Functions

void kos_img_free (kos_img_t *img, int struct_also)
 Free a kos_img_t object.
 

Detailed Description

Platform-independent image type.

This file provides a platform-independent image type that is designed to hold any sort of textures or other image data. This type contains a very basic description of the image data (width, height, pixel format), as well as the image data itself.

All of the image-loading libraries in kos-ports should provide a function to load the image data into one of these types.

Author
Megan Potter