14 #ifndef PNMFILETYPETIFF_H 15 #define PNMFILETYPETIFF_H 28 #define TIFF_COLORMAP_MAXCOLORS 1024 33 class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeTIFF :
public PNMFileType {
37 virtual std::string get_name()
const;
39 virtual int get_num_extensions()
const;
41 virtual std::string get_suggested_extension()
const;
47 const std::string &magic_number = std::string());
53 Reader(
PNMFileType *type, std::istream *file,
bool owns_file, std::string magic_number);
56 virtual bool is_floating_point();
57 virtual bool read_pfm(
PfmFile &pfm);
58 virtual bool supports_read_row()
const;
59 virtual bool read_row(
xel *array, xelval *alpha,
int x_size,
int y_size);
62 xelval next_sample_lt_8(
unsigned char *&buf_ptr,
int &bits_left)
const;
63 xelval next_sample_8(
unsigned char *&buf_ptr,
int &bits_left)
const;
64 xelval next_sample_16(
unsigned char *&buf_ptr,
int &bits_left)
const;
65 xelval next_sample_32(
unsigned char *&buf_ptr,
int &bits_left)
const;
66 xelval next_sample_general(
unsigned char *&buf_ptr,
int &bits_left)
const;
68 unsigned short sample_format;
69 unsigned short photomet;
70 unsigned short bps, spp;
71 unsigned short unassoc_alpha_sample, assoc_alpha_sample;
72 xel colormap[TIFF_COLORMAP_MAXCOLORS];
80 Writer(
PNMFileType *type, std::ostream *file,
bool owns_file);
82 virtual bool supports_floating_point();
83 virtual bool supports_integer();
84 virtual bool write_pfm(
const PfmFile &pfm);
85 virtual int write_data(
xel *array, xelval *alpha);
89 static void install_error_handlers();
91 static void tiff_warning(
const char *module,
const char *format, va_list ap);
92 static void tiff_error(
const char *module,
const char *format, va_list ap);
93 static bool _installed_error_handlers;
97 static void register_with_read_factory();
106 static void init_type() {
107 PNMFileType::init_type();
109 PNMFileType::get_class_type());
112 return get_class_type();
114 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
virtual PNMReader * make_reader(std::istream *file, bool owns_file=true, const std::string &magic_number=std::string())
Allocates and returns a new PNMReader suitable for reading from this file type, if possible.
Base class for objects that can be written to and read from Bam files.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class of a family of classes that represent particular image file types that PNMImag...
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component,...
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.
get_extension
Returns the nth possible filename extension associated with this particular file type,...
This is an abstract base class that defines the interface for writing image files of various types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool matches_magic_number(const std::string &magic_number) const
Returns true if the indicated "magic number" byte stream (the initial few bytes read from the file) m...
virtual bool has_magic_number() const
Returns true if this particular file type uses a magic number to identify it, false otherwise.
virtual PNMWriter * make_writer(std::ostream *file, bool owns_file=true)
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.