libdragon
Loading...
Searching...
No Matches
display.h
Go to the documentation of this file.
1
9#ifndef __LIBDRAGON_DISPLAY_H
10#define __LIBDRAGON_DISPLAY_H
11
12#include <stdbool.h>
13#include <stdint.h>
14
42typedef struct surface_s surface_t;
44
56typedef struct {
58 int32_t width;
60 int32_t height;
64
66#define const static const /* fool doxygen to document these static members */
68
69const resolution_t RESOLUTION_256x240 = {256, 240, false};
71const resolution_t RESOLUTION_320x240 = {320, 240, false};
73const resolution_t RESOLUTION_512x240 = {512, 240, false};
75const resolution_t RESOLUTION_640x240 = {640, 240, false};
77const resolution_t RESOLUTION_512x480 = {512, 480, true};
79const resolution_t RESOLUTION_640x480 = {640, 480, true};
80#undef const
81
90
102
134
136
141typedef filter_options_t antialias_t;
146#define ANTIALIAS_OFF FILTERS_DISABLED
151#define ANTIALIAS_RESAMPLE FILTERS_RESAMPLE
156#define ANTIALIAS_RESAMPLE_FETCH_NEEDED FILTERS_RESAMPLE_ANTIALIAS
161#define ANTIALIAS_RESAMPLE_FETCH_ALWAYS FILTERS_RESAMPLE_ANTIALIAS_DEDITHER
162
164
171
172#ifdef __cplusplus
173extern "C" {
174#endif
175
197void display_init( resolution_t res, bitdepth_t bit, uint32_t num_buffers, gamma_t gamma, filter_options_t filters );
198
204void display_close();
205
224
234
246void display_show(surface_t* surf);
247
251uint32_t display_get_width(void);
252
256uint32_t display_get_height(void);
257
261uint32_t display_get_bitdepth(void);
262
266uint32_t display_get_num_buffers(void);
267
273float display_get_fps(void);
274
275
277__attribute__((deprecated("use display_get or display_try_get instead")))
278static inline surface_t* display_lock(void) {
279 return display_try_get();
280}
283#ifdef __cplusplus
284}
285#endif
286
/* display */
288
289#endif
int32_t width
Screen width (must be between 2 and 800)
Definition display.h:58
bool interlaced
True if interlaced mode enabled.
Definition display.h:62
int32_t height
Screen height (must be between 1 and 720)
Definition display.h:60
const resolution_t RESOLUTION_256x240
256x240 mode
Definition display.h:69
void display_init(resolution_t res, bitdepth_t bit, uint32_t num_buffers, gamma_t gamma, filter_options_t filters)
Initialize the display to a particular resolution and bit depth.
Definition display.c:93
void display_close()
Close the display.
Definition display.c:261
const resolution_t RESOLUTION_640x480
640x480 mode, interlaced
Definition display.h:79
const resolution_t RESOLUTION_640x240
640x240 mode, high-res progressive
Definition display.h:75
gamma_t
Valid gamma correction settings.
Definition display.h:93
uint32_t display_get_num_buffers(void)
Get the currently configured number of buffers.
Definition display.c:413
filter_options_t
Valid display filter options.
Definition display.h:114
void display_show(surface_t *surf)
Display a buffer on the screen.
Definition display.c:342
uint32_t display_get_width(void)
Get the currently configured width of the display in pixels.
Definition display.c:398
float display_get_fps(void)
Get the current number of frames per second being rendered.
Definition display.c:418
const resolution_t RESOLUTION_512x240
512x240 mode, high-res progressive
Definition display.h:73
const resolution_t RESOLUTION_320x240
320x240 mode
Definition display.h:71
surface_t * display_try_get(void)
Try getting a display surface.
Definition display.c:297
surface_t * display_context_t
Display context (DEPRECATED: Use surface_t instead)
Definition display.h:170
bitdepth_t
Valid bit depths.
Definition display.h:84
const resolution_t RESOLUTION_512x480
512x480 mode, interlaced
Definition display.h:77
uint32_t display_get_bitdepth(void)
Get the currently configured bitdepth of the display (in bytes per pixels)
Definition display.c:408
surface_t * display_get(void)
Get a display buffer for rendering.
Definition display.c:328
uint32_t display_get_height(void)
Get the currently configured height of the display in pixels.
Definition display.c:403
@ GAMMA_CORRECT_DITHER
Corrected gamma with hardware dithered output.
Definition display.h:100
@ GAMMA_CORRECT
Corrected gamma, should be used on a 32-bit framebuffer only when assets have been produced in linear...
Definition display.h:98
@ GAMMA_NONE
Uncorrected gamma, should be used by default and with assets built by libdragon tools.
Definition display.h:95
@ FILTERS_RESAMPLE_ANTIALIAS_DEDITHER
Resize the output image with a bilinear filter (see FILTERS_RESAMPLE). Add a video interface anti-ali...
Definition display.h:132
@ FILTERS_RESAMPLE_ANTIALIAS
Resize the output image with a bilinear filter (see FILTERS_RESAMPLE). Add a video interface anti-ali...
Definition display.h:128
@ FILTERS_DEDITHER
Reconstruct a 32-bit output from dithered 16-bit framebuffer.
Definition display.h:123
@ FILTERS_RESAMPLE
Resize the output image with a bilinear filter. In general, VI is in charge of resizing the framebuff...
Definition display.h:121
@ FILTERS_DISABLED
All display filters are disabled.
Definition display.h:116
@ DEPTH_32_BPP
32 bits per pixel (8-8-8-8)
Definition display.h:88
@ DEPTH_16_BPP
16 bits per pixel (5-5-5-1)
Definition display.h:86
Video resolution structure.
Definition display.h:56
A surface buffer for graphics.
Definition surface.h:140