15 #ifndef PNMFILETYPEPNG_H 16 #define PNMFILETYPEPNG_H 18 #include "pandabase.h" 25 #include "pnmFileType.h" 26 #include "pnmReader.h" 27 #include "pnmWriter.h" 33 class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypePNG :
public PNMFileType {
37 virtual string get_name()
const;
47 const string &magic_number =
string());
53 Reader(
PNMFileType *type, istream *file,
bool owns_file,
string magic_number);
56 virtual int read_data(
xel *array, xelval *alpha_data);
60 static void png_read_data(png_structp png_ptr, png_bytep data,
63 static void png_error(png_structp png_ptr, png_const_charp error_msg);
64 static void png_warning(png_structp png_ptr, png_const_charp warning_msg);
77 Writer(
PNMFileType *type, ostream *file,
bool owns_file);
80 virtual int write_data(
xel *array, xelval *alpha);
84 static int make_png_bit_depth(
int bit_depth);
85 static void png_write_data(png_structp png_ptr, png_bytep data,
87 static void png_flush_data(png_structp png_ptr);
89 static void png_error(png_structp png_ptr, png_const_charp error_msg);
90 static void png_warning(png_structp png_ptr, png_const_charp warning_msg);
103 static void register_with_read_factory();
112 static void init_type() {
113 PNMFileType::init_type();
114 register_type(_type_handle,
"PNMFileTypePNG",
115 PNMFileType::get_class_type());
118 return get_class_type();
120 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
virtual string get_extension(int n) const
Returns the nth possible filename extension associated with this particular file type, without a leading dot.
virtual PNMWriter * make_writer(ostream *file, bool owns_file=true)
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible...
Base class for objects that can be written to and read from Bam files.
This is the base class of a family of classes that represent particular image file types that PNMImag...
virtual PNMReader * make_reader(istream *file, bool owns_file=true, const string &magic_number=string())
Allocates and returns a new PNMReader suitable for reading from this file type, if possible...
virtual bool matches_magic_number(const string &magic_number) const
Returns true if the indicated "magic number" byte stream (the initial few bytes read from the file) m...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is an abstract base class that defines the interface for reading image files of various types...
This is an abstract base class that defines the interface for writing image files of various types...
virtual bool has_magic_number() const
Returns true if this particular file type uses a magic number to identify it, false otherwise...
TypeHandle is the identifier used to differentiate C++ class types.
virtual int get_num_extensions() const
Returns the number of different possible filename extensions associated with this particular file typ...
virtual string get_suggested_extension() const
Returns a suitable filename extension (without a leading dot) to suggest for files of this type...