00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef TARGA_H
00015 #define TARGA_H
00016 
00017 #include "il_internal.h"
00018 
00019 #ifdef _MSC_VER
00020 #pragma pack(push, tga_struct, 1)
00021 #elif defined(MACOSX) || defined(__GNUC__)
00022 #pragma pack(1)
00023 #endif
00024 
00025 typedef struct TARGAHEAD
00026 {
00027         ILubyte         IDLen;
00028         ILubyte         ColMapPresent;
00029         ILubyte         ImageType;
00030         ILshort         FirstEntry;
00031         ILshort         ColMapLen;
00032         ILubyte         ColMapEntSize;
00033 
00034         ILshort         OriginX;
00035         ILshort         OriginY;
00036         ILushort        Width;
00037         ILushort        Height;
00038         ILubyte         Bpp;
00039         ILubyte         ImageDesc;
00040 } IL_PACKSTRUCT TARGAHEAD;
00041 
00042 typedef struct TARGAFOOTER
00043 {
00044         ILuint ExtOff;                  
00045         ILuint DevDirOff;               
00046         ILbyte Signature[16];   
00047         ILbyte Reserved;                
00048         ILbyte NullChar;                
00049 } IL_PACKSTRUCT TARGAFOOTER;
00050 #if defined(MACOSX) || defined(__GNUC__)
00051 #pragma pack()
00052 #elif _MSC_VER
00053 #pragma pack(pop, tga_struct)
00054 #endif
00055 
00056 #define TGA_EXT_LEN             495
00057 typedef struct TARGAEXT
00058 {
00059         
00060         
00061 
00062         
00063         ILshort Size;                           
00064         ILbyte  AuthName[41];           
00065         ILbyte  AuthComments[324];      
00066         ILshort Month, Day, Year, Hour, Minute, Second; 
00067         ILbyte  JobID[41];                      
00068         ILshort JobHour, JobMin, JobSecs;       
00069         ILbyte  SoftwareID[41];         
00070         ILshort SoftwareVer;            
00071         ILbyte  SoftwareVerByte;        
00072         ILint   KeyColor;                       
00073 } TARGAEXT;
00074 
00075 
00076 
00077 #define TGA_NO_DATA                             0
00078 #define TGA_COLMAP_UNCOMP               1
00079 #define TGA_UNMAP_UNCOMP                2
00080 #define TGA_BW_UNCOMP                   3
00081 #define TGA_COLMAP_COMP                 9
00082 #define TGA_UNMAP_COMP                  10
00083 #define TGA_BW_COMP                             11
00084 
00085 
00086 
00087 #define IMAGEDESC_ORIGIN_MASK   0x30
00088 #define IMAGEDESC_TOPLEFT               0x20
00089 #define IMAGEDESC_BOTLEFT               0x00
00090 #define IMAGEDESC_BOTRIGHT              0x10
00091 #define IMAGEDESC_TOPRIGHT              0x30
00092 
00093 
00094 
00095 ILboolean       iIsValidTarga();
00096 ILboolean       iGetTgaHead(TARGAHEAD *Header);
00097 ILboolean       iCheckTarga(TARGAHEAD *Header);
00098 ILboolean       iLoadTargaInternal(void);
00099 ILboolean       iSaveTargaInternal(void);
00100 
00101 ILboolean       iReadBwTga(TARGAHEAD *Header);
00102 ILboolean       iReadColMapTga(TARGAHEAD *Header);
00103 ILboolean       iReadUnmapTga(TARGAHEAD *Header);
00104 ILboolean       iUncompressTgaData(ILimage *Image);
00105 ILboolean       i16BitTarga(ILimage *Image);
00106 void            iGetDateTime(ILuint *Month, ILuint *Day, ILuint *Yr, ILuint *Hr, ILuint *Min, ILuint *Sec);
00107 
00108 
00109 #endif//TARGA_H