Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pnmimage/pnmWriter.h

Go to the documentation of this file.
00001 // Filename: pnmWriter.h
00002 // Created by:  drose (14Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef PNMWRITER_H
00020 #define PNMWRITER_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "pnmImageHeader.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : PNMWriter
00028 // Description : This is an abstract base class that defines the
00029 //               interface for writing image files of various types.
00030 //               Any particular image file type that can be written
00031 //               must define a class that inherits from PNMWriter to
00032 //               write it.
00033 ////////////////////////////////////////////////////////////////////
00034 class EXPCL_PANDA PNMWriter : public PNMImageHeader {
00035 protected:
00036   INLINE PNMWriter(PNMFileType *type, ostream *file, bool owns_file);
00037 
00038 public:
00039 
00040   // It is important to delete the PNMWriter class after successfully
00041   // writing the data.  Failing to do this may result in some data not
00042   // getting flushed!
00043   virtual ~PNMWriter();
00044 
00045   INLINE PNMFileType *get_type() const;
00046 
00047   INLINE void set_color_type(ColorType type);
00048   INLINE void set_num_channels(int num_channels);
00049   INLINE void set_maxval(xelval maxval);
00050   INLINE void set_x_size(int x_size);
00051   INLINE void set_y_size(int y_size);
00052 
00053   INLINE void copy_header_from(const PNMImageHeader &header);
00054 
00055   virtual int write_data(xel *array, xelval *alpha);
00056   virtual bool supports_write_row() const;
00057   virtual bool write_header();
00058   virtual bool write_row(xel *array, xelval *alpha);
00059 
00060   virtual bool supports_stream_write() const;
00061 
00062 protected:
00063   PNMFileType *_type;
00064   bool _owns_file;
00065   ostream *_file;
00066 };
00067 
00068 #include "pnmWriter.I"
00069 
00070 #endif

Generated on Fri May 2 00:43:10 2003 for Panda by doxygen1.3