inline void dump_png(const char * filename, const Drawable & drawable) { if (FILE * f = fopen(filename, "wb")) { ::dump_png24(f, drawable.data(), drawable.width(), drawable.height(), drawable.rowsize(), true); ::fclose(f); } }
inline void dump_png(const char * prefix, const Drawable & data) { char tmpname[128]; sprintf(tmpname, "%sXXXXXX.png", prefix); int fd = ::mkostemps(tmpname, 4, O_WRONLY|O_CREAT); FILE * f = fdopen(fd, "wb"); ::dump_png24(f, data.data(), data.width(), data.height(), data.rowsize(), true); ::fclose(f); }