Panda3D
Public Member Functions | List of all members
PNMFileTypePfm::Reader Class Reference
Inheritance diagram for PNMFileTypePfm::Reader:
PNMReader PNMImageHeader

Public Member Functions

 Reader (PNMFileType *type, istream *file, bool owns_file, string magic_number)
 
virtual bool is_floating_point ()
 Returns true if this PNMFileType represents a floating-point image type, false if it is a normal, integer type. More...
 
virtual bool read_pfm (PfmFile &pfm)
 Reads floating-point data directly into the indicated PfmFile. More...
 
- Public Member Functions inherited from PNMReader
PNMFileTypeget_type () const
 Returns a pointer to the PNMFileType object that created this PNMReader. More...
 
bool is_valid () const
 Returns true if the PNMReader can be used to read data, false if something is wrong. More...
 
virtual void prepare_read ()
 This method will be called before read_data() or read_row() is called. More...
 
virtual int read_data (xel *array, xelval *alpha)
 Reads in an entire image all at once, storing it in the pre-allocated _x_size * _y_size array and alpha pointers. More...
 
virtual bool read_row (xel *array, xelval *alpha, int x_size, int y_size)
 If supports_read_row(), above, returns true, this function may be called repeatedly to read the image, one horizontal row at a time, beginning from the top. More...
 
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. More...
 
virtual bool supports_read_row () const
 Returns true if this particular PNMReader is capable of returning the data one row at a time, via repeated calls to read_row(). More...
 
virtual bool supports_stream_read () const
 Returns true if this particular PNMReader can read from a general stream (including pipes, etc.), or false if the reader must occasionally fseek() on its input stream, and thus only disk streams are supported. More...
 
- Public Member Functions inherited from PNMImageHeader
 PNMImageHeader (const PNMImageHeader &copy)
 
ColorSpace get_color_space () const
 Returns the color space that the image is encoded in, or CS_unspecified if unknown. More...
 
ColorType get_color_type () const
 Returns the image type of the image, as an enumerated value. More...
 
string get_comment () const
 Gets the user comment from the file. More...
 
xelval get_maxval () const
 Returns the maximum channel value allowable for any pixel in this image; for instance, 255 for a typical 8-bit-per-channel image. More...
 
int get_num_channels () const
 Returns the number of channels in the image. More...
 
PNMFileTypeget_type () const
 If the file type is known (e.g. More...
 
int get_x_size () const
 Returns the number of pixels in the X direction. More...
 
int get_y_size () const
 Returns the number of pixels in the Y direction. More...
 
bool has_alpha () const
 Returns true if the image includes an alpha channel, false otherwise. More...
 
bool has_type () const
 Returns true if the PNMImageHeader knows what type it is, false otherwise. More...
 
bool is_grayscale () const
 Returns false if the image is a full-color image, and has red, green, and blue components; true if it is a grayscale image and has only a gray component. More...
 
PNMReadermake_reader (const Filename &filename, PNMFileType *type=NULL, bool report_unknown_type=true) const
 Returns a newly-allocated PNMReader of the suitable type for reading from the indicated image filename, or NULL if the filename cannot be read for some reason. More...
 
PNMReadermake_reader (istream *file, bool owns_file=true, const Filename &filename=Filename(), string magic_number=string(), PNMFileType *type=NULL, bool report_unknown_type=true) const
 Returns a newly-allocated PNMReader of the suitable type for reading from the already-opened image file, or NULL if the file cannot be read for some reason. More...
 
PNMWritermake_writer (const Filename &filename, PNMFileType *type=NULL) const
 Returns a newly-allocated PNMWriter of the suitable type for writing an image to the indicated filename, or NULL if the filename cannot be written for some reason. More...
 
PNMWritermake_writer (ostream *file, bool owns_file=true, const Filename &filename=Filename(), PNMFileType *type=NULL) const
 Returns a newly-allocated PNMWriter of the suitable type for writing to the already-opened image file, or NULL if the file cannot be written for some reason. More...
 
void operator= (const PNMImageHeader &copy)
 
void output (ostream &out) const
 
bool read_header (const Filename &filename, PNMFileType *type=NULL, bool report_unknown_type=true)
 Opens up the image file and tries to read its header information to determine its size, number of channels, etc. More...
 
bool read_header (istream &data, const string &filename=string(), PNMFileType *type=NULL, bool report_unknown_type=true)
 Reads the image header information only from the indicated stream. More...
 
void set_comment (const string &comment)
 Writes a user comment string to the image (header). More...
 
void set_type (PNMFileType *type)
 Sets the file type of this PNMImage. More...
 

Additional Inherited Members

- Public Types inherited from PNMImageHeader
enum  ColorType {
  CT_invalid = 0, CT_grayscale = 1, CT_two_channel = 2, CT_color = 3,
  CT_four_channel = 4
}
 
typedef pmap< PixelSpec, int > HistMap
 
typedef pvector< PixelSpecPalette
 
typedef pvector< PixelSpecCountPixelCount
 
- Static Public Member Functions inherited from PNMImageHeader
static bool has_alpha (ColorType color_type)
 This static variant of has_alpha() returns true if the indicated image type includes an alpha channel, false otherwise. More...
 
static bool is_grayscale (ColorType color_type)
 This static variant of is_grayscale() returns true if the indicated image type represents a grayscale image, false otherwise. More...
 
static bool read_magic_number (istream *file, string &magic_number, int num_bytes)
 Ensures that the first n bytes of the file are read into magic_number. More...
 

Detailed Description

Definition at line 48 of file pnmFileTypePfm.h.

Member Function Documentation

◆ is_floating_point()

bool PNMFileTypePfm::Reader::is_floating_point ( )
virtual

Returns true if this PNMFileType represents a floating-point image type, false if it is a normal, integer type.

If this returns true, read_pfm() is implemented instead of read_data().

Reimplemented from PNMReader.

Definition at line 192 of file pnmFileTypePfm.cxx.

References read_pfm().

Referenced by PNMFileTypePfm::make_writer().

◆ read_pfm()

bool PNMFileTypePfm::Reader::read_pfm ( PfmFile pfm)
virtual

Reads floating-point data directly into the indicated PfmFile.

Returns true on success, false on failure.

Reimplemented from PNMReader.

Definition at line 203 of file pnmFileTypePfm.cxx.

References PfmFile::clear(), PfmFile::set_scale(), ReversedNumericData::store_value(), and PNMFileTypePfm::Writer::supports_floating_point().

Referenced by is_floating_point().


The documentation for this class was generated from the following files: