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
29
30
31
32
33
34
|
#include <stdbool.h>
#include <math.h>
#include <cairo.h>
#include "x11.h"
void draw(Window *win)
{
double scale = window_get_scale(win);
int w = 1000, h = 1000;
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
round(w * scale),
round(h * scale));
cairo_t *cr = cairo_create(surface);
cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
cairo_rectangle(cr, 0, 0, 10000, 10000);
cairo_fill(cr);
cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, 50.0);
cairo_set_source_rgb(cr, 0, 0, 0);
cairo_move_to(cr, 50, 50);
cairo_show_text(cr, "Hello, world");
cairo_destroy(cr);
window_paint_surface(win, surface, w, h);
cairo_surface_destroy(surface);
}
// vim: set ts=4 sw=4 et
|