<div class="gmail_quote"><br><br>Hi,<br><br>i have tried with following code <br><div class="Ih2E3d"><br>tsurf = cairo_get_target(cr);<br></div>cairo_surface_write_to_png (tsurf, &quot;sticker.png&quot;);<br><br>but it is saving a zero Byte PNG. Could you tell me where to use &quot;cairo_get_target&quot; api ?<div class="Ih2E3d">
<br>
<br>Thanks in Advance.<br><br>Regards,<br><font color="#888888">Chandra Shekhar Sengupta<br><br>
</font><br></div><div><div></div><div class="Wj3C7c"><div class="gmail_quote">On Wed, Apr 16, 2008 at 3:34 PM, Gerdus van Zyl &lt;<a href="mailto:gerdusvanzyl@gmail.com" target="_blank">gerdusvanzyl@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Its because you are not working with the surface cr is targeting. You need code like <br>tsurf = cairo_get_target(cr); to get the temporary surface GTK is giving you.<br><br>~Gerdus<br><br><div class="gmail_quote"><div><div>

</div><div>On Wed, Apr 16, 2008 at 8:11 AM, Chandra Shekhar Sengupta &lt;<a href="mailto:sayan801@gmail.com" target="_blank">sayan801@gmail.com</a>&gt; wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi,<br>I am new to cairo. i am trying to rotate and scale a image . After doing the transformation i am displaying it in the window, it is shown properly . But when i am saving the surface using &quot;cairo_surface_write_to_png&quot; , the original image is saved again , the changes due to transformation is not reflected. And when i was trying to get the width of scaled surface using &quot;cairo_image_surface_get_width&quot;, it is giving the original width only.My code segment is given below.<br>



/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>static gboolean on_expose_event(GtkWidget *widget,GdkEventExpose *event, gpointer data)<br>



{<br>&nbsp; cairo_t *cr;<br>gint width,height;<br><br>cr = gdk_cairo_create (widget-&gt;window);<br><br>width = cairo_image_surface_get_width(image);<br>height = cairo_image_surface_get_height(image);<br>&nbsp;<br><br>cairo_translate(cr,width/2,height/2);<br>



<br>cairo_scale(cr,scale_factor,scale_factor);<br><br>cairo_rotate(cr,rotate_angle*M_PI/180.0);<br><br>&nbsp;g_print(&quot;rotate_angle %f \n&quot;,rotate_angle);<br><br><br>gtk_widget_set_size_request (da, width,height);<br>


<br>
&nbsp;g_print(&quot;width = %d height = %d \n&quot;,width,height);<br><br>&nbsp;cairo_set_source_surface(cr, image,-width/2,-height/2);<br><br>&nbsp;cairo_paint(cr);<br>&nbsp;cairo_surface_write_to_png (image, &quot;sticker.png&quot;);<br><br>



&nbsp; cairo_destroy(cr);<br><br>&nbsp; return FALSE;<br>}<br><br><br>int main(int argc, char *argv[])<br>{<br>&nbsp; /...../<br><br>&nbsp; image = cairo_image_surface_create_from_png(argv[1]);<br>&nbsp; width = cairo_image_surface_get_width(image);<br>



&nbsp; height = cairo_image_surface_get_height(image);<br>&nbsp;g_print(&quot;width = %d height = %d \n&quot;,width,height);<br><br>/...../<br><br>da = gtk_drawing_area_new ();<br>gtk_widget_set_size_request (da, width,height);<br>



gtk_fixed_put(GTK_FIXED(fixed),da,50,50);<br>g_signal_connect(da, &quot;expose-event&quot;,G_CALLBACK (on_expose_event), NULL);<br><br>/...../<br><br>cairo_surface_destroy(image);<br><br>&nbsp; return 0;<br>}<br clear="all">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>



<br>Thanks in Advance.<br><br>Regards,<br><font color="#888888">Chandra Shekhar Sengupta<br><br>
</font><br></div></div>_______________________________________________<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br></blockquote></div><br>
</blockquote></div><br></div></div></div>