Refactor cairo drawing of rectangles into utility functions.

This commit is contained in:
Ingo Bürk
2015-10-08 12:31:56 +02:00
parent ff0aeddede
commit d300a07660
3 changed files with 101 additions and 62 deletions

View File

@ -72,3 +72,20 @@ void cairo_set_source_color(surface_t *surface, color_t color);
*
*/
void cairo_draw_text(i3String *text, surface_t *surface, color_t fg_color, color_t bg_color, int x, int y, int max_width);
/**
* Draws a filled rectangle.
* This function is a convenience wrapper and takes care of flushing the
* surface as well as restoring the cairo state.
* Note that the drawing is done using CAIRO_OPERATOR_SOURCE.
*
*/
void cairo_draw_rectangle(surface_t *surface, color_t color, double x, double y, double w, double h);
/**
* Copies a surface onto another surface.
* Note that the drawing is done using CAIRO_OPERATOR_SOURCE.
*
*/
void cairo_copy_surface(surface_t *src, surface_t *dest, double src_x, double src_y,
double dest_x, double dest_y, double dest_w, double dest_h);