<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi Chris,<br>
      <br>
      Thanks for your advice :)<br>
      <br>
      I used XFillArc(Xlib stuff) instead
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <a
href="https://github.com/xiangzhai/grt/blob/master/GRTExamples/ClassificationModulesExamples/X11DTWExample/x11.cpp#L227">https://github.com/xiangzhai/grt/blob/master/GRTExamples/ClassificationModulesExamples/X11DTWExample/x11.cpp#L227</a><br>
      <br>
    </div>
    <blockquote
      cite="mid:20131006090502.GA14951@nuc-i3427.alporthouse.com"
      type="cite">
      <pre wrap="">On Sun, Oct 06, 2013 at 03:50:59PM +0800, Leslie Zhai wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">   Hi cairo developers,

   I wanna draw some points indicating mouse`s X and Y, and used random
   number from 0 to 255 for RGB color of the points, such as:

   for loop
   {                                                                      
                                 
           double r = Map(i, 0, 100, 0, 255);    // Re-maps a number from one
   range to another
   [1]<a class="moz-txt-link-freetext" href="http://www.openframeworks.cc/documentation/math/ofMath.html#show_ofMap">http://www.openframeworks.cc/documentation/math/ofMath.html#show_ofMap</a>
           double g =
   0;                                                      
           double b = 255 -
   r;                                                
                                                               
           cairo_set_source_rgb(c, r / 255.0, g / 255.0, b /
   255.0);          
           cairo_move_to(c, x,
   y);                                            
          
   cairo_close_path(c);                                               
   }                                                                      
   cairo_stroke(c);

   It is unable to put cairo_stroke into the for loop, it might be a heavy
   operation when draw the path too often.
   But cairo_set_source_rgb failed to take effect in the loop if cairo_stroke
   was outside.

   The source code is available via
   [2]<a class="moz-txt-link-freetext" href="https://github.com/xiangzhai/grt/tree/master/GRTExamples/ClassificationModulesExamples/CairoX11DTWExample">https://github.com/xiangzhai/grt/tree/master/GRTExamples/ClassificationModulesExamples/CairoX11DTWExample</a>

   So how to take cairo_set_source_rgb effect for drawing different color
   points?
   Please someone give me some advice, Thanks a lot :)
</pre>
      </blockquote>
      <pre wrap="">
You can't store color per-path as stroke/fill operate upon the path union.
For the same reason calling stroke 100 times for a simple path is likely to
be a lot cheaper than calling it once with a 100-fold more complex path.

And you probably don't want to use stroke here unless you have a wide
pen and wish to use the pen to draw dots.
-Chris

</pre>
    </blockquote>
    <br>
  </body>
</html>