PNG.cpp File Reference


Detailed Description

Create PNG images. Class defintions.

============================================================================

This file is part of GPSTk, the GPS Toolkit.

The GPSTk is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or any later version.

The GPSTk 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with GPSTk; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Copyright 2004, The University of Texas at Austin

============================================================================

# 27 "/home/gpstk/dev/lib/vdraw/PNG.cpp" 2

namespace vdraw { const std::string PNG::header = "\211PNG\r\n\032\n";

std::string PNG::png(const Bitmap &b) { InterpolatedColorMap icm; ColorMap cm; if(b.getICM(&icm)) { return *png(icm,b.osr,b.osc); } else if(b.getCM(&cm)) { return *png(cm,b.osr,b.osc); } else { printf("PNG::png(const Bitmap &b); Invalid Bitmap.\n"); exit(1); } }

PNG::string_ptr PNG::png(const ColorMap &c, int osr, int osc) { std::stringstream s; s << header << *ihdr_full(c.getCols()*osc,c.getRows()*osr) << *srgb() << phys() << *idat(c,osr,osc) << *iend(); return string_ptr(new std::string(s.str())); }

PNG::string_ptr PNG::png(const InterpolatedColorMap &c, int osr, int osc) { std::stringstream s; s << header << *ihdr_indexed(c.getCols()*osc,c.getRows()*osr) << *srgb() << phys() << *plte(c) << *idat(c,osr,osc) << *iend(); return string_ptr(new std::string(s.str())); }

/* TODO Future ideas for optimization -- Indexed Color Map When it is optimal to use the non-indexed version, by these simple calculations then it would be worthwhile to make an indexed color map which might end up with far fewer colors to index

Definition in file PNG.cpp.

#include "PNG.hpp"
#include <cstdio>

Include dependency graph for PNG.cpp:

Include dependency graph

Go to the source code of this file.


Generated on Wed Sep 8 03:31:17 2010 for GPS ToolKit Software Library by  doxygen 1.3.9.1