aboutsummaryrefslogtreecommitdiff
path: root/draw.h
blob: 945c0f79c98ea7de2792b94a6fec24c018a72f77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * draw.h - software rendering onto an ARGB8888 mb_buffer.
 *
 * Colours are straight-alpha 0xAARRGGBB; they are premultiplied on the way in
 * and overwrite the destination (the compositor blends the finished overlay
 * over the desktop). All primitives clip to the buffer.
 */
#ifndef MOUSEBOARD_DRAW_H
#define MOUSEBOARD_DRAW_H

#include "platform.h"

void draw_fill(struct mb_buffer *b, int x, int y, int w, int h, uint32_t argb);
void draw_rect(struct mb_buffer *b, int x, int y, int w, int h, int thick,
	       uint32_t argb);
void draw_hline(struct mb_buffer *b, int x, int y, int len, int thick,
		uint32_t argb);
void draw_vline(struct mb_buffer *b, int x, int y, int len, int thick,
		uint32_t argb);

/* Render text at scale (integer multiple of the 8x8 cell). Returns the pixel
 * width drawn. */
int draw_text(struct mb_buffer *b, int x, int y, const char *s, int scale,
	      uint32_t fg);
int text_width(const char *s, int scale);
int text_height(int scale);

#endif /* MOUSEBOARD_DRAW_H */