4 * An OpenGL based 'interactive canvas' library.
6 * Copyright (C) 2012 Intel Corporation
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23 * SECTION:clutter-cairo
24 * @Title: Cairo integration
25 * @Short_Description: Functions for interoperating with Cairo
27 * Clutter provides some utility functions for using Cairo.
34 #include "clutter-cairo.h"
35 #include "clutter-color.h"
38 * clutter_cairo_set_source_color:
39 * @cr: a Cairo context
40 * @color: a #ClutterColor
42 * Utility function for setting the source color of @cr using
43 * a #ClutterColor. This function is the equivalent of:
46 * cairo_set_source_rgba (cr,
48 * color->green / 255.0,
49 * color->blue / 255.0,
50 * color->alpha / 255.0);
56 clutter_cairo_set_source_color (cairo_t *cr,
57 const ClutterColor *color)
59 g_return_if_fail (cr != NULL);
60 g_return_if_fail (color != NULL);
62 if (color->alpha == 0xff)
63 cairo_set_source_rgb (cr,
68 cairo_set_source_rgba (cr,
72 color->alpha / 255.0);
76 * clutter_cairo_clear:
77 * @cr: a Cairo context
79 * Utility function to clear a Cairo context.
84 clutter_cairo_clear (cairo_t *cr)
88 cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);