<html><head><style type="text/css"><!-- DIV {margin:0px} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">This is probably because cairo_fill() doesn't know what to fill in your code.<br>you should add before your cairo_fill() call, something like :<br> cairo_rectangle(cr,0,0,WIDTH,HEIGHT);<br>so that cairo_fill() knows that the closed path on which to apply the fill is your whole surface.<br><br>Fabien<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Message d'origine ----<br>De : Baptiste Gaillard <b_gaillard@hotmail.com><br>À :
cairo@cairographics.org<br>Envoyé le : Lundi, 10 Juillet 2006, 11h34mn 47s<br>Objet : [cairo] Newbie - simple program doesn't work<br><br>
<style></style>
<div><font face="Arial" size="2">Hello, I'm begining with cairo with a very simple
program that doesn't work, but I don't understand why !!!</font></div>
<div><font face="Arial" size="2">Here is the code:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font size="2">
<p>#include <cairo-win32.h></p>
<p>#define WIDTH 10000</p>
<p>#define HEIGHT 10000</p>
<p>void display_status(cairo_status_t status) {</p>
<p>switch(status) {</p>
<p>case CAIRO_STATUS_SUCCESS:</p>
<p>cout << "CAIRO_STATUS_SUCCESS" << endl;</p>
<p>break;</p>
<p></p>
<p>case CAIRO_STATUS_NULL_POINTER:</p>
<p>cout << "CAIRO_STATUS_NULL_POINTER" << endl;</p>
<p>break; </p>
<p></p>
<p>case CAIRO_STATUS_NO_MEMORY:</p>
<p>cout << "CAIRO_STATUS_NO_MEMORY" << endl;</p>
<p>break; </p>
<p></p>
<p>case CAIRO_STATUS_READ_ERROR:</p>
<p>cout << "CAIRO_STATUS_READ_ERROR" << endl;</p>
<p>break;</p>
<p></p>
<p>case CAIRO_STATUS_INVALID_CONTENT:</p>
<p>cout << "CAIRO_STATUS_INVALID_CONTENT" << endl;</p>
<p>break;</p>
<p></p>
<p>case CAIRO_STATUS_INVALID_FORMAT:</p>
<p>cout << "CAIRO_STATUS_INVALID_FORMAT" << endl;</p>
<p>break;</p>
<p></p>
<p>case CAIRO_STATUS_INVALID_VISUAL:</p>
<p>cout << "CAIRO_STATUS_INVALID_VISUAL" << endl;</p>
<p>break;</p>
<p>}</p>
<p>}</p>
<p></p>
<p>int main(int argc, char** argv) {</p>
<p>cairo_surface_t *surface;</p>
<p>cairo_t *cr;</p>
<p></p>
<p>surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, WIDTH, HEIGHT);
</p>
<p>display_status(cairo_surface_status (surface));</p>
<p></p>
<p>cr = cairo_create (surface);</p>
<p>display_status(cairo_surface_status (surface)); </p>
<p></p>
<p>cairo_set_source_rgb(cr, 1,1,1);</p>
<p>cairo_fill(cr);</p>
<p>display_status(cairo_surface_status (surface));</p>
<p></p>
<p>cairo_surface_write_to_png (surface, "test.png"); </p>
<p>display_status(cairo_surface_status (surface));</p>
<p>cairo_destroy (cr);</p>
<p>cairo_surface_destroy (surface);</p>
<p>return 0;</p>
<p>}</p>
<p> </p>
<p><font face="Arial">The program create a png image, but it's filled in black
whereas it should be white. I tried to draw paths and other forms but it seems
that the image buffer isn't </font></p>
<p><font face="Arial">modified. I'm working on Windows with DevC++ and use the
cairo library provided with the GTK+ package for windows as indicated on the
Cairo web site. </font></p>
<p><font face="Arial">So, do you know why this code doesn't work ?</font></p>
<p><font face="Arial">Thanks</font></p>
<p><font face="Arial"></font> </p>
<p><font face="Arial">PS: sorry for my English, I'm french :-)
</font></p></font></div><div>_______________________________________________<br>cairo mailing list<br>cairo@cairographics.org<br><a id="bodyLinks" rel="nofollow" target="_blank" href="http://cairographics.org/cgi-bin/mailman/listinfo/cairo">http://cairographics.org/cgi-bin/mailman/listinfo/cairo</a></div></div><br></div></div></div><br></div></div></body></html>