GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
An abstraction for display, keyboard and mouse. More...
#include <core/gp_types.h>
#include <utils/gp_timer.h>
#include <utils/gp_list.h>
#include <utils/gp_poll.h>
#include <input/gp_ev_queue.h>
#include <input/gp_task.h>
#include <backends/gp_types.h>
Go to the source code of this file.
Data Structures | |
struct | gp_backend |
A backend. More... | |
Enumerations | |
enum | gp_backend_cursors { GP_BACKEND_CURSOR_ARROW , GP_BACKEND_CURSOR_TEXT_EDIT , GP_BACKEND_CURSOR_CROSSHAIR , GP_BACKEND_CURSOR_HAND , GP_BACKEND_CURSOR_MAX , GP_BACKEND_CURSOR_SHOW = 0xc000 , GP_BACKEND_CURSOR_HIDE = 0x8000 } |
Cursor types. More... | |
Functions | |
static void | gp_backend_flip (gp_backend *self) |
Copies whole backend pixmap to a display. | |
void | gp_backend_update_rect_xyxy (gp_backend *self, gp_coord x0, gp_coord y0, gp_coord x1, gp_coord y1) |
Copies a rectangle from backend pixmap to a display. | |
static void | gp_backend_update_rect (gp_backend *self, gp_coord x0, gp_coord y0, gp_coord x1, gp_coord y1) |
Copies a rectangle from backend pixmap to a display. | |
static void | gp_backend_update_rect_xywh (gp_backend *self, gp_coord x, gp_coord y, gp_size w, gp_size h) |
Copies a rectangle from backend pixmap to a display. | |
void | gp_backend_exit (gp_backend *self) |
Exits the backend. | |
int | gp_backend_resize_ack (gp_backend *self) |
Resize acknowledge. | |
void | gp_backend_task_ins (gp_backend *self, gp_task *task) |
Inserts a task into the task queue. | |
void | gp_backend_task_rem (gp_backend *self, gp_task *task) |
Removes a task from the task queue. | |
void | gp_backend_task_queue_set (gp_backend *self, gp_task_queue *task_queue) |
Sets the backend task_queue and starts task processing. | |
An abstraction for display, keyboard and mouse.
The gp_backend is unified API for managing xserver, framebuffer, waylaynd, drm, e-ink display, etc. along with support for input devices, e.g. mouse, keyboard and keymaps.
In contrast to other graphics libraries we do not try to create unified initalization interface that would match specialities for every possible backend. Rather than that we are trying to create API that is the same for all backends, once initalization is done.
Definition in file gp_backend.h.
enum gp_backend_cursors |
Cursor types.
Definition at line 49 of file gp_backend.h.
void gp_backend_exit | ( | gp_backend * | self | ) |
Exits the backend.
This functions deinitializes the backend. E.g. closes all file descriptors, frees memory, etc. It's important to call this before the application exits since some backends, e.g. framebuffer, cannot be recovered unless we return the underlying facility to the original state.
self | A backend. |
|
inlinestatic |
Copies whole backend pixmap to a display.
Majority of the backends are double buffered, that means that changes done to gp_backend::pixmap are not propagated to the display memory buffer unless they are copied explicitly. This call copies the complete backend pixmap to the display.
self | A backend. |
Definition at line 208 of file gp_backend.h.
References gp_backend::flip.
int gp_backend_resize_ack | ( | gp_backend * | self | ) |
Resize acknowledge.
You must call this right after you application has received resize event. For a multithreaded application all threads that operate on the backend pixmap must be stopped first.
After this call returns the backend pixmap has been resized, that means that at least the width, height, and pixels of gp_backend::pixmap are different and the content of the gp_pixmap::pixels is undefined.
This call also resizes the windo/display/screen size in the gp_ev_queue.
If the function fails the best action to take is to save application data and exit as the backend may be in undefined state.
self | A backend. |
void gp_backend_task_ins | ( | gp_backend * | self, |
gp_task * | task | ||
) |
Inserts a task into the task queue.
Tasks are executed sequentionally and input processing is blocked during task execution.
self | A backend. |
task | A task to be inserted into the task queue. |
void gp_backend_task_queue_set | ( | gp_backend * | self, |
gp_task_queue * | task_queue | ||
) |
Sets the backend task_queue and starts task processing.
By default backends does not have a task queue populated. Applications that require a task queue have to allocate and initialize the queue then pass it to the backend with this function.
self | A backend. |
task_queue | A pointer to initialized task_queue. |
void gp_backend_task_rem | ( | gp_backend * | self, |
gp_task * | task | ||
) |
Removes a task from the task queue.
self | A backend. |
task | A task to be removed from the task queue. |
|
inlinestatic |
Copies a rectangle from backend pixmap to a display.
This is an alias for gp_backend_update_rect_xyxy().
self | A backend. |
x0 | First x coordinate of the rectangle. |
y0 | First y coordinate of the rectangle. |
x1 | Last x coordinate of the rectangle. |
y1 | Last y coordinate of the rectangle. |
Definition at line 243 of file gp_backend.h.
References gp_backend_update_rect_xyxy().
|
inlinestatic |
Copies a rectangle from backend pixmap to a display.
This is a version of gp_backend_update_rect_xyxy() with width and height.
self | A backend. |
x | Left x coordinate of the rectangle. |
y | Top y coordinate of the rectangle. |
w | Rectangle width. |
h | Rectangle height. |
Definition at line 261 of file gp_backend.h.
References gp_backend_update_rect_xyxy().
void gp_backend_update_rect_xyxy | ( | gp_backend * | self, |
gp_coord | x0, | ||
gp_coord | y0, | ||
gp_coord | x1, | ||
gp_coord | y1 | ||
) |
Copies a rectangle from backend pixmap to a display.
Majority of the backends are double buffered, that means that changes done to gp_backend::pixmap are not propagated to the display memory buffer unless they are copied explicitly. This call copies a rectanlge from backend pixmap to the display.
self | A backend. |
x0 | First x coordinate of the rectangle. |
y0 | First y coordinate of the rectangle. |
x1 | Last x coordinate of the rectangle. |
y1 | Last y coordinate of the rectangle. |
Referenced by gp_backend_update_rect(), and gp_backend_update_rect_xywh().