[cairo] Uniform Line Widths

Bobby Salazar bobby8934 at inbox.com
Thu Feb 21 23:36:50 PST 2008


Ok, that is much simpler than I thought, and works good too.

However, my code is written so that the pre-set line width is correct for the currently applied transformation matrix. If I then set the transformation matrix to be the identity matrix, the line width is not correct. Is there an equally simple method of mapping a certain line width from any arbitrary transformation matrix into the same pixel sized width it would if the identity matrix were used? I hope that last sentenced makes sense...

Thanks!

> -----Original Message-----
> From: behdad at behdad.org
> Sent: Wed, 20 Feb 2008 14:17:11 -0500
> To: bobby8934 at inbox.com
> Subject: Re: [cairo] Uniform Line Widths
> 
> On Wed, 2008-02-20 at 10:39 -0800, Bobby Salazar wrote:
>> I currently have a function that accepts a cairo context (with a path
>> already set) and strokes the path with a pre-set width and color. The
>> context can have any arbitrary transformation already applied to it. So
>> given this situation, how would I ensure that I get a uniform line width
>> from the stroke even when they may have applied a deforming scale to the
>> context? Any ideas would be appreciated!
> 
> Something like:
> 
>   cairo_save (cr);
>   cairo_identity_matrix (cr);
>   cairo_set_line_width (cr, width);
>   cairo_stroke (cr);
>   cairo_restore (cr);
> 
> 
>> Thanks!
> 
> Have fun with cairo!
> --
> behdad
> http://behdad.org/
> 
> "Those who would give up Essential Liberty to purchase a little
>  Temporary Safety, deserve neither Liberty nor Safety."
>         -- Benjamin Franklin, 1759

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
Check it out at http://www.inbox.com/marineaquarium


More information about the cairo mailing list