Source: raytracer/ppmoutputstream.h


Annotated List
Files
Globals
Hierarchy
Index
/* *************************************************************************
                          ppmoutputstream.h  -  description
                             -------------------
    begin                : Wed Oct 16 2002    
    copyright            : (C) 2002 by Micha Riser
    email                : mriser@gmx.net
 ************************************************************************* */

/* *************************************************************************
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 ************************************************************************* */

#ifndef PPMOUTPUTSTREAM_H
#define PPMOUTPUTSTREAM_H

#include <string>
#include <set>
using std::set;
using std::string;

#include <stdio.h>

#include "pixeloutputstream.h"
#include "colour.h"

/**Writes a PPM image.
  *@author Micha Riser
  */

class PPMOutputStream : public PixelOutputStream  {
  
public: // Constructors and destructors
    PPMOutputStream(const string& filename, int w, int h);
    ~PPMOutputStream() {};

public: // Public methods
    /**Write pixel to stream. Pixel can come in arbitrary order.
      */
    void putPixel(const Pixel& p);

    /**Finish output.
      */
    void done();

private: // Private attributes
    FILE* ofile;
    int xnext;
    int ynext;
    int width;
    int height;
    set<Pixel> buffer;
    
private: // Private methods
    void writeColour(const Colour3& c);
    void next();      
};

#endif

Generated by: micha@laptop on Thu Oct 24 20:25:24 2002, using kdoc 2.0a53.