[cairo] virtual surfaces and composition

Uli Schlachter psychon at znc.in
Fri Dec 11 08:34:51 PST 2015


Am 10.12.2015 um 00:00 schrieb Lawrence D'Oliveiro:
> On Wed, 09 Dec 2015 21:41:47 +0000, Henry (Yu) Song wrote:
> 
>> On 12/9/15, 1:28 PM, "cairo on behalf of Lawrence D'Oliveiro"
>> <cairo-bounces at cairographics.org on behalf of
>> ldo at geek-central.gen.nz> wrote:
>>>
>>> Someone added a region object to Cairo, but it doesn’t seem to be
>>> used for anything.
>>>
>> Do you mean cairo_region_t?  It is being used across inside cairo
> 
> It may be used internally, but there is no integration at the API
> level. For example, you can’t use a region for clipping or filling.
> 

Let me mention:

void append_region_to_path(cairo_t *cr, const cairo_region_t *region)
{
  cairo_rectangle_int_t rect;
  int i;
  int num = cairo_region_num_rectangles (region);
  for (i = 0; i < num; i++) {
    cairo_region_get_rectangle (region, i, &rect);
    cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
  }
}

Clip by region now becomes:

append_region_to_path(cr, region);
cairo_clip(cr);

and filling by region:

append_region_to_path(cr, region);
cairo_fill(cr);

I don't really know why cairo doesn't offer this function. Just saying that it
is not complicated to add yourself.

Cheers,
Uli
-- 
A normal person is just someone you don't know well enough yet.
 - Nettie Wiebe


More information about the cairo mailing list