35 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PNMIMAGETYPES)
36 #error Buildsystem error: BUILDING_PANDA_PNMIMAGETYPES not defined
43 Configure(config_pnmimagetypes);
44 NotifyCategoryDefName(pnmimage_sgi,
"sgi", pnmimage_cat);
45 NotifyCategoryDefName(pnmimage_tga,
"tga", pnmimage_cat);
46 NotifyCategoryDefName(pnmimage_img,
"img", pnmimage_cat);
47 NotifyCategoryDefName(pnmimage_soft,
"soft", pnmimage_cat);
48 NotifyCategoryDefName(pnmimage_bmp,
"bmp", pnmimage_cat);
49 NotifyCategoryDefName(pnmimage_jpg,
"jpg", pnmimage_cat);
50 NotifyCategoryDefName(pnmimage_png,
"png", pnmimage_cat);
51 NotifyCategoryDefName(pnmimage_pnm,
"pnm", pnmimage_cat);
52 NotifyCategoryDefName(pnmimage_tiff,
"tiff", pnmimage_cat);
53 NotifyCategoryDefName(pnmimage_exr,
"exr", pnmimage_cat);
56 (
"sgi-storage-type", SST_rle,
57 PRC_DESC(
"Use either 'rle' or 'verbatim' to indicate how SGI (*.rgb) "
58 "files are written."));
61 PRC_DESC(
"This string is written to the header of an SGI (*.rgb) file. "
62 "It seems to have documentation purposes only."));
70 PRC_DESC(
"Set this true to enable RLE compression when writing TGA files."));
73 (
"tga-colormap",
false,
74 PRC_DESC(
"Set this true to write colormapped TGA files."));
77 (
"tga-grayscale",
false,
78 PRC_DESC(
"Set this true to enable writing grayscale TGA files."));
81 (
"img-header-type", IHT_short,
82 PRC_DESC(
"IMG format is just a sequential string of r, g, b bytes. However, "
83 "it may or may not include a \"header\" which consists of the xsize "
84 "and the ysize of the image, either as shorts or as longs. Specify "
85 "that with this variable, either 'short', 'long', or 'none' for "
86 "no header at all (in which case you should also set img-size)."));
90 PRC_DESC(
"If an IMG file without a header is loaded (e.g. img-header-type "
91 "is set to 'none', this specifies the fixed x y size of the image."));
95 PRC_DESC(
"Set this to the quality percentage for writing JPEG files. 95 is "
96 "the highest useful value (values greater than 95 do not lead to "
97 "significantly better quality, but do lead to significantly greater "
101 (
"png-compression-level", 6,
102 PRC_DESC(
"Set this to the desired compression level for writing PNG images. "
103 "Valid values are 0 (no compression), or 1 (compression, best "
104 "speed) to 9 (best compression). Default is 6. PNG compression is "
108 (
"png-palette",
true,
109 PRC_DESC(
"Set this true to allow writing palette-based PNG images when "
114 PRC_DESC(
"This controls how many bits per pixel are written out for BMP "
115 "files. If this is zero, the default, the number of bits per pixel "
116 "is based on the image."));
119 operator << (ostream &out, SGIStorageType sst) {
124 return out <<
"verbatim";
127 return out <<
"**invalid SGIStorageType(" << (int)sst <<
")**";
131 operator >> (istream &in, SGIStorageType &sst) {
135 if (cmp_nocase(word,
"rle") == 0) {
137 }
else if (cmp_nocase(word,
"verbatim") == 0) {
140 pnmimage_img_cat->error()
141 <<
"Invalid SGIStorageType: " << word <<
"\n";
149 operator << (ostream &out, IMGHeaderType iht) {
152 return out <<
"none";
154 return out <<
"short";
156 return out <<
"long";
159 return out <<
"**invalid IMGHeaderType(" << (int)iht <<
")**";
163 operator >> (istream &in, IMGHeaderType &iht) {
167 if (cmp_nocase(word,
"none") == 0) {
169 }
else if (cmp_nocase(word,
"short") == 0) {
171 }
else if (cmp_nocase(word,
"long") == 0) {
174 pnmimage_img_cat->error()
175 <<
"Invalid IMGHeaderType: " << word <<
"\n";
182 ConfigureFn(config_pnmimagetypes) {
194 static bool initialized =
false;
205 PNMFileTypeSGI::init_type();
206 PNMFileTypeSGI::register_with_read_factory();
211 PNMFileTypeTGA::init_type();
212 PNMFileTypeTGA::register_with_read_factory();
217 PNMFileTypeIMG::init_type();
218 PNMFileTypeIMG::register_with_read_factory();
222 #ifdef HAVE_SOFTIMAGE_PIC
223 PNMFileTypeSoftImage::init_type();
224 PNMFileTypeSoftImage::register_with_read_factory();
226 #endif // HAVE_SOFTIMAGE_PIC
229 PNMFileTypeBMP::init_type();
230 PNMFileTypeBMP::register_with_read_factory();
235 PNMFileTypePNM::init_type();
236 PNMFileTypePNM::register_with_read_factory();
240 PNMFileTypePfm::init_type();
245 PNMFileTypeJPG::init_type();
246 PNMFileTypeJPG::register_with_read_factory();
251 PNMFileTypePNG::init_type();
252 PNMFileTypePNG::register_with_read_factory();
257 PNMFileTypeTIFF::init_type();
258 PNMFileTypeTIFF::register_with_read_factory();
263 PNMFileTypeEXR::init_type();
264 PNMFileTypeEXR::register_with_read_factory();
268 #ifdef HAVE_STB_IMAGE
269 PNMFileTypeStbImage::init_type();
270 PNMFileTypeStbImage::register_with_read_factory();