15 #include "config_pnmimagetypes.h" 16 #include "pnmFileTypeSGI.h" 17 #include "pnmFileTypeTGA.h" 18 #include "pnmFileTypeIMG.h" 19 #include "pnmFileTypeSoftImage.h" 20 #include "pnmFileTypeBMP.h" 21 #include "pnmFileTypeJPG.h" 22 #include "pnmFileTypePNG.h" 23 #include "pnmFileTypePNM.h" 24 #include "pnmFileTypePfm.h" 25 #include "pnmFileTypeTIFF.h" 28 #include "config_pnmimage.h" 29 #include "pnmFileTypeRegistry.h" 30 #include "string_utils.h" 32 #include "pandaSystem.h" 34 Configure(config_pnmimagetypes);
35 NotifyCategoryDefName(pnmimage_sgi,
"sgi", pnmimage_cat);
36 NotifyCategoryDefName(pnmimage_tga,
"tga", pnmimage_cat);
37 NotifyCategoryDefName(pnmimage_img,
"img", pnmimage_cat);
38 NotifyCategoryDefName(pnmimage_soft,
"soft", pnmimage_cat);
39 NotifyCategoryDefName(pnmimage_bmp,
"bmp", pnmimage_cat);
40 NotifyCategoryDefName(pnmimage_jpg,
"jpg", pnmimage_cat);
41 NotifyCategoryDefName(pnmimage_png,
"png", pnmimage_cat);
42 NotifyCategoryDefName(pnmimage_pnm,
"pnm", pnmimage_cat);
43 NotifyCategoryDefName(pnmimage_tiff,
"tiff", pnmimage_cat);
46 (
"sgi-storage-type", SST_rle,
47 PRC_DESC(
"Use either 'rle' or 'verbatim' to indicate how SGI (*.rgb) " 48 "files are written."));
51 PRC_DESC(
"This string is written to the header of an SGI (*.rgb) file. " 52 "It seems to have documentation purposes only."));
60 PRC_DESC(
"Set this true to enable RLE compression when writing TGA files."));
63 (
"tga-colormap",
false,
64 PRC_DESC(
"Set this true to write colormapped TGA files."));
67 (
"tga-grayscale",
false,
68 PRC_DESC(
"Set this true to enable writing grayscale TGA files."));
71 (
"img-header-type", IHT_short,
72 PRC_DESC(
"IMG format is just a sequential string of r, g, b bytes. However, " 73 "it may or may not include a \"header\" which consists of the xsize " 74 "and the ysize of the image, either as shorts or as longs. Specify " 75 "that with this variable, either 'short', 'long', or 'none' for " 76 "no header at all (in which case you should also set img-size)."));
80 PRC_DESC(
"If an IMG file without a header is loaded (e.g. img-header-type " 81 "is set to 'none', this specifies the fixed x y size of the image."));
84 PRC_DESC(
"Set this to the quality percentage for writing JPEG files. 95 is " 85 "the highest useful value (values greater than 95 do not lead to " 86 "significantly better quality, but do lead to significantly greater " 91 PRC_DESC(
"Set this true to allow writing palette-based PNG images when possible."));
96 PRC_DESC(
"This controls how many bits per pixel are written out for BMP " 97 "files. If this is zero, the default, the number of bits per pixel " 98 "is based on the image."));
101 operator << (ostream &out, SGIStorageType sst) {
106 return out <<
"verbatim";
109 return out <<
"**invalid SGIStorageType(" << (int)sst <<
")**";
113 operator >> (istream &in, SGIStorageType &sst) {
117 if (cmp_nocase(word,
"rle") == 0) {
119 }
else if (cmp_nocase(word,
"verbatim") == 0) {
122 pnmimage_img_cat->error()
123 <<
"Invalid SGIStorageType: " << word <<
"\n";
131 operator << (ostream &out, IMGHeaderType iht) {
134 return out <<
"none";
136 return out <<
"short";
138 return out <<
"long";
141 return out <<
"**invalid IMGHeaderType(" << (int)iht <<
")**";
145 operator >> (istream &in, IMGHeaderType &iht) {
149 if (cmp_nocase(word,
"none") == 0) {
151 }
else if (cmp_nocase(word,
"short") == 0) {
153 }
else if (cmp_nocase(word,
"long") == 0) {
156 pnmimage_img_cat->error()
157 <<
"Invalid IMGHeaderType: " << word <<
"\n";
164 ConfigureFn(config_pnmimagetypes) {
165 init_libpnmimagetypes();
177 init_libpnmimagetypes() {
178 static bool initialized =
false;
189 PNMFileTypeSGI::init_type();
190 PNMFileTypeSGI::register_with_read_factory();
195 PNMFileTypeTGA::init_type();
196 PNMFileTypeTGA::register_with_read_factory();
201 PNMFileTypeIMG::init_type();
202 PNMFileTypeIMG::register_with_read_factory();
206 #ifdef HAVE_SOFTIMAGE_PIC 207 PNMFileTypeSoftImage::init_type();
208 PNMFileTypeSoftImage::register_with_read_factory();
210 #endif // HAVE_SOFTIMAGE_PIC 213 PNMFileTypeBMP::init_type();
214 PNMFileTypeBMP::register_with_read_factory();
219 PNMFileTypePNM::init_type();
220 PNMFileTypePNM::register_with_read_factory();
224 PNMFileTypePfm::init_type();
229 PNMFileTypeJPG::init_type();
230 PNMFileTypeJPG::register_with_read_factory();
235 PNMFileTypePNG::init_type();
236 PNMFileTypePNG::register_with_read_factory();
241 PNMFileTypeTIFF::init_type();
242 PNMFileTypeTIFF::register_with_read_factory();
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
This is a convenience class to specialize ConfigVariable as a boolean type.
void add_system(const string &system)
Intended for use by each subsystem to register itself at startup.
static PNMFileTypeRegistry * get_global_ptr()
Returns a pointer to the global PNMFileTypeRegistry object.
This is a convenience class to specialize ConfigVariable as a string type.
This class specializes ConfigVariable as an enumerated type.
For reading and writing PFM files using the basic PNMImage interface, as if they were basic RGB files...
This class maintains the set of all known PNMFileTypes in the universe.
This is a convenience class to specialize ConfigVariable as an integer type.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
void register_type(PNMFileType *type)
Defines a new PNMFileType in the universe.