我正在尝试编写一个 PNG 文件。我总是收到写入错误 ( CAIRO_STATUS_WRITE_ERROR
)。
cairo_surface_t *image_surface = cairo_surface_create_similar_image(pBitmap -> mainSurface,
CAIRO_FORMAT_RGB24, pBitmap -> geom.width, pBitmap -> geom.height);
cairo_t *cr = cairo_create(image_surface);
cairo_set_source_surface(cr, pBitmap -> mainSurface, 0, 0);
cairo_paint(cr);
cairo_status_t cairo_errCode;
if(pFile)
{
char template[] = "./fileXXXXXX.png";
char *tempFileName = mkdtemp(template);
if(tempFileName)
{
if((cairo_errCode = cairo_surface_write_to_png(image_surface, tempFileName)) == CAIRO_STATUS_SUCCESS)
{
据我了解,它清楚地表明文件错误。我尝试了很多地方,看看是否是权限问题。