mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 20:48:06 +02:00
[cairo-spans] Introduce a type to track which pixels combine in a compositing op.
A cairo_composite_rectangles_t contains the coordinates of rectangular windows into each of the source pattern, mask, clip and destination surface containing the pixels that will combine in a compositing operation. The idea is to have a uniform way to represent all the translations involved rather than overloading parameters like src_x/y, dst_x/y, etc., sometimes with different incompatible meanings across functions.
This commit is contained in:
parent
a370d077bc
commit
4b227143b3
3 changed files with 52 additions and 0 deletions
|
|
@ -223,3 +223,24 @@ _cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point)
|
|||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_cairo_composite_rectangles_init(
|
||||
cairo_composite_rectangles_t *rects,
|
||||
int all_x,
|
||||
int all_y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
rects->src.x = all_x;
|
||||
rects->src.y = all_y;
|
||||
rects->mask.x = all_x;
|
||||
rects->mask.y = all_y;
|
||||
rects->clip.x = all_x;
|
||||
rects->clip.y = all_y;
|
||||
rects->dst.x = all_x;
|
||||
rects->dst.y = all_y;
|
||||
|
||||
rects->width = width;
|
||||
rects->height = height;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,6 +252,30 @@ typedef struct _cairo_box_int {
|
|||
cairo_point_int_t p2;
|
||||
} cairo_box_int_t;
|
||||
|
||||
|
||||
/* Rectangles that take part in a composite operation.
|
||||
*
|
||||
* This defines four translations that define which pixels of the
|
||||
* source pattern, mask, clip and destination surface take part in a
|
||||
* general composite operation. The idea is that the pixels at
|
||||
*
|
||||
* (i,j)+(src.x, src.y) of the source,
|
||||
* (i,j)+(mask.x, mask.y) of the mask,
|
||||
* (i,j)+(clip.x, clip.y) of the clip and
|
||||
* (i,j)+(dst.x, dst.y) of the destination
|
||||
*
|
||||
* all combine together to form the result at (i,j)+(dst.x,dst.y),
|
||||
* for i,j ranging in [0,width) and [0,height) respectively.
|
||||
*/
|
||||
typedef struct _cairo_composite_rectangles {
|
||||
cairo_point_int_t src;
|
||||
cairo_point_int_t mask;
|
||||
cairo_point_int_t clip;
|
||||
cairo_point_int_t dst;
|
||||
int width;
|
||||
int height;
|
||||
} cairo_composite_rectangles_t;
|
||||
|
||||
typedef enum _cairo_direction {
|
||||
CAIRO_DIRECTION_FORWARD,
|
||||
CAIRO_DIRECTION_REVERSE
|
||||
|
|
|
|||
|
|
@ -263,6 +263,13 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line);
|
|||
cairo_private cairo_bool_t
|
||||
_cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point);
|
||||
|
||||
cairo_private void
|
||||
_cairo_composite_rectangles_init (cairo_composite_rectangles_t *rects,
|
||||
int all_x,
|
||||
int all_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/* cairo-array.c structures and functions */
|
||||
|
||||
cairo_private void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue