Go to the documentation of this file.00001
00002 #ifndef vil_png_file_format_h_
00003 #define vil_png_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vil/vil_file_format.h>
00019 #include <vil/vil_image_resource.h>
00020
00021 struct vil_png_structures;
00022
00023
00024 class vil_png_file_format : public vil_file_format
00025 {
00026 public:
00027 virtual char const* tag() const;
00028 virtual vil_image_resource_sptr make_input_image(vil_stream* vs);
00029 virtual vil_image_resource_sptr make_output_image(vil_stream* vs,
00030 unsigned nx,
00031 unsigned ny,
00032 unsigned nplanes,
00033 enum vil_pixel_format);
00034 };
00035
00036
00037 class vil_png_image : public vil_image_resource
00038 {
00039 vil_stream* vs_;
00040 int width_;
00041 int height_;
00042 int components_;
00043 int bits_per_component_;
00044 vil_pixel_format format_;
00045 int start_of_data_;
00046
00047 bool read_header();
00048 bool write_header();
00049
00050 friend class vil_png_file_format;
00051 vil_png_structures* p_;
00052 public:
00053
00054 vil_png_image(vil_stream* is);
00055 vil_png_image(vil_stream* is, unsigned ni,
00056 unsigned nj, unsigned nplanes,
00057 vil_pixel_format format);
00058 ~vil_png_image();
00059
00060
00061 virtual unsigned nplanes() const { return components_;}
00062 virtual unsigned ni() const { return width_; }
00063 virtual unsigned nj() const { return height_; }
00064
00065 virtual enum vil_pixel_format pixel_format() const {return format_;}
00066
00067
00068
00069 virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00070 unsigned j0, unsigned nj) const;
00071
00072
00073 virtual bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0);
00074
00075 char const* file_format() const;
00076 bool get_property(char const *tag, void *prop = 0) const;
00077 };
00078
00079 #endif // vil_png_file_format_h_