X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_png%2Ftrgt_png.cpp;h=1b84eee43afba97021cd5c5c7d2edc2b8cae2198;hb=6e6b8ce1d75be6a6b99d2cc955faeeea80d62c26;hp=74ee5430cb6c1dbb4e3f865ac8c8c31a86530a1f;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_png/trgt_png.cpp b/synfig-core/trunk/src/modules/mod_png/trgt_png.cpp index 74ee543..1b84eee 100644 --- a/synfig-core/trunk/src/modules/mod_png/trgt_png.cpp +++ b/synfig-core/trunk/src/modules/mod_png/trgt_png.cpp @@ -3,16 +3,17 @@ ** png_trgt Target Module ** $Id: trgt_png.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ ** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** ** === N O T E S =========================================================== ** @@ -80,7 +81,7 @@ png_trgt::png_trgt(const char *Filename) filename=Filename; buffer=NULL; ready=false; - color_buffer=0; + color_buffer=0; } png_trgt::~png_trgt() @@ -125,7 +126,7 @@ bool png_trgt::start_frame(synfig::ProgressCallback *callback) { int w=desc.get_w(),h=desc.get_h(); - + if(file && file!=stdout) fclose(file); if(filename=="-") @@ -139,7 +140,7 @@ png_trgt::start_frame(synfig::ProgressCallback *callback) 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); @@ -149,10 +150,10 @@ png_trgt::start_frame(synfig::ProgressCallback *callback) file=fopen(filename.c_str(),"wb"); if(callback)callback->task(filename); } - + if(!file) return false; - + delete [] buffer; buffer=new unsigned char[4*w]; @@ -166,7 +167,7 @@ png_trgt::start_frame(synfig::ProgressCallback *callback) fclose(file); return false; } - + info_ptr= png_create_info_struct(png_ptr); if (!info_ptr) { @@ -175,7 +176,7 @@ png_trgt::start_frame(synfig::ProgressCallback *callback) png_destroy_write_struct(&png_ptr,(png_infopp)NULL); return false; } - + if (setjmp(png_jmpbuf(png_ptr))) { synfig::error("Unable to setup longjump"); @@ -192,20 +193,20 @@ png_trgt::start_frame(synfig::ProgressCallback *callback) // 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, "Title", const_cast(get_canvas()->get_name().c_str()) }, { PNG_TEXT_COMPRESSION_NONE, "Description", const_cast(get_canvas()->get_description().c_str()) }, - { PNG_TEXT_COMPRESSION_NONE, "Copyright", "(c) 2004 Voria Studios, LLC" }, +// { PNG_TEXT_COMPRESSION_NONE, "Copyright", "(c) 2004 Voria Studios, LLC" }, { 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;