2020-09-11 01:25:28 -07:00
|
|
|
#ifndef __DRW_H
|
|
|
|
#define __DRW_H
|
|
|
|
|
2021-08-24 18:52:05 +02:00
|
|
|
#include <pango/pangocairo.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2021-08-25 22:08:28 +02:00
|
|
|
struct drw {
|
|
|
|
struct wl_shm *shm;
|
|
|
|
};
|
|
|
|
struct drwsurf {
|
2023-09-07 21:31:47 +02:00
|
|
|
uint32_t width, height, size;
|
|
|
|
double scale;
|
2021-08-25 22:08:28 +02:00
|
|
|
|
|
|
|
struct drw *ctx;
|
|
|
|
struct wl_surface *surf;
|
|
|
|
struct wl_buffer *buf;
|
|
|
|
struct wl_shm *shm;
|
|
|
|
unsigned char *pool_data;
|
|
|
|
|
|
|
|
cairo_t *cairo;
|
|
|
|
PangoLayout *layout;
|
|
|
|
};
|
2021-08-24 18:52:05 +02:00
|
|
|
struct kbd;
|
2020-09-11 01:25:28 -07:00
|
|
|
|
2023-09-07 21:31:47 +02:00
|
|
|
void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h, double s);
|
2020-09-11 01:25:28 -07:00
|
|
|
void drwsurf_flip(struct drwsurf *ds);
|
|
|
|
|
2021-08-24 18:52:05 +02:00
|
|
|
typedef union {
|
|
|
|
uint8_t bgra[4];
|
|
|
|
uint32_t color;
|
|
|
|
} Color;
|
|
|
|
|
2023-09-06 09:28:09 +02:00
|
|
|
void drw_do_clear(struct drwsurf *d, uint32_t x, uint32_t y,
|
|
|
|
uint32_t w, uint32_t h);
|
2021-12-03 11:57:19 -05:00
|
|
|
void drw_do_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
2024-04-14 05:10:29 +03:00
|
|
|
uint32_t w, uint32_t h, bool fill, int rounding);
|
2021-09-19 14:23:51 +02:00
|
|
|
void drw_fill_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
2024-04-14 05:10:29 +03:00
|
|
|
uint32_t w, uint32_t h, int rounding);
|
2021-12-03 11:57:19 -05:00
|
|
|
void drw_over_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
2024-04-14 05:10:29 +03:00
|
|
|
uint32_t w, uint32_t h, int rounding);
|
2021-09-19 14:23:51 +02:00
|
|
|
|
|
|
|
void drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
2023-10-23 13:59:31 +02:00
|
|
|
uint32_t w, uint32_t h, uint32_t b, const char *label,
|
|
|
|
PangoFontDescription *font_description);
|
2021-09-19 14:23:51 +02:00
|
|
|
|
|
|
|
uint32_t setup_buffer(struct drwsurf *drwsurf);
|
2021-08-24 18:52:05 +02:00
|
|
|
|
2020-09-11 01:25:28 -07:00
|
|
|
#endif
|