mutter/clutter/clutter-cairo.c
Emmanuele Bassi 77ec8774a0 WARNING: Massive revert commit
Revert all the work that happened on the master branch.

Sadly, this is the only way to merge the current development branch back
into master.

It is now abundantly clear that I merged the 1.99 branch far too soon,
and that Clutter 2.0 won't happen any time soon, if at all.

Since having the development happen on a separate branch throws a lot of
people into confusion, let's undo the clutter-1.99 → master merge, and
move back the development of Clutter to the master branch.

In order to do so, we need to do some surgery to the Git repository.

First, we do a massive revert in a single commit of all that happened
since the switch to 1.99 and the API version bump done with the
89a2862b05 commit. The history is too long
to be reverted commit by commit without being extremely messy.
2015-01-03 20:34:20 +00:00

93 lines
2.4 KiB
C

/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2012 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-cairo
* @Title: Cairo integration
* @Short_Description: Functions for interoperating with Cairo
*
* Clutter provides some utility functions for using Cairo.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "clutter-cairo.h"
#include "clutter-color.h"
/**
* clutter_cairo_set_source_color:
* @cr: a Cairo context
* @color: a #ClutterColor
*
* Utility function for setting the source color of @cr using
* a #ClutterColor. This function is the equivalent of:
*
* |[
* cairo_set_source_rgba (cr,
* color->red / 255.0,
* color->green / 255.0,
* color->blue / 255.0,
* color->alpha / 255.0);
* ]|
*
* Since: 1.0
*/
void
clutter_cairo_set_source_color (cairo_t *cr,
const ClutterColor *color)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (color != NULL);
if (color->alpha == 0xff)
cairo_set_source_rgb (cr,
color->red / 255.0,
color->green / 255.0,
color->blue / 255.0);
else
cairo_set_source_rgba (cr,
color->red / 255.0,
color->green / 255.0,
color->blue / 255.0,
color->alpha / 255.0);
}
/**
* clutter_cairo_clear:
* @cr: a Cairo context
*
* Utility function to clear a Cairo context.
*
* Since: 1.12
*/
void
clutter_cairo_clear (cairo_t *cr)
{
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_restore (cr);
}