libtonc
|
Basic video surface API. The TSurface struct and the various functions working on it provide a basic API for working with different types of graphic surfaces, like 16bpp bitmaps, 8bpp bitmaps, but also tiled surfaces.
More...
Modules | |
16bpp bitmap surfaces | |
8bpp bitmap surfaces | |
4bpp tiled surfaces, column major | |
4bpp tiled surfaces, row major | |
Typedefs | |
typedef enum ESurfaceType | ESurfaceType |
Surface types. | |
typedef struct TSurface | TSurface |
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... | |
Variables | |
u8 * | TSurface::data |
Surface data pointer. | |
u32 | TSurface::pitch |
Scanline pitch in bytes (PONDER: alignment?). | |
u16 | TSurface::width |
Image width in pixels. | |
u16 | TSurface::height |
Image width in pixels. | |
u8 | TSurface::bpp |
Bits per pixel. | |
u8 | TSurface::type |
Surface type (not used that much). | |
u16 | TSurface::palSize |
Number of colors. | |
u16 * | TSurface::palData |
Pointer to palette. | |
const char * | TSurfaceProcTab::name |
fnGetPixel | TSurfaceProcTab::getPixel |
fnPlot | TSurfaceProcTab::plot |
fnHLine | TSurfaceProcTab::hline |
fnVLine | TSurfaceProcTab::vline |
fnLine | TSurfaceProcTab::line |
fnRect | TSurfaceProcTab::rect |
fnFrame | TSurfaceProcTab::frame |
fnBlit | TSurfaceProcTab::blit |
fnFlood | TSurfaceProcTab::flood |
Rendering procedure types | |
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. | |
Basic video surface API. The TSurface struct and the various functions working on it provide a basic API for working with different types of graphic surfaces, like 16bpp bitmaps, 8bpp bitmaps, but also tiled surfaces.
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. |
Referenced by srf_init().
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. |
References srf_align(), SRF_ALLOCATED, SRF_BMP16, SRF_BMP8, SRF_CHR4C, SRF_CHR4R, and SRF_CHR8.
Referenced by tte_init_ase(), tte_init_chr4c(), tte_init_chr4r(), and tte_init_se().