15 #include "pnmFileTypeJPG.h"
19 #include "config_pnmimagetypes.h"
21 #include "pnmFileTypeRegistry.h"
22 #include "bamReader.h"
24 static const char *
const extensions_jpg[] = {
27 static const int num_extensions_jpg =
sizeof(extensions_jpg) /
sizeof(
const char *);
45 string PNMFileTypeJPG::
57 get_num_extensions()
const {
58 return num_extensions_jpg;
68 string PNMFileTypeJPG::
69 get_extension(
int n)
const {
70 nassertr(n >= 0 && n < num_extensions_jpg,
string());
71 return extensions_jpg[n];
81 string PNMFileTypeJPG::
82 get_suggested_extension()
const {
93 has_magic_number()
const {
104 bool PNMFileTypeJPG::
105 matches_magic_number(
const string &magic_number)
const {
106 nassertr(magic_number.size() >= 2,
false);
107 return ((
char)magic_number[0] == (char)0xff &&
108 (
char)magic_number[1] == (char)0xd8);
119 make_reader(istream *file,
bool owns_file,
const string &magic_number) {
121 return new Reader(
this, file, owns_file, magic_number);
132 make_writer(ostream *file,
bool owns_file) {
134 return new Writer(
this, file, owns_file);
144 void PNMFileTypeJPG::
145 register_with_read_factory() {
147 register_factory(get_class_type(), make_PNMFileTypeJPG);
PNMFileType * get_type_by_handle(TypeHandle handle) const
Returns the PNMFileType instance stored in the registry for the given TypeHandle, e...
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...
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.