vil_png.h
Go to the documentation of this file.
1 // This is core/vil/file_formats/vil_png.h
2 #ifndef vil_png_file_format_h_
3 #define vil_png_file_format_h_
4 //:
5 // \file
6 // \author awf@robots.ox.ac.uk
7 // \date 17 Feb 00
8 //
9 //\verbatim
10 // Modifications
11 // 3 October 2001 Peter Vanroose - Implemented get_property("top_row_first")
12 // 13 November 2002 Ian Scott - Converted to vil
13 //\endverbatim
14 
15 #include <vil/vil_file_format.h>
16 #include <vil/vil_image_resource.h>
17 
18 struct vil_png_structures;
19 
20 //: Portable network graphics, http://www.cdrom.com/pub/png
22 {
23  public:
24  char const* tag() const override;
27  unsigned nx,
28  unsigned ny,
29  unsigned nplanes,
30  enum vil_pixel_format) override;
31 };
32 
33 //: Generic image implementation for PNG files
35 {
37  int width_;
38  int height_;
42 
43  bool read_header();
44  bool write_header();
45 
46  friend class vil_png_file_format;
48  public:
49 
51  vil_png_image(vil_stream* is, unsigned ni,
52  unsigned nj, unsigned nplanes,
53  vil_pixel_format format);
54  ~vil_png_image() override;
55 
56  //: Dimensions: planes x width x height x components
57  unsigned nplanes() const override { return components_;}
58  unsigned ni() const override { return width_; }
59  unsigned nj() const override { return height_; }
60 
61  enum vil_pixel_format pixel_format() const override {return format_;}
62 
63  //: Create a read/write view of a copy of this data.
64  // \return 0 if unable to get view of correct size.
65  vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
66  unsigned j0, unsigned nj) const override;
67 
68  //: Put the data in this view back into the image source.
69  bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0) override;
70 
71  char const* file_format() const override;
72  bool get_property(char const *tag, void *prop = nullptr) const override;
73 };
74 
75 #endif // vil_png_file_format_h_
vil_image_resource_sptr make_input_image(vil_stream *vs) override
Attempt to make a generic_image which will read from vil_stream vs.
Definition: vil_png.cxx:41
An abstract base class of smart pointers to actual image data in memory.
vil_pixel_format
Describes the type of the concrete data.
unsigned nplanes() const override
Dimensions: planes x width x height x components.
Definition: vil_png.h:57
vil_stream * vs_
Definition: vil_png.h:36
bool get_property(char const *tag, void *prop=nullptr) const override
Extra property information.
Definition: vil_png.cxx:279
int bits_per_component_
Definition: vil_png.h:40
vil_png_image(vil_stream *is)
Definition: vil_png.cxx:271
bool write_header()
Definition: vil_png.cxx:417
int components_
Definition: vil_png.h:39
int height_
Definition: vil_png.h:38
int width_
Definition: vil_png.h:37
Base class for image formats.
bool put_view(const vil_image_view_base &im, unsigned i0, unsigned j0) override
Put the data in this view back into the image source.
Definition: vil_png.cxx:538
vil_png_structures * p_
Definition: vil_png.h:47
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
Generic image implementation for PNG files.
Definition: vil_png.h:34
Portable network graphics, http://www.cdrom.com/pub/png.
Definition: vil_png.h:21
bool read_header()
Definition: vil_png.cxx:325
Abstract representation of an image source or image destination.
unsigned nj() const override
Dimensions: Planes x ni x nj.
Definition: vil_png.h:59
vil_image_view_base_sptr get_copy_view() const
Create a read/write view of a copy of all the data.
enum vil_pixel_format pixel_format() const override
Pixel Format.
Definition: vil_png.h:61
unsigned ni() const override
Dimensions: Planes x ni x nj.
Definition: vil_png.h:58
vil_image_resource_sptr make_output_image(vil_stream *vs, unsigned nx, unsigned ny, unsigned nplanes, enum vil_pixel_format) override
Make a "generic_image" on which put_section may be applied.
Definition: vil_png.cxx:56
vil_pixel_format format_
Definition: vil_png.h:41
Representation of a generic image source or destination.
Base class for image formats.
char const * tag() const override
Return a character string which uniquely identifies this format.
Definition: vil_png.cxx:75
~vil_png_image() override
Definition: vil_png.cxx:313
char const * file_format() const override
Return a string describing the file format.
Definition: vil_png.cxx:320