47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only */
|
|
/*
|
|
* Interface for drawing keys to a buffer.
|
|
*
|
|
* Copyright (c) 2024, Richard Acayan. All rights reserved.
|
|
*/
|
|
|
|
#ifndef UFKBD_GRAPHICS_H
|
|
#define UFKBD_GRAPHICS_H
|
|
|
|
#include <stddef.h>
|
|
#include <pixman.h>
|
|
|
|
struct fcft_font;
|
|
|
|
struct ufkbd_ctx;
|
|
struct ufkbd_key;
|
|
struct ufkbd_layout;
|
|
|
|
struct ufkbd_graphics_ctx {
|
|
struct fcft_font *font;
|
|
struct fcft_font *font_sec;
|
|
|
|
pixman_image_t *fill_bg;
|
|
pixman_image_t *fill_keycap;
|
|
pixman_image_t *key_default;
|
|
pixman_image_t *key_pressed;
|
|
|
|
pixman_image_t *target;
|
|
|
|
unsigned int scale;
|
|
|
|
size_t size;
|
|
void *buf;
|
|
};
|
|
|
|
struct ufkbd_graphics_ctx *ufkbd_graphics_init(void);
|
|
void ufkbd_graphics_uninit(struct ufkbd_graphics_ctx *graphics);
|
|
|
|
int ufkbd_graphics_set_scale(struct ufkbd_graphics_ctx *graphics, unsigned int scale);
|
|
|
|
void ufkbd_graphics_draw_key(struct ufkbd_ctx *ctx, struct ufkbd_key *key,
|
|
int x1, int y1, int x2, int y2);
|
|
void ufkbd_graphics_draw_layout(struct ufkbd_ctx *ctx, struct ufkbd_layout *layout,
|
|
size_t width, size_t height);
|
|
|
|
#endif /* UFKBD_GRAPHICS_H */
|