Panda3D

pnmReader.h
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pnmReader.h
10 * @author drose
11 * @date 2000-06-14
12 */
13
14 #ifndef PNMREADER_H
15 #define PNMREADER_H
16
17 #include "pandabase.h"
18
19 #include "pnmImageHeader.h"
20 class PfmFile;
21
22 /**
23 * This is an abstract base class that defines the interface for reading image
24 * files of various types. Any particular image file type that can be read
25 * must define a class that inherits from PNMReader to read it.
26 */
27 class EXPCL_PANDA_PNMIMAGE PNMReader : public PNMImageHeader {
28 protected:
29 INLINE PNMReader(PNMFileType *type, std::istream *file, bool owns_file);
30
31 public:
32 virtual ~PNMReader();
33 INLINE void set_read_size(int x_size, int y_size);
34
35 INLINE PNMFileType *get_type() const;
36
37 virtual void prepare_read();
38 virtual bool is_floating_point();
39 virtual bool read_pfm(PfmFile &pfm);
40 virtual int read_data(xel *array, xelval *alpha);
41 virtual bool supports_read_row() const;
42 virtual bool read_row(xel *array, xelval *alpha, int x_size, int y_size);
43
44 virtual bool supports_stream_read() const;
45
46 INLINE bool is_valid() const;
47
48 private:
49 int get_reduction_shift(int orig_size, int new_size);
50
51 protected:
52 PNMFileType *_type;
53 bool _owns_file;
54 std::istream *_file;
55 bool _is_valid;
56
57 int _read_x_size, _read_y_size;
58 bool _has_read_size;
59
60 int _x_shift, _y_shift;
61 int _orig_x_size, _orig_y_size;
62 };
63
64 #include "pnmReader.I"
65
66 #endif
PNMFileType
This is the base class of a family of classes that represent particular image file types that PNMImag...
Definition: pnmFileType.h:32
PNMImageHeader
This is the base class of PNMImage, PNMReader, and PNMWriter.
Definition: pnmImageHeader.h:40
PNMImageHeader::get_type
get_type
If the file type is known (e.g.
Definition: pnmImageHeader.h:85
PNMReader
This is an abstract base class that defines the interface for reading image files of various types.
Definition: pnmReader.h:27
PfmFile
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component,...
Definition: pfmFile.h:31
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnmImageHeader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnmReader.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pixel
Definition: pnmimage_base.h:41