libgimpwidgets/color: move the cairo color utility functions to libgimpcolor
Add CAIRO_CFLAGS to a lot of Makefiles to make this possible, and because they pull in cairo via the libgimp headers.
This commit is contained in:
@ -41,44 +41,6 @@
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* gimp_cairo_set_source_rgb:
|
||||
* @cr: Cairo context
|
||||
* @color: GimpRGB color
|
||||
*
|
||||
* Sets the source pattern within @cr to the solid opaque color
|
||||
* described by @color.
|
||||
*
|
||||
* This function calls cairo_set_source_rgb() for you.
|
||||
*
|
||||
* Since: GIMP 2.6
|
||||
**/
|
||||
void
|
||||
gimp_cairo_set_source_rgb (cairo_t *cr,
|
||||
const GimpRGB *color)
|
||||
{
|
||||
cairo_set_source_rgb (cr, color->r, color->g, color->b);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_cairo_set_source_rgba:
|
||||
* @cr: Cairo context
|
||||
* @color: GimpRGB color
|
||||
*
|
||||
* Sets the source pattern within @cr to the solid translucent color
|
||||
* described by @color.
|
||||
*
|
||||
* This function calls cairo_set_source_rgba() for you.
|
||||
*
|
||||
* Since: GIMP 2.6
|
||||
**/
|
||||
void
|
||||
gimp_cairo_set_source_rgba (cairo_t *cr,
|
||||
const GimpRGB *color)
|
||||
{
|
||||
cairo_set_source_rgba (cr, color->r, color->g, color->b, color->a);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_cairo_set_focus_line_pattern:
|
||||
* @cr: Cairo context
|
||||
@ -133,67 +95,6 @@ gimp_cairo_set_focus_line_pattern (cairo_t *cr,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_cairo_checkerboard_create:
|
||||
* @cr: Cairo context
|
||||
* @size: check size
|
||||
* @light: light check color or %NULL to use the default light gray
|
||||
* @dark: dark check color or %NULL to use the default dark gray
|
||||
*
|
||||
* Create a repeating checkerboard pattern.
|
||||
*
|
||||
* Return value: a new Cairo pattern that can be used as a source on @cr.
|
||||
*
|
||||
* Since: GIMP 2.6
|
||||
**/
|
||||
cairo_pattern_t *
|
||||
gimp_cairo_checkerboard_create (cairo_t *cr,
|
||||
gint size,
|
||||
const GimpRGB *light,
|
||||
const GimpRGB *dark)
|
||||
{
|
||||
cairo_t *context;
|
||||
cairo_surface_t *surface;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
g_return_val_if_fail (cr != NULL, NULL);
|
||||
g_return_val_if_fail (size > 0, NULL);
|
||||
|
||||
surface = cairo_surface_create_similar (cairo_get_target (cr),
|
||||
CAIRO_CONTENT_COLOR,
|
||||
2 * size, 2 * size);
|
||||
context = cairo_create (surface);
|
||||
|
||||
if (light)
|
||||
gimp_cairo_set_source_rgb (context, light);
|
||||
else
|
||||
cairo_set_source_rgb (context,
|
||||
GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT, GIMP_CHECK_LIGHT);
|
||||
|
||||
cairo_rectangle (context, 0, 0, size, size);
|
||||
cairo_rectangle (context, size, size, size, size);
|
||||
cairo_fill (context);
|
||||
|
||||
if (dark)
|
||||
gimp_cairo_set_source_rgb (context, dark);
|
||||
else
|
||||
cairo_set_source_rgb (context,
|
||||
GIMP_CHECK_DARK, GIMP_CHECK_DARK, GIMP_CHECK_DARK);
|
||||
|
||||
cairo_rectangle (context, 0, size, size, size);
|
||||
cairo_rectangle (context, size, 0, size, size);
|
||||
cairo_fill (context);
|
||||
|
||||
cairo_destroy (context);
|
||||
|
||||
pattern = cairo_pattern_create_for_surface (surface);
|
||||
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_cairo_surface_create_from_pixbuf:
|
||||
* @pixbuf: a #GdkPixbuf
|
||||
|
Reference in New Issue
Block a user