mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 22:48:07 +02:00
pattern: Add observer hooks
In order for custom context to automatically track when a pattern is modify after being set on the context (and before it is used in an operator), we need for there to be a callback when the pattern is modified. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
83bfd85a13
commit
2458120dee
22 changed files with 402 additions and 283 deletions
|
|
@ -85,6 +85,7 @@ cairo_private = \
|
|||
cairo-paginated-surface-private.h \
|
||||
cairo-path-fixed-private.h \
|
||||
cairo-path-private.h \
|
||||
cairo-pattern-private.h \
|
||||
cairo-private.h \
|
||||
cairo-recording-surface-private.h \
|
||||
cairo-reference-count-private.h \
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "cairo-freed-pool-private.h"
|
||||
#include "cairo-gstate-private.h"
|
||||
#include "cairo-path-fixed-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
/* A collection of routines to facilitate writing compositors. */
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
|
||||
|
||||
/**
|
||||
* cairo_debug_reset_static_data:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "cairo-error-private.h"
|
||||
#include "cairo-freed-pool-private.h"
|
||||
#include "cairo-path-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
#define CAIRO_TOLERANCE_MINIMUM _cairo_fixed_to_double(1)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-ft-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-gstate-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
#if _XOPEN_SOURCE >= 600 || defined (_ISOC99_SOURCE)
|
||||
#define ISFINITE(x) isfinite (x)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
#include "cairo-surface-snapshot-private.h"
|
||||
#include "cairo-surface-subsurface-private.h"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
/*
|
||||
* Rasterizer for mesh patterns.
|
||||
*
|
||||
|
|
|
|||
362
src/cairo-pattern-private.h
Normal file
362
src/cairo-pattern-private.h
Normal file
|
|
@ -0,0 +1,362 @@
|
|||
/* cairo - a vector graphics library with display and print output
|
||||
*
|
||||
* Copyright © 2005 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation
|
||||
* (the "LGPL") or, at your option, under the terms of the Mozilla
|
||||
* Public License Version 1.1 (the "MPL"). If you do not alter this
|
||||
* notice, a recipient may use your version of this file under either
|
||||
* the MPL or the LGPL.
|
||||
*
|
||||
* You should have received a copy of the LGPL along with this library
|
||||
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* You should have received a copy of the MPL along with this library
|
||||
* in the file COPYING-MPL-1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
|
||||
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
|
||||
* the specific language governing rights and limitations.
|
||||
*
|
||||
* The Original Code is the cairo graphics library.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Red Hat, Inc.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Carl D. Worth <cworth@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_PATTERN_PRIVATE_H
|
||||
#define CAIRO_PATTERN_PRIVATE_H
|
||||
|
||||
#include "cairo-types-private.h"
|
||||
#include "cairo-list-private.h"
|
||||
|
||||
CAIRO_BEGIN_DECLS
|
||||
|
||||
typedef struct _cairo_pattern_observer cairo_pattern_observer_t;
|
||||
|
||||
enum {
|
||||
CAIRO_PATTERN_NOTIFY_MATRIX = 0x1,
|
||||
CAIRO_PATTERN_NOTIFY_FILTER = 0x2,
|
||||
CAIRO_PATTERN_NOTIFY_EXTEND = 0x4,
|
||||
CAIRO_PATTERN_NOTIFY_OPACITY = 0x9,
|
||||
};
|
||||
|
||||
struct _cairo_pattern_observer {
|
||||
void (*notify) (cairo_pattern_observer_t *,
|
||||
cairo_pattern_t *pattern,
|
||||
unsigned int flags);
|
||||
cairo_list_t link;
|
||||
};
|
||||
|
||||
struct _cairo_pattern {
|
||||
cairo_pattern_type_t type;
|
||||
cairo_reference_count_t ref_count;
|
||||
cairo_status_t status;
|
||||
cairo_user_data_array_t user_data;
|
||||
|
||||
cairo_matrix_t matrix;
|
||||
cairo_filter_t filter;
|
||||
cairo_extend_t extend;
|
||||
double opacity;
|
||||
|
||||
cairo_bool_t has_component_alpha;
|
||||
|
||||
cairo_list_t observers;
|
||||
};
|
||||
|
||||
struct _cairo_solid_pattern {
|
||||
cairo_pattern_t base;
|
||||
cairo_color_t color;
|
||||
};
|
||||
|
||||
typedef struct _cairo_surface_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_surface_t *surface;
|
||||
} cairo_surface_pattern_t;
|
||||
|
||||
typedef struct _cairo_gradient_stop {
|
||||
double offset;
|
||||
cairo_color_stop_t color;
|
||||
} cairo_gradient_stop_t;
|
||||
|
||||
typedef struct _cairo_gradient_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
unsigned int n_stops;
|
||||
unsigned int stops_size;
|
||||
cairo_gradient_stop_t *stops;
|
||||
cairo_gradient_stop_t stops_embedded[2];
|
||||
} cairo_gradient_pattern_t;
|
||||
|
||||
typedef struct _cairo_linear_pattern {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_point_double_t pd1;
|
||||
cairo_point_double_t pd2;
|
||||
} cairo_linear_pattern_t;
|
||||
|
||||
typedef struct _cairo_radial_pattern {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_circle_double_t cd1;
|
||||
cairo_circle_double_t cd2;
|
||||
} cairo_radial_pattern_t;
|
||||
|
||||
typedef union {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_linear_pattern_t linear;
|
||||
cairo_radial_pattern_t radial;
|
||||
} cairo_gradient_pattern_union_t;
|
||||
|
||||
/*
|
||||
* A mesh patch is a tensor-product patch (bicubic Bezier surface
|
||||
* patch). It has 16 control points. Each set of 4 points along the
|
||||
* sides of the 4x4 grid of control points is a Bezier curve that
|
||||
* defines one side of the patch. A color is assigned to each
|
||||
* corner. The inner 4 points provide additional control over the
|
||||
* shape and the color mapping.
|
||||
*
|
||||
* Cairo uses the same convention as the PDF Reference for numbering
|
||||
* the points and side of the patch.
|
||||
*
|
||||
*
|
||||
* Side 1
|
||||
*
|
||||
* p[0][3] p[1][3] p[2][3] p[3][3]
|
||||
* Side 0 p[0][2] p[1][2] p[2][2] p[3][2] Side 2
|
||||
* p[0][1] p[1][1] p[2][1] p[3][1]
|
||||
* p[0][0] p[1][0] p[2][0] p[3][0]
|
||||
*
|
||||
* Side 3
|
||||
*
|
||||
*
|
||||
* Point Color
|
||||
* -------------------------
|
||||
* points[0][0] colors[0]
|
||||
* points[0][3] colors[1]
|
||||
* points[3][3] colors[2]
|
||||
* points[3][0] colors[3]
|
||||
*/
|
||||
|
||||
typedef struct _cairo_mesh_patch {
|
||||
cairo_point_double_t points[4][4];
|
||||
cairo_color_t colors[4];
|
||||
} cairo_mesh_patch_t;
|
||||
|
||||
typedef struct _cairo_mesh_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_array_t patches;
|
||||
cairo_mesh_patch_t *current_patch;
|
||||
int current_side;
|
||||
cairo_bool_t has_control_point[4];
|
||||
cairo_bool_t has_color[4];
|
||||
} cairo_mesh_pattern_t;
|
||||
|
||||
typedef union {
|
||||
cairo_pattern_type_t type;
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_solid_pattern_t solid;
|
||||
cairo_surface_pattern_t surface;
|
||||
cairo_gradient_pattern_union_t gradient;
|
||||
cairo_mesh_pattern_t mesh;
|
||||
} cairo_pattern_union_t;
|
||||
|
||||
|
||||
/* cairo-pattern.c */
|
||||
|
||||
cairo_private cairo_pattern_t *
|
||||
_cairo_pattern_create_in_error (cairo_status_t status);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_create_copy (cairo_pattern_t **pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_init_copy (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_static_copy (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_init_snapshot (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
|
||||
const cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
|
||||
cairo_surface_t *surface);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_fini (cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_fini_snapshot (cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_pattern_t *
|
||||
_cairo_pattern_create_solid (const cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_transform (cairo_pattern_t *pattern,
|
||||
const cairo_matrix_t *ctm_inverse);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_opaque_solid (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_opaque (const cairo_pattern_t *pattern,
|
||||
const cairo_rectangle_int_t *extents);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_clear (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_gradient_pattern_is_solid (const cairo_gradient_pattern_t *gradient,
|
||||
const cairo_rectangle_int_t *extents,
|
||||
cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_fit_to_range (const cairo_gradient_pattern_t *gradient,
|
||||
double max_value,
|
||||
cairo_matrix_t *out_matrix,
|
||||
cairo_circle_double_t out_circle[2]);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_radial_pattern_focus_is_inside (const cairo_radial_pattern_t *radial);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_box_to_parameter (const cairo_gradient_pattern_t *gradient,
|
||||
double x0, double y0,
|
||||
double x1, double y1,
|
||||
double tolerance,
|
||||
double out_range[2]);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_interpolate (const cairo_gradient_pattern_t *gradient,
|
||||
double t,
|
||||
cairo_circle_double_t *out_circle);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_alpha_range (const cairo_pattern_t *pattern,
|
||||
double *out_min,
|
||||
double *out_max);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_mesh_pattern_coord_box (const cairo_mesh_pattern_t *mesh,
|
||||
double *out_xmin,
|
||||
double *out_ymin,
|
||||
double *out_xmax,
|
||||
double *out_ymax);
|
||||
|
||||
enum {
|
||||
CAIRO_PATTERN_ACQUIRE_NONE = 0x0,
|
||||
CAIRO_PATTERN_ACQUIRE_NO_REFLECT = 0x1,
|
||||
};
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int flags,
|
||||
cairo_surface_t **surface_out,
|
||||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_release_surface (const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
|
||||
const cairo_pattern_t *mask,
|
||||
cairo_surface_t *dst,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int mask_x,
|
||||
int mask_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int flags,
|
||||
cairo_surface_t **src_out,
|
||||
cairo_surface_t **mask_out,
|
||||
cairo_surface_attributes_t *src_attributes,
|
||||
cairo_surface_attributes_t *mask_attributes);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_get_extents (const cairo_pattern_t *pattern,
|
||||
cairo_rectangle_int_t *extents);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_pattern_hash (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_linear_pattern_hash (unsigned long hash,
|
||||
const cairo_linear_pattern_t *linear);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_radial_pattern_hash (unsigned long hash,
|
||||
const cairo_radial_pattern_t *radial);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_linear_pattern_equal (const cairo_linear_pattern_t *a,
|
||||
const cairo_linear_pattern_t *b);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_pattern_size (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_radial_pattern_equal (const cairo_radial_pattern_t *a,
|
||||
const cairo_radial_pattern_t *b);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_equal (const cairo_pattern_t *a,
|
||||
const cairo_pattern_t *b);
|
||||
|
||||
static inline void
|
||||
_cairo_pattern_add_observer (cairo_pattern_t *pattern,
|
||||
cairo_pattern_observer_t *observer,
|
||||
void (*func) (cairo_pattern_observer_t *,
|
||||
cairo_pattern_t *,
|
||||
unsigned int))
|
||||
{
|
||||
observer->notify = func;
|
||||
cairo_list_add (&observer->link, &pattern->observers);
|
||||
}
|
||||
|
||||
/* cairo-mesh-pattern-rasterizer.c */
|
||||
|
||||
cairo_private void
|
||||
_cairo_mesh_pattern_rasterize (const cairo_mesh_pattern_t *mesh,
|
||||
void *data,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
double x_offset,
|
||||
double y_offset);
|
||||
|
||||
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
||||
#endif /* CAIRO_PATTERN_PRIVATE */
|
||||
|
||||
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
#include "cairo-error-private.h"
|
||||
#include "cairo-freed-pool-private.h"
|
||||
#include "cairo-path-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
|
@ -111,6 +112,16 @@ const cairo_solid_pattern_t _cairo_pattern_white = {
|
|||
{ 1., 1., 1., 1., 0xffff, 0xffff, 0xffff, 0xffff },/* color (double rgba, short rgba) */
|
||||
};
|
||||
|
||||
static void
|
||||
_cairo_pattern_notify_observers (cairo_pattern_t *pattern,
|
||||
unsigned int flags)
|
||||
{
|
||||
cairo_pattern_observer_t *pos;
|
||||
|
||||
cairo_list_foreach_entry (pos, cairo_pattern_observer_t, &pattern->observers, link)
|
||||
pos->notify (pos, pattern, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* _cairo_pattern_set_error:
|
||||
* @pattern: a pattern
|
||||
|
|
@ -180,10 +191,13 @@ _cairo_pattern_init (cairo_pattern_t *pattern, cairo_pattern_type_t type)
|
|||
pattern->extend = CAIRO_EXTEND_GRADIENT_DEFAULT;
|
||||
|
||||
pattern->filter = CAIRO_FILTER_DEFAULT;
|
||||
pattern->opacity = 1.0;
|
||||
|
||||
pattern->has_component_alpha = FALSE;
|
||||
|
||||
cairo_matrix_init_identity (&pattern->matrix);
|
||||
|
||||
cairo_list_init (&pattern->observers);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -1916,6 +1930,7 @@ cairo_pattern_set_matrix (cairo_pattern_t *pattern,
|
|||
return;
|
||||
|
||||
pattern->matrix = *matrix;
|
||||
_cairo_pattern_notify_observers (pattern, CAIRO_PATTERN_NOTIFY_MATRIX);
|
||||
|
||||
inverse = *matrix;
|
||||
status = cairo_matrix_invert (&inverse);
|
||||
|
|
@ -1964,6 +1979,7 @@ cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
|
|||
return;
|
||||
|
||||
pattern->filter = filter;
|
||||
_cairo_pattern_notify_observers (pattern, CAIRO_PATTERN_NOTIFY_FILTER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2001,6 +2017,7 @@ cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend)
|
|||
return;
|
||||
|
||||
pattern->extend = extend;
|
||||
_cairo_pattern_notify_observers (pattern, CAIRO_PATTERN_NOTIFY_EXTEND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "cairo-compiler-private.h"
|
||||
#include "cairo-types-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
|
||||
typedef struct _cairo_pdf_shading {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-path-fixed-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-clip-private.h"
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
|
||||
#if _XOPEN_SOURCE >= 600 || defined (_ISOC99_SOURCE)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-spans-private.h"
|
||||
#include "cairo-surface-fallback-private.h"
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-surface-offset-private.h"
|
||||
|
||||
/* A collection of routines to facilitate drawing to an alternate surface. */
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-surface-wrapper-private.h"
|
||||
|
||||
/* A collection of routines to facilitate surface wrapping */
|
||||
|
|
|
|||
|
|
@ -393,120 +393,6 @@ struct _cairo_mime_data {
|
|||
void *closure;
|
||||
};
|
||||
|
||||
struct _cairo_pattern {
|
||||
cairo_pattern_type_t type;
|
||||
cairo_reference_count_t ref_count;
|
||||
cairo_status_t status;
|
||||
cairo_user_data_array_t user_data;
|
||||
|
||||
cairo_matrix_t matrix;
|
||||
cairo_filter_t filter;
|
||||
cairo_extend_t extend;
|
||||
|
||||
cairo_bool_t has_component_alpha;
|
||||
};
|
||||
|
||||
struct _cairo_solid_pattern {
|
||||
cairo_pattern_t base;
|
||||
cairo_color_t color;
|
||||
};
|
||||
|
||||
typedef struct _cairo_surface_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_surface_t *surface;
|
||||
} cairo_surface_pattern_t;
|
||||
|
||||
typedef struct _cairo_gradient_stop {
|
||||
double offset;
|
||||
cairo_color_stop_t color;
|
||||
} cairo_gradient_stop_t;
|
||||
|
||||
typedef struct _cairo_gradient_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
unsigned int n_stops;
|
||||
unsigned int stops_size;
|
||||
cairo_gradient_stop_t *stops;
|
||||
cairo_gradient_stop_t stops_embedded[2];
|
||||
} cairo_gradient_pattern_t;
|
||||
|
||||
typedef struct _cairo_linear_pattern {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_point_double_t pd1;
|
||||
cairo_point_double_t pd2;
|
||||
} cairo_linear_pattern_t;
|
||||
|
||||
typedef struct _cairo_radial_pattern {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_circle_double_t cd1;
|
||||
cairo_circle_double_t cd2;
|
||||
} cairo_radial_pattern_t;
|
||||
|
||||
typedef union {
|
||||
cairo_gradient_pattern_t base;
|
||||
|
||||
cairo_linear_pattern_t linear;
|
||||
cairo_radial_pattern_t radial;
|
||||
} cairo_gradient_pattern_union_t;
|
||||
|
||||
/*
|
||||
* A mesh patch is a tensor-product patch (bicubic Bezier surface
|
||||
* patch). It has 16 control points. Each set of 4 points along the
|
||||
* sides of the 4x4 grid of control points is a Bezier curve that
|
||||
* defines one side of the patch. A color is assigned to each
|
||||
* corner. The inner 4 points provide additional control over the
|
||||
* shape and the color mapping.
|
||||
*
|
||||
* Cairo uses the same convention as the PDF Reference for numbering
|
||||
* the points and side of the patch.
|
||||
*
|
||||
*
|
||||
* Side 1
|
||||
*
|
||||
* p[0][3] p[1][3] p[2][3] p[3][3]
|
||||
* Side 0 p[0][2] p[1][2] p[2][2] p[3][2] Side 2
|
||||
* p[0][1] p[1][1] p[2][1] p[3][1]
|
||||
* p[0][0] p[1][0] p[2][0] p[3][0]
|
||||
*
|
||||
* Side 3
|
||||
*
|
||||
*
|
||||
* Point Color
|
||||
* -------------------------
|
||||
* points[0][0] colors[0]
|
||||
* points[0][3] colors[1]
|
||||
* points[3][3] colors[2]
|
||||
* points[3][0] colors[3]
|
||||
*/
|
||||
|
||||
typedef struct _cairo_mesh_patch {
|
||||
cairo_point_double_t points[4][4];
|
||||
cairo_color_t colors[4];
|
||||
} cairo_mesh_patch_t;
|
||||
|
||||
typedef struct _cairo_mesh_pattern {
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_array_t patches;
|
||||
cairo_mesh_patch_t *current_patch;
|
||||
int current_side;
|
||||
cairo_bool_t has_control_point[4];
|
||||
cairo_bool_t has_color[4];
|
||||
} cairo_mesh_pattern_t;
|
||||
|
||||
typedef union {
|
||||
cairo_pattern_type_t type;
|
||||
cairo_pattern_t base;
|
||||
|
||||
cairo_solid_pattern_t solid;
|
||||
cairo_surface_pattern_t surface;
|
||||
cairo_gradient_pattern_union_t gradient;
|
||||
cairo_mesh_pattern_t mesh;
|
||||
} cairo_pattern_union_t;
|
||||
|
||||
/*
|
||||
* A #cairo_unscaled_font_t is just an opaque handle we use in the
|
||||
* glyph cache.
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "cairo-freelist-private.h"
|
||||
#include "cairo-list-private.h"
|
||||
#include "cairo-mutex-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-reference-count-private.h"
|
||||
#include "cairo-spans-private.h"
|
||||
#include "cairo-surface-private.h"
|
||||
|
|
|
|||
|
|
@ -54,10 +54,11 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
#include "cairo-surface-snapshot-private.h"
|
||||
#include "cairo-surface-subsurface-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
|
||||
#include <X11/Xutil.h> /* for XDestroyImage */
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-backend-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-path-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-surface-private.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
|
|
|||
171
src/cairoint.h
171
src/cairoint.h
|
|
@ -2174,162 +2174,6 @@ _cairo_trapezoid_array_translate_and_scale (cairo_trapezoid_t *offset_traps,
|
|||
double tx, double ty,
|
||||
double sx, double sy);
|
||||
|
||||
/* cairo-pattern.c */
|
||||
|
||||
cairo_private cairo_pattern_t *
|
||||
_cairo_pattern_create_in_error (cairo_status_t status);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_create_copy (cairo_pattern_t **pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_init_copy (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_static_copy (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_pattern_init_snapshot (cairo_pattern_t *pattern,
|
||||
const cairo_pattern_t *other);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_solid (cairo_solid_pattern_t *pattern,
|
||||
const cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
|
||||
cairo_surface_t *surface);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_fini (cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_pattern_t *
|
||||
_cairo_pattern_create_solid (const cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_transform (cairo_pattern_t *pattern,
|
||||
const cairo_matrix_t *ctm_inverse);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_mesh_pattern_coord_box (const cairo_mesh_pattern_t *mesh,
|
||||
double *out_xmin,
|
||||
double *out_ymin,
|
||||
double *out_xmax,
|
||||
double *out_ymax);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_alpha_range (const cairo_pattern_t *gradient,
|
||||
double *out_min, double *out_max);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_gradient_pattern_is_solid (const cairo_gradient_pattern_t *gradient,
|
||||
const cairo_rectangle_int_t *extents,
|
||||
cairo_color_t *color);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_box_to_parameter (const cairo_gradient_pattern_t *gradient,
|
||||
double x0, double y0,
|
||||
double x1, double y1,
|
||||
double tolerance,
|
||||
double out_range[2]);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_interpolate (const cairo_gradient_pattern_t *gradient,
|
||||
double t,
|
||||
cairo_circle_double_t *out_circle);
|
||||
|
||||
cairo_private void
|
||||
_cairo_gradient_pattern_fit_to_range (const cairo_gradient_pattern_t *gradient,
|
||||
double max_value,
|
||||
cairo_matrix_t *out_matrix,
|
||||
cairo_circle_double_t out_circle[2]);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_radial_pattern_focus_is_inside (const cairo_radial_pattern_t *radial);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_opaque_solid (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_opaque (const cairo_pattern_t *pattern,
|
||||
const cairo_rectangle_int_t *extents);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_is_clear (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private_no_warn cairo_filter_t
|
||||
_cairo_pattern_analyze_filter (const cairo_pattern_t *pattern,
|
||||
double *pad_out);
|
||||
|
||||
enum {
|
||||
CAIRO_PATTERN_ACQUIRE_NONE = 0x0,
|
||||
CAIRO_PATTERN_ACQUIRE_NO_REFLECT = 0x1
|
||||
};
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_pattern_acquire_surface (const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int flags,
|
||||
cairo_surface_t **surface_out,
|
||||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_release_surface (const cairo_pattern_t *pattern,
|
||||
cairo_surface_t *surface,
|
||||
cairo_surface_attributes_t *attributes);
|
||||
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_pattern_acquire_surfaces (const cairo_pattern_t *src,
|
||||
const cairo_pattern_t *mask,
|
||||
cairo_surface_t *dst,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int mask_x,
|
||||
int mask_y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int flags,
|
||||
cairo_surface_t **src_out,
|
||||
cairo_surface_t **mask_out,
|
||||
cairo_surface_attributes_t *src_attributes,
|
||||
cairo_surface_attributes_t *mask_attributes);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_get_extents (const cairo_pattern_t *pattern,
|
||||
cairo_rectangle_int_t *extents);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_pattern_hash (const cairo_pattern_t *pattern);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_linear_pattern_hash (unsigned long hash,
|
||||
const cairo_linear_pattern_t *linear);
|
||||
|
||||
cairo_private unsigned long
|
||||
_cairo_radial_pattern_hash (unsigned long hash,
|
||||
const cairo_radial_pattern_t *radial);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_linear_pattern_equal (const cairo_linear_pattern_t *a,
|
||||
const cairo_linear_pattern_t *b);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_radial_pattern_equal (const cairo_radial_pattern_t *a,
|
||||
const cairo_radial_pattern_t *b);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_pattern_equal (const cairo_pattern_t *a,
|
||||
const cairo_pattern_t *b);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_reset_static_data (void);
|
||||
|
||||
#if CAIRO_HAS_DRM_SURFACE
|
||||
|
||||
cairo_private void
|
||||
|
|
@ -2340,6 +2184,9 @@ _cairo_drm_device_reset_static_data (void);
|
|||
cairo_private void
|
||||
_cairo_clip_reset_static_data (void);
|
||||
|
||||
cairo_private void
|
||||
_cairo_pattern_reset_static_data (void);
|
||||
|
||||
/* cairo-unicode.c */
|
||||
|
||||
cairo_private int
|
||||
|
|
@ -2367,18 +2214,6 @@ _cairo_utf8_to_utf16 (const char *str,
|
|||
int *items_written);
|
||||
#endif
|
||||
|
||||
/* cairo-mesh-pattern-rasterizer.c */
|
||||
|
||||
cairo_private void
|
||||
_cairo_mesh_pattern_rasterize (const cairo_mesh_pattern_t *mesh,
|
||||
void *data,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
double x_offset,
|
||||
double y_offset);
|
||||
|
||||
|
||||
/* cairo-observer.c */
|
||||
|
||||
cairo_private void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue