00001
00032 #ifndef LL_LLIMAGETGA_H
00033 #define LL_LLIMAGETGA_H
00034
00035 #include "llimage.h"
00036
00037
00038
00039 class LLImageTGA : public LLImageFormatted
00040 {
00041 protected:
00042 virtual ~LLImageTGA();
00043
00044 public:
00045 LLImageTGA();
00046 LLImageTGA(const LLString& file_name);
00047
00048 BOOL updateData();
00049 BOOL decode(LLImageRaw* raw_image, F32 decode_time=0.0);
00050 BOOL encode(const LLImageRaw* raw_image, F32 encode_time=0.0);
00051
00052 BOOL decodeAndProcess(LLImageRaw* raw_image, F32 domain, F32 weight);
00053
00054 private:
00055 BOOL decodeTruecolor( LLImageRaw* raw_image, BOOL rle, BOOL flipped );
00056
00057 BOOL decodeTruecolorRle8( LLImageRaw* raw_image );
00058 BOOL decodeTruecolorRle15( LLImageRaw* raw_image );
00059 BOOL decodeTruecolorRle24( LLImageRaw* raw_image );
00060 BOOL decodeTruecolorRle32( LLImageRaw* raw_image, BOOL &alpha_opaque );
00061
00062 void decodeTruecolorPixel15( U8* dst, const U8* src );
00063
00064 BOOL decodeTruecolorNonRle( LLImageRaw* raw_image, BOOL &alpha_opaque );
00065
00066 BOOL decodeColorMap( LLImageRaw* raw_image, BOOL rle, BOOL flipped );
00067
00068 void decodeColorMapPixel8(U8* dst, const U8* src);
00069 void decodeColorMapPixel15(U8* dst, const U8* src);
00070 void decodeColorMapPixel24(U8* dst, const U8* src);
00071 void decodeColorMapPixel32(U8* dst, const U8* src);
00072
00073 bool loadFile(const LLString& file_name);
00074
00075 private:
00076
00077 U32 mDataOffset;
00078
00079
00080 U8 mIDLength;
00081 U8 mColorMapType;
00082 U8 mImageType;
00083 U8 mColorMapIndexLo;
00084 U8 mColorMapIndexHi;
00085 U8 mColorMapLengthLo;
00086 U8 mColorMapLengthHi;
00087 U8 mColorMapDepth;
00088 U8 mXOffsetLo;
00089 U8 mXOffsetHi;
00090 U8 mYOffsetLo;
00091 U8 mYOffsetHi;
00092 U8 mWidthLo;
00093 U8 mWidthHi;
00094 U8 mHeightLo;
00095 U8 mHeightHi;
00096 U8 mPixelSize;
00097 U8 mAttributeBits;
00098 U8 mOriginRightBit;
00099 U8 mOriginTopBit;
00100 U8 mInterleave;
00101
00102 U8* mColorMap;
00103 S32 mColorMapStart;
00104 S32 mColorMapLength;
00105 S32 mColorMapBytesPerEntry;
00106
00107 BOOL mIs15Bit;
00108
00109 static const U8 s5to8bits[32];
00110 };
00111
00112 #endif