[cairo] Drawing a thick path sans stroke()

donn donn.ingle at gmail.com
Fri Feb 12 00:35:18 PST 2010


Hi,
I want to draw paths (curves and lines) without using strokes, but I 
want them to have a width (from 1 upwards) -- in other words, I need to 
draw a path from A to B and then turn at right angles, draw a thickness, 
and then draw back along the same path and close.

Call it an outline of a thick curve -- which would then be filled by 
fill().

My brain and maths just don't share the same space. I have been scraping 
the tubes and all I see is a bunch of stuff that ruffles my hair as it 
flies over my head.

I can't figure out how to determine what angle to turn at from a point 
at the end of a line (or curve) that makes a nice "T" right-angle turn. 
If I draw a curve by hand, my hand has no trouble drawing a line that 
satisfies me, but I don't know how I do it!

Could anyone point me in the right direction?

\d

BTW - I need this because I am working in Clutter and using their cogl 
path thing. They do have a stroke() but it can't be wider than 1px (and 
it crashes on pyClutter for some reason.) Their cogl API is alike to 
Cairo, so I am asking here. Also, I will be moving from cogl to cairo 
and back again all the time. cogl draws the 'pick' area (for hit 
testing) and cairo will draw the visible paths.

-- 
Fonty Python and Things! -- http://otherwise.relics.co.za/wiki/Software


More information about the cairo mailing list