filename=Filename;
buffer=NULL;
ready=false;
- color_buffer=0;
+ color_buffer=0;
}
png_trgt::~png_trgt()
png_trgt::start_frame(synfig::ProgressCallback *callback)
{
int w=desc.get_w(),h=desc.get_h();
-
+
if(file && file!=stdout)
fclose(file);
if(filename=="-")
newfilename(filename),
ext(find(filename.begin(),filename.end(),'.'),filename.end());
newfilename.erase(find(newfilename.begin(),newfilename.end(),'.'),newfilename.end());
-
+
newfilename+=etl::strprintf("%04d",imagecount)+ext;
file=fopen(newfilename.c_str(),"wb");
if(callback)callback->task(newfilename);
file=fopen(filename.c_str(),"wb");
if(callback)callback->task(filename);
}
-
+
if(!file)
return false;
-
+
delete [] buffer;
buffer=new unsigned char[4*w];
fclose(file);
return false;
}
-
+
info_ptr= png_create_info_struct(png_ptr);
if (!info_ptr)
{
png_destroy_write_struct(&png_ptr,(png_infopp)NULL);
return false;
}
-
+
if (setjmp(png_jmpbuf(png_ptr)))
{
synfig::error("Unable to setup longjump");
// Write the gamma
//png_set_gAMA(png_ptr, info_ptr,1.0/gamma().get_gamma());
png_set_gAMA(png_ptr, info_ptr,gamma().get_gamma());
-
+
// Write the physical size
png_set_pHYs(png_ptr,info_ptr,round_to_int(desc.get_x_res()),round_to_int(desc.get_y_res()),PNG_RESOLUTION_METER);
-
+
// Output any text info along with the file
png_text comments[]=
{
{ PNG_TEXT_COMPRESSION_NONE, "Software", "SYNFIG" },
};
png_set_text(png_ptr,info_ptr,comments,sizeof(comments)/sizeof(png_text));
-
+
png_write_info_before_PLTE(png_ptr, info_ptr);
png_write_info(png_ptr, info_ptr);
ready=true;