[cairo] Copying of clip not working for PS surface

Fred Kiefer fredkiefer at gmx.de
Mon May 12 12:55:10 PDT 2008


What is the state of these two functions now? As far as I can see they 
are still only on the TODO list, but not on the road map.

I am not familiar with the internal cairo structures. I had a short look 
at clipping and now I am sure, I wont be able to come up with a patch 
for this myself. Is there anything apart from a patch that I may do to 
get more priority to this feature?
This is one of the main obstacles against making cairo the default 
drawing backend for GNUstep. Or at least this is how it looks to me. 
Maybe there is a totally different way to get the same functionality, 
that is, a proper copy of the current cairo state to store it away for 
later use.

Cheers,
Fred


Behdad Esfahbod wrote:
> On Thu, 2007-10-25 at 14:31 -0400, Fred Kiefer wrote:
>> Thank you for this explanation. The copy_clip_path would just do the
>> trick for us, if you could at that to an upcoming cairo release, then
>> the GNUstep cairo based code could be fully working.
> 
> This is already in TODO:
> 
>  • cairo_copy_clip() and cairo_copy_clip_flat()
> 
> http://lists.freedesktop.org/archives/cairo/2007-April/010520.html
> 
> 
> Cheers,
> 
> behdad
> 
> 
>> Cheers,
>> Fred
>>
>>
>> Vladimir Vukicevic wrote:
>>> Fred Kiefer wrote:
>>>> About a week ago I send this mail to the mailing list, but didn't get
>>>> any reply.
>>>> What I need to know is if this is intended behaviour and if there is a
>>>> way to work around it. If necessary, I could provide you with some
>>>> background information, where and why the copying of the current clip
>>>> range is needed in GNUstep (We use it to work around another limitation
>>>> of cairo).
>>> Unfortunately this is unimplemented behaviour -- the
>>> copy_clip_rectangle_list stuff only works when the backend implements
>>> clipping using a region.  The PS surface uses the path directly, and so
>>> even if the path is a rectangle, it's still stored as a path and not a
>>> region.  There are two things that could be done here:
>>>
>>> 1) copy_clip_rectangle_list could try to do a tessellation and a region
>>> extraction if the clip that's set is a path;
>>>
>>> 2) implement a copy_clip_path (since we already have a public way to
>>> represent a path).
>>>
>>>     - Vlad
>>>
>>>> Cheers,
>>>> Fred
>>>>
>>>>
>>>> Fred Kiefer wrote:
>>>>> Is anybody able to explain why the following short program gives the
>>>>> output "Cairo status 'clip region not representable in desired format'
>>>>> in copy clip"?
>>>>>
>>>>> The same operations work fine when applied to an image surface.
>>>>>
>>>>> Thank you
>>>>> Fred
>>>>>
>>>>> #include <stddef.h>
>>>>> #include <cairo.h>
>>>>> #include <cairo-ps.h>
>>>>>
>>>>> int
>>>>> main (int argc, const char *argv[])
>>>>> {
>>>>>   cairo_status_t status;
>>>>>   cairo_t *ct;
>>>>>   cairo_surface_t *surface;
>>>>>   cairo_rectangle_list_t *clip_rects;
>>>>>
>>>>>   surface = cairo_ps_surface_create("test.ps", 100, 100);
>>>>>   status = cairo_surface_status(surface);
>>>>>   if (status != CAIRO_STATUS_SUCCESS)
>>>>>     {
>>>>>       printf("Cairo status '%s' for surface\n",
>>>>> cairo_status_to_string(status));
>>>>>       return 0;
>>>>>     }
>>>>>
>>>>>   ct = cairo_create(surface);
>>>>>   status = cairo_status(ct);
>>>>>   if (status != CAIRO_STATUS_SUCCESS)
>>>>>     {
>>>>>       printf("Cairo status '%s' for context\n",
>>>>> cairo_status_to_string(status));
>>>>>       return 0;
>>>>>     }
>>>>>
>>>>>   cairo_rectangle(ct, 10, 10, 80, 80);
>>>>>   cairo_clip(ct);
>>>>>   clip_rects = cairo_copy_clip_rectangle_list(ct);
>>>>>   status = clip_rects->status;
>>>>>   if (status != CAIRO_STATUS_SUCCESS)
>>>>>     {
>>>>>       printf("Cairo status '%s' in copy clip\n",
>>>>> cairo_status_to_string(status));
>>>>>     }
>>>>>
>>>>>   cairo_destroy(ct);
>>>>>   cairo_surface_destroy(surface);
>>>>> }



More information about the cairo mailing list