Panda3D
|
00001 // Filename: pnmReader.I 00002 // Created by: drose (16Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 //////////////////////////////////////////////////////////////////// 00016 // Function: PNMReader::Constructor 00017 // Access: Protected 00018 // Description: 00019 //////////////////////////////////////////////////////////////////// 00020 INLINE PNMReader:: 00021 PNMReader(PNMFileType *type, istream *file, bool owns_file) : 00022 _type(type), 00023 _owns_file(owns_file), 00024 _file(file), 00025 _is_valid(true), 00026 _has_read_size(false) 00027 { 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: PNMReader::set_read_size 00032 // Access: Public 00033 // Description: Instructs the reader to attempt to scale the image to 00034 // the indicated size while reading it. The reader may 00035 // or may not follow this suggestion, or may follow it 00036 // only partially (e.g. by reading a file which is 00037 // slightly reduced in size, but not the precise size 00038 // requested). 00039 //////////////////////////////////////////////////////////////////// 00040 void PNMReader:: 00041 set_read_size(int x_size, int y_size) { 00042 _read_x_size = x_size; 00043 _read_y_size = y_size; 00044 _has_read_size = true; 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: PNMReader::get_type 00049 // Access: Public 00050 // Description: Returns a pointer to the PNMFileType object that 00051 // created this PNMReader. 00052 //////////////////////////////////////////////////////////////////// 00053 INLINE PNMFileType *PNMReader:: 00054 get_type() const { 00055 return _type; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: PNMReader::is_valid 00060 // Access: Public 00061 // Description: Returns true if the PNMReader can be used to read 00062 // data, false if something is wrong. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE bool PNMReader:: 00065 is_valid() const { 00066 return _is_valid; 00067 }