[cairo] SVG & PS/EPS surfaces

Tomas By tomas at basun.net
Mon Aug 3 04:52:59 PDT 2015


Hi,

Thanks. Yes, this makes sense. This should work for me also.

I guess I was thinking too functionally (and what I have now seems to 
work fine).

(Plus, I struggle too see how a recording surface can be an output 
device.)

/Tomas



On 2015-08-03 13:41, Andreas Lobinger wrote:
> Hello, (i might write something stupid here, because the thread isn't
> somehow fully available to me)
> 
> to combine drawings i use drawing functions that operate on a context
> with some input parameters/data and just call them sequentially.
> 
> function draw_frame(cr)
>   save(cr)
>   pathconstruction -> fill/stroke
>   restore(cr)
> end
> 
> function draw_xg(cr, right_shift)
>   save(cr)
>   translate(cr,right_shift,0)
>   pathconstruction -> fill/stroke
>   restore(cr)
> end
> 
> # main
> i = Cairo.image_surface(400,300,RGBA)
> cr = CarioContext(i)
> 
> draw_frame(cr)
> for l in 10:10:120
>      draw_xg(cr,l)
>      end
> 
> save_to_png(i)
> 
> or similar. Also in the cases where i is a vector surface i get vector
> output with it (obviously not on .png)
> Using surfaces as sources can lead to rasterization - i had some
> problems (but this was pre-1.14, and i never checked again) with
> recording surfaces and scaling before painting. I rather see surfaces
> as output devices.
> Some intermediate drawing -if needed- can be done by push/pop groups.
> 
> But i think i agree, it should be clearer in documentation, in which
> steps rasterization is enforced.
> 
> Wishing a happy day,
>           Andreas



More information about the cairo mailing list