39 if (comparecase(ext,
"png") == 0) {
40 if (!FXPNGImage::supported) {
43 }
else if (comparecase(ext,
"jpg") == 0 || comparecase(ext,
"jpeg") == 0) {
44 if (!FXJPGImage::supported) {
47 }
else if (comparecase(ext,
"tif") == 0 || comparecase(ext,
"tiff") == 0) {
48 if (!FXTIFImage::supported) {
57 FXString ext = FXPath::extension(file.c_str());
59 FXImage* img =
nullptr;
60 if (comparecase(ext,
"gif") == 0) {
61 img =
new FXGIFImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
62 }
else if (comparecase(ext,
"bmp") == 0) {
63 img =
new FXBMPImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
64 }
else if (comparecase(ext,
"xpm") == 0) {
65 img =
new FXXPMImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
66 }
else if (comparecase(ext,
"pcx") == 0) {
67 img =
new FXPCXImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
68 }
else if (comparecase(ext,
"ico") == 0 || comparecase(ext,
"cur") == 0) {
69 img =
new FXICOImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
70 }
else if (comparecase(ext,
"tga") == 0) {
71 img =
new FXTGAImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
72 }
else if (comparecase(ext,
"rgb") == 0) {
73 img =
new FXRGBImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
74 }
else if (comparecase(ext,
"xbm") == 0) {
75 img =
new FXXBMImage(a,
nullptr,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
76 }
else if (comparecase(ext,
"png") == 0) {
77 img =
new FXPNGImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
78 }
else if (comparecase(ext,
"jpg") == 0 || comparecase(ext,
"jpeg") == 0) {
79 img =
new FXJPGImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
80 }
else if (comparecase(ext,
"tif") == 0 || comparecase(ext,
"tiff") == 0) {
81 img =
new FXTIFImage(a,
nullptr, IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP);
87 if (img !=
nullptr && stream.open(file.c_str(), FXStreamLoad)) {
89 img->loadPixels(stream);
105 for (FXint exp = 30; exp >= 0; exp--) {
106 newHeight = 2 << exp;
107 if (newHeight <= maxSize && (image->getHeight() & newHeight)) {
111 if (2 * newHeight <= maxSize && (2 * newHeight - image->getHeight() < image->getHeight() - newHeight)) {
115 for (FXint exp = 30; exp >= 0; exp--) {
117 if (newWidth <= maxSize && (image->getWidth() & newWidth)) {
121 if (2 * newWidth <= maxSize && (2 * newWidth - image->getWidth() < image->getWidth() - newWidth)) {
124 if (newHeight == image->getHeight() && newWidth == image->getWidth()) {
127 image->scale(newWidth, newHeight);
136 int width,
int height, FXColor* data) {
137 FXString ext = FXPath::extension(file.c_str());
140 if (!stream.open(file.c_str(), FXStreamSave)) {
143 if (comparecase(ext,
"gif") == 0) {
144 return fxsaveGIF(stream, data, width, height,
false );
145 }
else if (comparecase(ext,
"bmp") == 0) {
146 return fxsaveBMP(stream, data, width, height);
147 }
else if (comparecase(ext,
"xpm") == 0) {
148 return fxsaveXPM(stream, data, width, height);
149 }
else if (comparecase(ext,
"pcx") == 0) {
150 return fxsavePCX(stream, data, width, height);
151 }
else if (comparecase(ext,
"ico") == 0 || comparecase(ext,
"cur") == 0) {
152 return fxsaveICO(stream, data, width, height);
153 }
else if (comparecase(ext,
"tga") == 0) {
154 return fxsaveTGA(stream, data, width, height);
155 }
else if (comparecase(ext,
"rgb") == 0) {
156 return fxsaveRGB(stream, data, width, height);
157 }
else if (comparecase(ext,
"xbm") == 0) {
158 return fxsaveXBM(stream, data, width, height);
159 }
else if (comparecase(ext,
"png") == 0) {
160 return fxsavePNG(stream, data, width, height);
161 }
else if (comparecase(ext,
"jpg") == 0 || comparecase(ext,
"jpeg") == 0) {
162 return fxsaveJPG(stream, data, width, height, 75);
163 }
else if (comparecase(ext,
"tif") == 0 || comparecase(ext,
"tiff") == 0) {
164 return fxsaveTIF(stream, data, width, height, 0);