00001 #ifndef MISC_IMAGE_H
00002 #define MISC_IMAGE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00058 #include <glt/config.h>
00059 #include <misc/config.h>
00060
00061 #ifdef GLT_WIN32
00062 #pragma warning(disable: 4786)
00063 #endif
00064
00065 #include <string>
00066 #include <iosfwd>
00067 #include <vector>
00068
00069
00070
00071
00072
00078 bool isGreyscale(const std::string &rgb);
00079
00085 bool is256Colors(const std::string &rgb);
00086
00095 void getChannel(std::string &dest,const std::string &src,const uint32 size,const uint32 channel);
00096
00105 void rgb2Indexed(std::string &dest,const std::string &rgb);
00106
00113 void indexed2rgb(std::string &dest,const std::string &indexed);
00114
00123 void flipImage(std::string &dest,const std::string &src,const int width,const int height);
00124
00133 void mirrorImage(std::string &dest,const std::string &src,const int width,const int height);
00134
00141 void adjustGamma(std::string &image,const double gamma);
00142
00153 void adjustHSV(std::string &image,const int width,const int height,const real hue,const real saturation,const real value);
00154
00159 bool stitchImages(std::string &image,const int dx,const int dy,const std::vector<std::string> &src,const int lineSize);
00160
00161
00162
00163
00164
00173 bool decode(uint32 &width,uint32 &height,std::string &image,const std::string &data);
00174
00186 bool decodePPM(std::string &type,uint32 &width,uint32 &height,std::string &image,const std::string &data);
00187
00197 bool decodeBMP(uint32 &width,uint32 &height,std::string &image,const std::string &data);
00198
00208 bool decodeTGA(uint32 &width,uint32 &height,std::string &image,const std::string &data);
00209
00210 #ifdef GLT_PNG
00211
00220 bool decodePNG(uint32 &width,uint32 &height,std::string &image,const std::string &data);
00221
00222 #endif
00223
00224
00225
00226
00227
00236 bool encodePPM(std::string &data,const uint32 width,const uint32 height,const std::string &image);
00237
00247 bool encodeBMP(std::string &data,const uint32 width,const uint32 height,const std::string &image);
00248
00258 bool encodeTGA(std::string &data,const uint32 width,const uint32 height,const std::string &image);
00259
00260 #ifdef GLT_PNG
00261
00270 bool encodePNG(std::string &data,const uint32 &width,const uint32 &height,const std::string &image);
00271
00272 #endif
00273
00274
00275 #endif