25 static const char *
const extensions_jpg[] = {
28 static const int num_extensions_jpg =
sizeof(extensions_jpg) /
sizeof(
const char *);
42 string PNMFileTypeJPG::
52 get_num_extensions()
const {
53 return num_extensions_jpg;
60 string PNMFileTypeJPG::
61 get_extension(
int n)
const {
62 nassertr(n >= 0 && n < num_extensions_jpg,
string());
63 return extensions_jpg[n];
70 string PNMFileTypeJPG::
71 get_suggested_extension()
const {
80 has_magic_number()
const {
90 matches_magic_number(
const string &magic_number)
const {
91 nassertr(magic_number.size() >= 2,
false);
92 return ((
char)magic_number[0] == (
char)0xff &&
93 (
char)magic_number[1] == (
char)0xd8);
102 make_reader(std::istream *file,
bool owns_file,
const string &magic_number) {
104 return new Reader(
this, file, owns_file, magic_number);
113 make_writer(std::ostream *file,
bool owns_file) {
115 return new Writer(
this, file, owns_file);
122 void PNMFileTypeJPG::
123 register_with_read_factory() {
125 register_factory(get_class_type(), make_PNMFileTypeJPG);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
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....
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
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.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.