Surface API.
More...
Go to the source code of this file.
|
| size_t | SizeofGraphic (lcd_surface_t *surface) |
| | Calculate the total on-memory size of a surface (including descriptor).
|
| |
| lcd_surface_t * | InitGraphic (lcd_surface_t *surface, short width, short height, short depth) |
| | Initialize a buffer as an all-in-one surface.
|
| |
| void | _BitBlt (lcd_surface_t *dst, short xdstoffset, short ydstoffset, short xsize, short ysize, lcd_surface_t *src, int xsrcoffset, int ysrcoffset, unsigned short flags) |
| | Perform blit operation from src surface to dst surface.
|
| |
| size_t | GetImageSize (short width, short height) |
| | Calculate the buffer size required for an all-in-one surface of a specific size.
|
| |
| size_t | GetImageSizeExt (short width, short height, short depth) |
| | Calculate the buffer size required for an all-in-one surface of a specific pixel format and size.
|
| |
| void * | ImageData (lcd_surface_t *surface) |
| | Get the palette and bitmap buffer for an all-in-one surface.
|
| |
| size_t | SizeofImage (lcd_surface_t *surface) |
| | Get the total on-memory size of a surface, in bytes.
|
| |
| void | FreeImage (lcd_surface_t *surface) |
| | Dispose an all-in-one surface.
|
| |
◆ _BitBlt()
| void _BitBlt |
( |
lcd_surface_t * |
dst, |
|
|
short |
xdstoffset, |
|
|
short |
ydstoffset, |
|
|
short |
xsize, |
|
|
short |
ysize, |
|
|
lcd_surface_t * |
src, |
|
|
int |
xsrcoffset, |
|
|
int |
ysrcoffset, |
|
|
unsigned short |
flags |
|
) |
| |
|
extern |
Perform blit operation from src surface to dst surface.
This copies a rectangle of size (xsize, ysize) px on the src surface, with its the top left corner located at (xsrcoffset, ysrcoffset) px, to the dst surface. The top left corner of that rectangle will be aligned to a point on the dst surface at (xdstoffset, ydstoffset) px. Optionally one can specify one or more processing flags to let the blitter perform certain pixel operations on-the-fly.
- Syscall Number
0x10089
- Parameters
-
| dst | Destination surface. |
| xdstoffset | X coordinate of the destination surface that align with the top left corner of the blitted image, in pixels. |
| ydstoffset | Y coordinate of the destination surface that align with the top left corner of the blitted image, in pixels. |
| xsize | Number of pixel columns to copy. |
| ysize | Number of pixel rows to copy. |
| src | Source surface. |
| xsrcoffset | X coordinate of the source surface that align with the top left corner of the blitted image, in pixels. |
| ysrcoffset | Y coordinate of the source surface that align with the top left corner of the blitted image, in pixels. |
| flags | Process flags. |
- Returns
- None.
- See also
- blit_flag_e Accepted processing flags.
-
BitBlt in WinGDI, which this function has been loosely based on.
◆ FreeImage()
Dispose an all-in-one surface.
This is simply a wrapper around _lfree().
- Warning
- Behavior is undefined when not called on a dymically allocated (via lmalloc(), lcalloc() or lrealloc()) all-in-one surface.
- Syscall Number
0x10099
- Parameters
-
| surface | The surface descriptor. |
- Returns
- None.
◆ GetImageSize()
| size_t GetImageSize |
( |
short |
width, |
|
|
short |
height |
|
) |
| |
|
extern |
Calculate the buffer size required for an all-in-one surface of a specific size.
This assumes the surface will be in the same format as the surface linked to the current active LCD.
- Syscall Number
0x10095
- Parameters
-
| width | The width of the desired surface. |
| height | The height of the desired surface. |
- Returns
- The buffer size required to contain the entire surface.
◆ GetImageSizeExt()
| size_t GetImageSizeExt |
( |
short |
width, |
|
|
short |
height, |
|
|
short |
depth |
|
) |
| |
|
extern |
Calculate the buffer size required for an all-in-one surface of a specific pixel format and size.
This is similar to GetImageSize() but it allows arbitrary pixel bit depth.
- Syscall Number
0x10096
- Parameters
-
| width | The width of the desired surface. |
| height | The height of the desired surface. |
| depth | The pixel bit depth of the desired surface. |
- Returns
- The buffer size required to contain the entire surface.
- See also
- InitGraphic For some assumptions made for an all-in-one surface format.
◆ ImageData()
Get the palette and bitmap buffer for an all-in-one surface.
- Warning
- The behavior of calling this on a hardware framebuffer backed surface is undefined as those surfaces may allocate the palette and/or the pixel buffer not immediately after the descriptor. Use lcd_surface_t::palette or lcd_surface_t::buffer instead for those surfaces.
- Syscall Number
0x10097
- Parameters
-
| surface | The surface descriptor. |
- Returns
- Pointer to surface palette buffer when a palette is available, or otherwise pointer to the pixel buffer.
◆ InitGraphic()
Initialize a buffer as an all-in-one surface.
If a palette is required (depth is 8-bit or less), the palette is assumed to follow the descriptor immediately, then the pixel buffer is assumed to start immediately after the palette. Otherwise the pixel buffer is assumed to follow the descriptor immediately (i.e. palette size is 0) and lcd_surface_t::palette will be set to NULL.
- Note
- This function does not allocate any memory. The caller is responsible for allocating a buffer that is large enough to hold the descriptor, the palette (if required) and the pixel buffer.
- Syscall Number
0x1005b
- Parameters
-
| surface | A buffer that will hold the data. |
| width | Width of the surface in pixels. |
| height | Height of the surface in pixels. |
| depth | The pixel bit depth. |
- Returns
- The same buffer.
- See also
- GetImageSizeExt A function that can be used to estimate the required size of the
surface buffer, based on the same parameters that will be passed to this function.
◆ SizeofGraphic()
Calculate the total on-memory size of a surface (including descriptor).
- Syscall Number
0x1005a
- Parameters
-
| surface | The surface descriptor. |
- Returns
- The total on-memory size of this surface in bytes.
◆ SizeofImage()
Get the total on-memory size of a surface, in bytes.
This is equivalent to
}
Descriptor of an LCD drawing surface or hardware framebuffer.
Definition common.h:728
short height
Height of the framebuffer.
Definition common.h:741
short width
Width of the framebuffer.
Definition common.h:737
size_t GetImageSize(short width, short height)
Calculate the buffer size required for an all-in-one surface of a specific size.
size_t SizeofImage(lcd_surface_t *surface)
Get the total on-memory size of a surface, in bytes.
- Syscall Number
0x10098
- Parameters
-
| surface | Pointer to the surface descriptor. |
- Returns
- The on-memory size of the surface.