Modules | |
16bpp bitmap surfaces | |
8bpp bitmap surfaces | |
4bpp tiled surfaces, column major | |
4bpp tiled surfaces, row major | |
Enumerations | |
enum | ESurfaceType { SRF_NONE = 0, SRF_BMP16 = 1, SRF_BMP8 = 2, SRF_CHR4R = 4, SRF_CHR4C = 5, SRF_CHR8 = 6, SRF_ALLOCATED = 0x80 } |
Surface types. More... | |
Functions | |
void | srf_init (TSurface *srf, enum ESurfaceType type, const void *data, uint width, uint height, uint bpp, u16 *pal) |
Initalize a surface for type formatted graphics. | |
void | srf_pal_copy (const TSurface *dst, const TSurface *src, uint count) |
Copy count colors from src's palette to dst's palette. | |
void * | srf_get_ptr (const TSurface *srf, uint x, uint y) |
Get the byte address of coordinates (x, y) on the surface. | |
INLINE uint | srf_align (uint width, uint bpp) |
Get the word-aligned number of bytes for a scanline. | |
INLINE void | srf_set_ptr (TSurface *srf, const void *ptr) |
Set Data-pointer surface for srf. | |
INLINE void | srf_set_pal (TSurface *srf, const u16 *pal, uint size) |
Set the palette pointer and its size. | |
INLINE void * | _srf_get_ptr (const TSurface *srf, uint x, uint y, uint stride) |
Inline and semi-safe version of srf_get_ptr(). Use with caution. |
Tonclib's Surface system provides the basic functionality for drawing onto graphic surfaces of different types. This includes
For each of these functions exist for the most important drawing options: plotting, lines and rectangles. For BMP8/BMP16 and to some extent CHR4C, there are blitters as well.
enum ESurfaceType |
INLINE uint srf_align | ( | uint | width, | |
uint | bpp | |||
) |
Get the word-aligned number of bytes for a scanline.
width | Number of pixels. | |
bpp | Bits per pixel. |
void srf_init | ( | TSurface * | srf, | |
enum ESurfaceType | type, | |||
const void * | data, | |||
uint | width, | |||
uint | height, | |||
uint | bpp, | |||
u16 * | pal | |||
) |
Initalize a surface for type formatted graphics.
srf | Surface to initialize. | |
type | Surface type. See |
data | Pointer to the surface memory. | |
width | Width of surface. | |
height | Height of surface. | |
bpp | Bitdepth. If type is not 0, this value will be ignored. | |
pal | Pointer to the surface's palette. |