- Main Page
- Data Structures
- Files

# /home/dwoods/DevIL/src-IL/include/il_targa.h

    00001 //-----------------------------------------------------------------------------
    00002 //
    00003 // ImageLib Sources
    00004 // Copyright (C) 2000-2002 by Denton Woods
    00005 // Last modified: 05/25/2001 <--Y2K Compliant! =]
    00006 //
    00007 // Filename: src-IL/include/il_targa.h
    00008 //
    00009 // Description: Targa (.tga) functions
    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;                  // Extension Area Offset
    00045         ILuint DevDirOff;               // Developer Directory Offset
    00046         ILbyte Signature[16];   // TRUEVISION-XFILE
    00047         ILbyte Reserved;                // ASCII period '.'
    00048         ILbyte NullChar;                // NULL
    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         // Dev Directory
    00060         //      We don't mess with this
    00061
    00062         // Extension Area
    00063         ILshort Size;                           // should be TGA_EXT_LEN
    00064         ILbyte  AuthName[41];           // the image author's name
    00065         ILbyte  AuthComments[324];      // author's comments
    00066         ILshort Month, Day, Year, Hour, Minute, Second; // internal date of file
    00067         ILbyte  JobID[41];                      // the job description (if any)
    00068         ILshort JobHour, JobMin, JobSecs;       // the job's time
    00069         ILbyte  SoftwareID[41];         // the software that created this
    00070         ILshort SoftwareVer;            // the software version number * 100
    00071         ILbyte  SoftwareVerByte;        // the software version letter
    00072         ILint   KeyColor;                       // the transparent colour
    00073 } TARGAEXT;
    00074
    00075
    00076 // Different Targa formats
    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 // Targa origins
    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 // Internal functions
    00095 ILboolean       iIsValidTarga();
    00096 ILboolean       iGetTgaHead(TARGAHEAD *Header);
    00097 ILboolean       iCheckTarga(TARGAHEAD *Header);
    00098 ILboolean       iLoadTargaInternal(void);
    00099 ILboolean       iSaveTargaInternal(void);
    00100 //ILvoid                iMakeString(char *Str);
    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