00001 /* ************************************************************************* 00002 ppmoutputstream.h - description 00003 ------------------- 00004 begin : Wed Oct 16 2002 00005 copyright : (C) 2002 by Micha Riser 00006 email : mriser@gmx.net 00007 00008 $Id: ppmoutputstream_8h-source.html,v 1.1 2005/02/04 21:02:27 micha Exp $ 00009 00010 ************************************************************************* */ 00011 00012 /* ************************************************************************* 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 ************************************************************************* */ 00020 00021 #ifndef PPMOUTPUTSTREAM_H 00022 #define PPMOUTPUTSTREAM_H 00023 00024 #include <string> 00025 #include <set> 00026 #include <stdio.h> 00027 00028 #include "pixeloutputstream.h" 00029 #include "colour.h" 00030 00035 class PPMOutputStream : public PixelOutputStream { 00036 00037 public: // Constructors and destructors 00038 PPMOutputStream(const std::string& filename, int w, int h); 00039 ~PPMOutputStream() {}; 00040 00041 public: // Public methods 00044 void putPixel(const Pixel& p); 00045 00048 void done(); 00049 00050 private: // Private attributes 00051 FILE* ofile; 00052 int xnext; 00053 int ynext; 00054 int width; 00055 int height; 00056 std::set<Pixel> buffer; 00057 00058 private: // Private methods 00059 void writeColour(const Colour& c); 00060 void next(); 00061 }; 00062 00063 #endif
1.3.8