Panda3D
 All Classes Functions Variables Enumerations
pnmReader.I
1 // Filename: pnmReader.I
2 // Created by: drose (16Jun00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: PNMReader::Constructor
17 // Access: Protected
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE PNMReader::
21 PNMReader(PNMFileType *type, istream *file, bool owns_file) :
22  _type(type),
23  _owns_file(owns_file),
24  _file(file),
25  _is_valid(true),
26  _has_read_size(false)
27 {
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: PNMReader::set_read_size
32 // Access: Public
33 // Description: Instructs the reader to attempt to scale the image to
34 // the indicated size while reading it. The reader may
35 // or may not follow this suggestion, or may follow it
36 // only partially (e.g. by reading a file which is
37 // slightly reduced in size, but not the precise size
38 // requested).
39 ////////////////////////////////////////////////////////////////////
40 void PNMReader::
41 set_read_size(int x_size, int y_size) {
42  _read_x_size = x_size;
43  _read_y_size = y_size;
44  _has_read_size = true;
45 }
46 
47 ////////////////////////////////////////////////////////////////////
48 // Function: PNMReader::get_type
49 // Access: Public
50 // Description: Returns a pointer to the PNMFileType object that
51 // created this PNMReader.
52 ////////////////////////////////////////////////////////////////////
54 get_type() const {
55  return _type;
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: PNMReader::is_valid
60 // Access: Public
61 // Description: Returns true if the PNMReader can be used to read
62 // data, false if something is wrong.
63 ////////////////////////////////////////////////////////////////////
64 INLINE bool PNMReader::
65 is_valid() const {
66  return _is_valid;
67 }
void set_read_size(int x_size, int y_size)
Instructs the reader to attempt to scale the image to the indicated size while reading it...
Definition: pnmReader.I:41
This is the base class of a family of classes that represent particular image file types that PNMImag...
Definition: pnmFileType.h:35
PNMFileType * get_type() const
Returns a pointer to the PNMFileType object that created this PNMReader.
Definition: pnmReader.I:54
bool is_valid() const
Returns true if the PNMReader can be used to read data, false if something is wrong.
Definition: pnmReader.I:65