[cairo] Help with PDF output from painting surfaces

Cope, Phil (GE Energy) phil1.cope at ge.com
Mon Nov 14 09:00:54 PST 2011


Thanks.

Your reply made me dig a bit deeper. For rotated tiles, our software is actually providing a rectangular source with the rotated tile within it and a diamond shaped mask, rather than rotating the transform in the cairo context. Unfortunately this is done for historical reasons, and I'm hoping not to have to unpick that at least until we're confident of Cairo as a solution.  

Thus the current sequence of cairo calls is

surface = cairo_image_surface_create_for_data (...,  _RBG24 ..);
cairo_set_source_surface( ... , surface, x, y);
mask = cairo_image_surface_create_for_data( ..., _A1, ...);
cairo_mask_surface(... mask, ,x ,y);

with stuff like stride_for_width omitted for clarity. Since I need to mask, I can't fill a rectangle ?


-----Original Message-----
From: Andrea Canciani [mailto:ranma42 at gmail.com] 
Sent: 14 November 2011 16:33
To: Cope, Phil (GE Energy)
Cc: cairo at cairographics.org
Subject: Re: [cairo] Help with PDF output from painting surfaces

On Mon, Nov 14, 2011 at 5:01 PM, Cope, Phil (GE Energy) <phil1.cope at ge.com> wrote:
> Hello, I have a problem with PDF output. I have a system that can 
> potentially render a huge image (e.g. a satellite photography) It does 
> this by tiling the image and sending the tiles to Cairo which are then 
> painted as source.
>
>
>
> When outputting to PDF there is an issue illustrated by the 
> screengrabs of Adobe Reader displaying the Cairo output (see links 
> below).  The first is fine, but the second, which is the same data 
> (approximately)  rotated through 45deg. The third is a zoomed in area 
> of the previous. The obvious problem is what looks like antialiasing 
> on the edge of the tiles which is manifesting itself as diagonal lines on the boundaries of the tiles.

More than antialiasing, I would guess that your problem is CAIRO_EXTEND_NONE.
Can you check if setting the extend mode to PAD solves your problem?
(You will need to fill a rectangle, if you use a PAD-extended source).

Andrea

>
>
>
> I set
>
>
>
> cairo_set_antialias(ctxt, CAIRO_ANTIALIAS_NONE);
>
>
>
> while drawing these tiles, I also tried
>
>
>
> cairo_set_operator(ctxt, CAIRO_OPERATOR_SOURCE);
>
>
>
> (rather than _OVER) but this had bizarre and unwanted effects on the 
> screen drawing.
>
>
>
> Any hints as to how I can remove these artefacts would be much 
> appreciated, I'm using 1.10.2
>
>
>
> Unrotated:
>
> http://s10.postimage.org/p0jf9u0cp/cairo_0deg.png
>
>
>
> Rotated at 45 deg:
>
> http://s7.postimage.org/4zwv1z697/cairo_45deg.png
>
>
>
> Above PDF zoomed in:
>
> http://s9.postimage.org/ra6wl28fj/cairo_45deg_zoomed.png
>
>
>
>
>
> Cheers
>
>
>
> Phil Cope
>
> Senior Software Engineer (GE Energy: SSG)
>
>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list