[cairo] SVG & PS/EPS surfaces
Andreas Lobinger
lobingera at gmail.com
Mon Aug 3 04:41:47 PDT 2015
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