libnx
v4.8.0
|
Framebuffer wrapper object, providing support for software rendered graphics. More...
Go to the source code of this file.
Data Structures | |
struct | Framebuffer |
Framebuffer structure. More... | |
Macros | |
#define | RGBA8(r, g, b, a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24)) |
Converts red/green/blue/alpha components to packed RGBA8 (i.e. PIXEL_FORMAT_RGBA_8888). | |
#define | RGBA8_MAXALPHA(r, g, b) RGBA8((r),(g),(b),0xff) |
Same as RGBA8 except with alpha=0xff. | |
#define | RGBX8(r, g, b) RGBA8((r),(g),(b),0) |
Converts red/green/blue to packed RGBX8 (i.e. PIXEL_FORMAT_RGBX_8888). | |
#define | RGB565(r, g, b) (((b)&0x1f)|(((g)&0x3f)<<5)|(((r)&0x1f)<<11)) |
Converts red/green/blue components to packed RGB565 (i.e. PIXEL_FORMAT_RGB_565) | |
#define | RGB565_FROM_RGB8(r, g, b) RGB565((r)>>3,(g)>>2,(b)>>3) |
Same as RGB565 but accepting 8-bit components as input instead. | |
#define | BGRA8(r, g, b, a) RGBA8((b),(g),(r),(a)) |
Converts red/green/blue/alpha components to packed BGR8 (i.e. PIXEL_FORMAT_BGRA_8888). | |
#define | BGRA8_MAXALPHA(r, g, b) RGBA8((b),(g),(r),0xff) |
Same as BGRA8 except with alpha=0xff. | |
#define | RGBA4(r, g, b, a) (((r)&0xf)|(((g)&0xf)<<4)|(((b)&0xf)<<8)|(((a)&0xf)<<12)) |
Converts red/green/blue/alpha components to packed RGBA4 (i.e. PIXEL_FORMAT_RGBA_4444). | |
#define | RGBA4_MAXALPHA(r, g, b) RGBA4((r),(g),(b),0xf) |
Same as RGBA4 except with alpha=0xf. | |
#define | RGBA4_FROM_RGBA8(r, g, b, a) RGBA4((r)>>4,(g)>>4,(b)>>4,(a)>>4) |
Same as RGBA4 but accepting 8-bit components as input instead. | |
#define | RGBA4_FROM_RGBA8_MAXALPHA(r, g, b) RGBA4_MAXALPHA((r)>>4,(g)>>4,(b)>>4) |
Same as RGBA4_MAXALPHA except with alpha=0xff. | |
Functions | |
Result | framebufferCreate (Framebuffer *fb, NWindow *win, u32 width, u32 height, u32 format, u32 num_fbs) |
Creates a Framebuffer object. More... | |
Result | framebufferMakeLinear (Framebuffer *fb) |
Enables linear framebuffer mode in a Framebuffer, allocating a shadow buffer in the process. | |
void | framebufferClose (Framebuffer *fb) |
Closes a Framebuffer object, freeing all resources associated with it. | |
void * | framebufferBegin (Framebuffer *fb, u32 *out_stride) |
Begins rendering a frame in a Framebuffer. More... | |
void | framebufferEnd (Framebuffer *fb) |
Finishes rendering a frame in a Framebuffer. More... | |
Framebuffer wrapper object, providing support for software rendered graphics.
void* framebufferBegin | ( | Framebuffer * | fb, |
u32 * | out_stride | ||
) |
Begins rendering a frame in a Framebuffer.
[in] | fb | Pointer to Framebuffer structure. |
[out] | out_stride | Output variable containing the distance in bytes between rows of pixels in memory. |
y
* out_stride
+ x
* bytes_per_pixel
. Result framebufferCreate | ( | Framebuffer * | fb, |
NWindow * | win, | ||
u32 | width, | ||
u32 | height, | ||
u32 | format, | ||
u32 | num_fbs | ||
) |
Creates a Framebuffer object.
[out] | fb | Output Framebuffer structure. |
[in] | win | Pointer to the NWindow to which the Framebuffer will be registered. |
[in] | width | Desired width of the framebuffer (usually 1280). |
[in] | height | Desired height of the framebuffer (usually 720). |
[in] | format | Desired pixel format (see PIXEL_FORMAT_* enum). |
[in] | num_fbs | Number of buffers to create. Pass 1 for single-buffering, 2 for double-buffering or 3 for triple-buffering. |
void framebufferEnd | ( | Framebuffer * | fb | ) |
Finishes rendering a frame in a Framebuffer.
[in] | fb | Pointer to Framebuffer structure. |