|
libnx
|
High-level graphics API. More...
#include "../types.h"Go to the source code of this file.
Macros | |
| #define | RGBA8(r, g, b, a) (((r)&0xff)|(((g)&0xff)<<8)|(((b)&0xff)<<16)|(((a)&0xff)<<24)) |
| Converts red, green, blue, and alpha components to packed RGBA8. | |
| #define | RGBA8_MAXALPHA(r, g, b) RGBA8(r,g,b,0xff) |
| Same as RGBA8 except with alpha=0xff. | |
Enumerations | |
| enum | GfxMode { GfxMode_TiledSingle, GfxMode_TiledDouble, GfxMode_LinearDouble } |
| GfxMode set by gfxSetMode. The default is GfxMode_LinearDouble. Note that the text-console (see console.h) sets this to GfxMode_TiledDouble. More... | |
Functions | |
| void | gfxInitDefault (void) |
| Framebuffer pixel-format is RGBA8888, there's no known way to change this. More... | |
| void | gfxExit (void) |
| Uninitializes the graphics subsystem. More... | |
| void | gfxInitResolution (u32 width, u32 height) |
| Sets the resolution to be used when initializing the graphics subsystem. More... | |
| void | gfxInitResolutionDefault (void) |
| Wrapper for gfxInitResolution with resolution=1080p. Use this if you want to support 1080p or >720p in docked-mode. | |
| void | gfxConfigureCrop (s32 left, s32 top, s32 right, s32 bottom) |
| Configure framebuffer crop, by default crop is all-zero. More... | |
| void | gfxConfigureResolution (s32 width, s32 height) |
| Wrapper for gfxConfigureCrop. Use this to set the resolution, within the bounds of the maximum resolution. Use all-zero input to reset to default. | |
| void | gfxConfigureAutoResolution (bool enable, s32 handheld_width, s32 handheld_height, s32 docked_width, s32 docked_height) |
| If enabled, gfxConfigureResolution will be used with the input resolution for the current OperationMode. Then gfxConfigureResolution will automatically be used with the specified resolution each time OperationMode changes. | |
| void | gfxConfigureAutoResolutionDefault (bool enable) |
| Wrapper for gfxConfigureAutoResolution. handheld_resolution=720p, docked_resolution={all-zero for using current maximum resolution}. | |
| void | gfxWaitForVsync (void) |
| Waits for vertical sync. | |
| void | gfxSwapBuffers (void) |
| Swaps the framebuffers (for double-buffering). | |
| u8 * | gfxGetFramebuffer (u32 *width, u32 *height) |
| Get the current framebuffer address, with optional output ptrs for the display framebuffer width/height. The display width/height is adjusted by gfxConfigureCrop and gfxConfigureResolution. | |
| void | gfxGetFramebufferResolution (u32 *width, u32 *height) |
| Get the framebuffer width/height without crop. | |
| size_t | gfxGetFramebufferSize (void) |
| Use this to get the actual byte-size of the framebuffer for use with memset/etc. | |
| void | gfxSetMode (GfxMode mode) |
| Sets the GfxMode. | |
| void | gfxSetDrawFlip (bool flip) |
| Controls whether a vertical-flip is done when determining the pixel-offset within the actual framebuffer. By default this is enabled. | |
| void | gfxConfigureTransform (u32 transform) |
| Configures transform. See the NATIVE_WINDOW_TRANSFORM_* enums in buffer_producer.h. The default is NATIVE_WINDOW_TRANSFORM_FLIP_V. | |
| void | gfxFlushBuffers (void) |
| Flushes the framebuffer in the data cache. When GfxMode is GfxMode_LinearDouble, this also transfers the linear-framebuffer to the actual framebuffer. | |
| static u32 | gfxGetFramebufferDisplayOffset (u32 x, u32 y) |
| Use this to get the pixel-offset in the framebuffer. More... | |
High-level graphics API.
This API exposes a framebuffer (technically speaking, a windowbuffer) to be used for drawing graphics.
| enum GfxMode |
GfxMode set by gfxSetMode. The default is GfxMode_LinearDouble. Note that the text-console (see console.h) sets this to GfxMode_TiledDouble.
| Enumerator | |
|---|---|
| GfxMode_TiledSingle |
Single-buffering with raw tiled (block-linear) framebuffer. |
| GfxMode_TiledDouble |
Double-buffering with raw tiled (block-linear) framebuffer. |
| GfxMode_LinearDouble |
Double-buffering with linear framebuffer, which is transferred to the actual framebuffer by gfxFlushBuffers(). |
Configure framebuffer crop, by default crop is all-zero.
Use all-zero input to reset to default. gfxExit resets this to the default. When the input is invalid this returns without changing the crop data, this includes the input values being larger than the framebuf width/height. This will update the display width/height returned by gfxGetFramebuffer, with that width/height being reset to the default when required. gfxGetFramebufferDisplayOffset uses absolute x/y, it will not adjust for non-zero crop left/top. The new crop config will not take affect with double-buffering disabled. When used during frame-drawing, this should be called before gfxGetFramebuffer. The right and bottom params are aligned to 4.
| void gfxExit | ( | void | ) |
Uninitializes the graphics subsystem.
Use this to get the pixel-offset in the framebuffer.
Returned value is in pixels, not bytes. This implements tegra blocklinear, with hard-coded constants etc. Do not use this when GfxMode is GfxMode_LinearDouble.
| void gfxInitDefault | ( | void | ) |
Framebuffer pixel-format is RGBA8888, there's no known way to change this.
Initializes the graphics subsystem.
Sets the resolution to be used when initializing the graphics subsystem.
| [in] | width | Horizontal resolution, in pixels. |
| [in] | height | Vertical resolution, in pixels. |
1.8.11