X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_ppm%2Ftrgt_ppm.cpp;h=fe424bc6d487b13e8c9b5ed154d259e5d21e88da;hb=cc54c38609ee9745ad678e5e9b9d7d2912be9c95;hp=74acd44720abee3d6f1e6a35e6e9aa03cfd96442;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_ppm/trgt_ppm.cpp b/synfig-core/trunk/src/modules/mod_ppm/trgt_ppm.cpp index 74acd44..fe424bc 100644 --- a/synfig-core/trunk/src/modules/mod_ppm/trgt_ppm.cpp +++ b/synfig-core/trunk/src/modules/mod_ppm/trgt_ppm.cpp @@ -1,18 +1,20 @@ -/*! ======================================================================== -** Synfig -** ppm Target Module -** $Id: trgt_ppm.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +/* === S Y N F I G ========================================================= */ +/*! \file trgt_ppm.cpp +** \brief ppm Target Module ** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** \legal +** 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. +** \endlegal ** ** === N O T E S =========================================================== ** @@ -49,7 +51,7 @@ SYNFIG_TARGET_INIT(ppm); SYNFIG_TARGET_SET_NAME(ppm,"ppm"); SYNFIG_TARGET_SET_EXT(ppm,"ppm"); SYNFIG_TARGET_SET_VERSION(ppm,"0.1"); -SYNFIG_TARGET_SET_CVS_ID(ppm,"$Id: trgt_ppm.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $"); +SYNFIG_TARGET_SET_CVS_ID(ppm,"$Id$"); /* === M E T H O D S ======================================================= */ @@ -91,7 +93,7 @@ bool ppm::start_frame(synfig::ProgressCallback *callback) { int w=desc.get_w(),h=desc.get_h(); - + if(filename=="-") { if(callback)callback->task(strprintf("(stdout) %d",imagecount).c_str()); @@ -103,7 +105,7 @@ ppm::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=SmartFILE(fopen(newfilename.c_str(),"wb")); if(callback)callback->task(newfilename); @@ -113,20 +115,20 @@ ppm::start_frame(synfig::ProgressCallback *callback) file=SmartFILE(fopen(filename.c_str(),"wb")); if(callback)callback->task(filename); } - + if(!file) return false; - + fprintf(file.get(), "P6\n"); fprintf(file.get(), "%d %d\n", w, h); - fprintf(file.get(), "%d\n", 255); - + fprintf(file.get(), "%d\n", 255); + delete [] buffer; buffer=new unsigned char[3*w]; delete [] color_buffer; color_buffer=new Color[desc.get_w()]; - + return true; } @@ -143,7 +145,7 @@ ppm::end_scanline() return false; convert_color_format(buffer, color_buffer, desc.get_w(), PF_RGB, gamma()); - + if(!fwrite(buffer,1,desc.get_w()*3,file.get())) return false;