<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi cairo developers,<br>
<br>
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:<br>
<br>
for loop <br>
{
<br>
double r = Map(i, 0, 100, 0, 255); // Re-maps a number
from one range to another
<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><br>
double g =
0; <br>
double b = 255 -
r;
<br>
cairo_set_source_rgb(c, r / 255.0, g / 255.0, b /
255.0); <br>
cairo_move_to(c, x,
y); <br>
cairo_close_path(c);
<br>
}
<br>
cairo_stroke(c);<br>
<br>
It is unable to put cairo_stroke into the for loop, it might be a
heavy operation when draw the path too often.<br>
But cairo_set_source_rgb failed to take effect in the loop if
cairo_stroke was outside.<br>
<br>
The source code is available via
<meta http-equiv="content-type" content="text/html; charset=GB2312">
<a
href="https://github.com/xiangzhai/grt/tree/master/GRTExamples/ClassificationModulesExamples/CairoX11DTWExample">https://github.com/xiangzhai/grt/tree/master/GRTExamples/ClassificationModulesExamples/CairoX11DTWExample</a><br>
<br>
So how to take cairo_set_source_rgb effect for drawing different
color points?<br>
Please someone give me some advice, Thanks a lot :)<br>
<br>
Best,<br>
<br>
Leslie Zhai<br>
</body>
</html>