[cairo] Changing line color
necko necko
opustenom at hotmail.com
Fri Aug 27 06:11:11 PDT 2010
> Date: Fri, 27 Aug 2010 14:46:03 +0200
> Subject: Re: [cairo] Changing line color
> From: mkbosmans at gmail.com
> To: opustenom at hotmail.com
> CC: cairo at cairographics.org
>
> 2010/8/27 necko necko <opustenom at hotmail.com>:
> > In order for my pdf file to look nicer, I changed the background to black,
> > and now
> > I need to emphasize a number of lines between certain coordinates. Some
> > lines need
> > to be shown as red, some as green, and some as blue, or a variation.
> > I tested the above requirement with the code below:
> > cairo_set_line_width (cr, .5);
> > cairo_set_source_rgb(cr, 1, 0, 0);
> > cairo_move_to (cr, 152.84, -50.0);
> > cairo_line_to (cr, 83.97, 30.93);
> > cairo_stroke_preserve(cr);
> >
> > cairo_set_source_rgb(cr, 0, 0, 1);
> > cairo_move_to(cr, 90, 1);
> > cairo_line_to(cr, 40, 1);
> > cairo_stroke_preserve(cr);
> > ......................................
> > However, both lines are displayed as blue, with a very thin red line in the
> > middle of it.
> > Is there a way to specify that one line needs to be only blue, and the other
> > only red?
> > What would be the code to try?
> > I appreciate your help.
>
> You'll want to user cairo_stroke instead of cairo_stroke_preserve.
> Because in the code above the second path from the blue line gets
> added to the already exisiting path you used for the red line, thus
> rendering the two lines on top of eachother.
>
> Maarten
Thank you, Maarten.
In addition, is there some other way to change the background of the pdf file, instead of
specifying the bounding rectangle and then invoking fill()?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100827/b7d60d07/attachment.htm>
More information about the cairo
mailing list