[cairo] Changing line color
necko necko
opustenom at hotmail.com
Fri Aug 27 08:55:15 PDT 2010
From: mikhailkozhevnikov at yandex.ru
To: opustenom at hotmail.com
CC: mkbosmans at gmail.com; cairo at cairographics.org
Subject: Re: [cairo] Changing line color
Date: Fri, 27 Aug 2010 18:07:29 +0400
cairo_paint() should do. --MK 27.08.2010, 17:11, "necko necko" <opustenom at hotmail.com>:
> 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()?
--
cairo mailing list
cairo at cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100827/bcbe6a15/attachment-0001.htm>
More information about the cairo
mailing list