2 * vim:ts=4:sw=4:expandtab
4 * © 2015 Ingo Bürk and contributors (see also: LICENSE)
6 * cairo_util.h: Utility for operations using cairo.
11 #include <cairo/cairo-xcb.h>
13 /* Represents a color split by color channel. */
14 typedef struct color_t {
19 /* For compatibility, we also store the colorpixel for now. */
23 /* A wrapper grouping an XCB drawable and both a graphics context
24 * and the corresponding cairo objects representing it. */
25 typedef struct surface_t {
26 /* The drawable which is being represented. */
29 // TODO remove this once i3 uses solely cairo for drawing operations
30 /* A classic XCB graphics context. This should not be used for
31 * drawing operations. */
34 /* A cairo surface representing the drawable. */
35 cairo_surface_t *surface;
37 /* The cairo object representing the drawale. In general,
38 * this is what one should use for any drawing operation. */
43 * Initialize the cairo surface to represent the given drawable.
46 void cairo_surface_init(surface_t *surface, xcb_drawable_t drawable, int width, int height);
49 * Destroys the surface.
52 void cairo_surface_free(surface_t *surface);
55 * Parses the given color in hex format to an internal color representation.
56 * Note that the input must begin with a hash sign, e.g., "#3fbc59".
59 color_t cairo_hex_to_color(const char *color);
62 * Set the given color as the source color on the surface.
65 void cairo_set_source_color(surface_t *surface, color_t color);