15 #include "pnmFileTypeBMP.h" 19 #include "config_pnmimagetypes.h" 21 #include "pnmFileTypeRegistry.h" 22 #include "bamReader.h" 24 static const char *
const extensions_bmp[] = {
27 static const int num_extensions_bmp =
sizeof(extensions_bmp) /
sizeof(
const char *);
45 string PNMFileTypeBMP::
57 get_num_extensions()
const {
58 return num_extensions_bmp;
68 string PNMFileTypeBMP::
69 get_extension(
int n)
const {
70 nassertr(n >= 0 && n < num_extensions_bmp,
string());
71 return extensions_bmp[n];
81 string PNMFileTypeBMP::
82 get_suggested_extension()
const {
93 has_magic_number()
const {
104 bool PNMFileTypeBMP::
105 matches_magic_number(
const string &magic_number)
const {
106 nassertr(magic_number.size() >= 2,
false);
107 return (magic_number.substr(0, 2) ==
"BM");
118 make_reader(istream *file,
bool owns_file,
const string &magic_number) {
120 return new Reader(
this, file, owns_file, magic_number);
131 make_writer(ostream *file,
bool owns_file) {
133 return new Writer(
this, file, owns_file);
143 void PNMFileTypeBMP::
144 register_with_read_factory() {
146 register_factory(get_class_type(), make_PNMFileTypeBMP);
Base class for objects that can be written to and read from Bam files.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PNMFileType * get_type_by_handle(TypeHandle handle) const
Returns the PNMFileType instance stored in the registry for the given TypeHandle, e...
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...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
TypeHandle is the identifier used to differentiate C++ class types.