【发布时间】:2018-01-18 14:40:00
【问题描述】:
我在 INTERNET 中搜索了与该主题相关的内容,但我发现只有想要保存背景透明的 png 文件的人。
我报告了我目前使用并生成背景透明的 png 的源代码:
cairo_surface_t *surface; // Declarations
cairo_t *cr;
// Creations of the surface
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,3508,2480);
// Contest
cr = cairo_create(surface);
// Moving the plot to center in the page
cairo_translate(cr, 200,200);
// Scaling the plot
cairo_scale(cr,1.8,1.8);
// Make all the necessary actions to produce the plot
do_drawing(cr);
// write the plot on the file png
cairo_surface_write_to_png(surface, "image.png");
// End
cairo_surface_destroy(surface);
cairo_destroy(cr);
我也使用了表面 CAIRO_FORMAT_RGB24,但我得到了一个黑色矩形,如绘图。
你能帮帮我吗? 谢谢你
【问题讨论】: