#ifndef DRW_H #define DRW_H #include #include "wayland.h" /* type definitions */ typedef struct { uint32_t *data; unsigned width; unsigned height; unsigned size; struct wl_buffer *buffer; } Canvas; typedef struct { uint8_t r; uint8_t g; uint8_t b; uint8_t a; } Color; /* exported functions */ Canvas* create_drw(struct wl_shm *shm, unsigned width, unsigned height); void free_drw(Canvas *canvas); void draw_rect(Canvas *canvas, unsigned x, unsigned y, unsigned width, unsigned height, uint32_t color); void draw_point(Canvas *canvas, unsigned x, unsigned y, uint32_t color); static Color to_color(uint32_t color) { return *(Color*)(&color); } static uint32_t to_uint32_t(Color color) { return *(uint32_t*)(&color); } #endif