core/vil1/file_formats/vil1_png.h

Go to the documentation of this file.
00001 // This is core/vil1/file_formats/vil1_png.h
00002 #ifndef vil1_png_file_format_h_
00003 #define vil1_png_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author   awf@robots.ox.ac.uk
00010 // \date 17 Feb 00
00011 //
00012 //\verbatim
00013 //  Modifications
00014 //  3 October 2001 Peter Vanroose - Implemented get_property("top_row_first")
00015 //\endverbatim
00016 
00017 #include <vil1/vil1_file_format.h>
00018 #include <vil1/vil1_image_impl.h>
00019 
00020 struct vil1_png_structures;
00021 
00022 //: Portable network graphics, http://www.cdrom.com/pub/png
00023 class vil1_png_file_format : public vil1_file_format
00024 {
00025  public:
00026   virtual char const* tag() const;
00027   virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00028   virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00029                                              int width,
00030                                              int height,
00031                                              int components,
00032                                              int bits_per_component,
00033                                              vil1_component_format format);
00034 };
00035 
00036 //: Generic image implementation for PNG files
00037 class vil1_png_generic_image : public vil1_image_impl
00038 {
00039   vil1_stream* vs_;
00040   int width_;
00041   int height_;
00042   int components_;
00043   int bits_per_component_;
00044 
00045   int start_of_data_;
00046 
00047   bool read_header();
00048   bool write_header();
00049 
00050   friend class vil1_png_file_format;
00051   vil1_png_structures* p;
00052  public:
00053 
00054   vil1_png_generic_image(vil1_stream* is);
00055   vil1_png_generic_image(vil1_stream* is, int planes,
00056                          int width,
00057                          int height,
00058                          int components,
00059                          int bits_per_component,
00060                          vil1_component_format format);
00061   ~vil1_png_generic_image();
00062 
00063   //: Dimensions.  Planes x W x H x Components
00064   virtual int planes() const { return 1; }
00065   virtual int width() const { return width_; }
00066   virtual int height() const { return height_; }
00067   virtual int components() const { return components_; }
00068 
00069   virtual int bits_per_component() const { return bits_per_component_; }
00070   virtual enum vil1_component_format component_format() const { return VIL1_COMPONENT_FORMAT_UNSIGNED_INT; }
00071 
00072   //: Copy this to BUF,
00073   virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00074   virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00075 
00076   //: Return the image interpreted as rgb bytes.
00077   //virtual bool get_section_rgb_byte(void* buf, int x0, int y0, int width, int height) const;
00078   //virtual bool get_section_float(void* buf, int x0, int y0, int width, int height) const;
00079   //virtual bool get_section_byte(void* buf, int x0, int y0, int width, int height) const;
00080 
00081   char const* file_format() const;
00082   bool get_property(char const *tag, void *prop = 0) const;
00083   vil1_image get_plane(unsigned int p) const;
00084 };
00085 
00086 #endif // vil1_png_file_format_h_

Generated on Sat Nov 22 05:08:28 2008 for core/vil1 by  doxygen 1.5.1