[cairo] Problem with Arcs

Mukul Sharma elitecoder.mukul at gmail.com
Thu Oct 25 20:01:20 PDT 2007

Dear Members,

I have been trying to compile the cairo source code version 1.4.10 as a
single executable with my sample program over Linux Environment in order to
port it to T-Environment later on. While I tried and tested the sample
programs provided over cairo graphics website, the samples using cairo_arc
have not been working. I have run the executable through Gdb several number
of times and have not reached any conclusion. The problem is that while I
use arcs in my sample program, my program compiles fine, executes fine, but
the image created by it, is all empty. I had dumped the pixels of the image
out and I got all zeros (hex values). The program I am using is like this -

double xc = 128.0;
double yc = 128.0;
double radius = 100.0;
double angle1 = 45.0  * (M_PI/180.0);  /* angles are specified */
double angle2 = 180.0 * (M_PI/180.0);  /* in radians           */

cairo_set_line_width (cr, 10.0);
cairo_arc (cr, xc, yc, radius, angle1, angle2);
cairo_stroke (cr);

/* draw helping lines */
cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_set_line_width (cr, 6.0);

cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI);
cairo_fill (cr);

cairo_arc (cr, xc, yc, radius, angle1, angle1);
cairo_line_to (cr, xc, yc);
cairo_arc (cr, xc, yc, radius, angle2, angle2);
cairo_line_to (cr, xc, yc);
cairo_stroke (cr);

As this is a sample program given over Cairo Website, I doubt that there is
any problem with the code. I suspect that, arc functionality in Cairo has
some dependencies, which somehow are not getting fulfilled while compiling
as an executable, and not even showing any error to me. Please guide me
regarding this issue as I have been trying to resolve it since some time.

Thanks and Regards,

Er. Mukul Sharma
Research Intern
Centre for High Performance Embedded Systems, NTU, Singapore

"A person who runs from responsibilities, runs from life."

"It is easy to hate and it is difficult to love. This is how the whole
scheme of things works. All good things are difficult to achieve; and bad
things are very easy to get."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20071026/93fd9560/attachment.html 

More information about the cairo mailing list