Re: virtual surfaces and composition

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
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"
>> <[email protected] on behalf of
>> [email protected]> 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
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.