home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / TGAUTL.ZIP / TGA.H < prev    next >
Text File  |  1990-03-26  |  5KB  |  117 lines

  1. /*
  2. **    Copyright (c) 1989
  3. **    Truevision Inc.
  4. **    All Rights Reserved
  5. */
  6.  
  7. /*
  8. **    Attempt to accomodate machine dependencies
  9. **    The parameter, MSDOS, is automatically defined by the Microsoft
  10. **    compiler.
  11. */
  12.  
  13. #if MSDOS
  14. typedef int                SINT16;            /* 16-bit signed integer            */
  15. typedef unsigned int    UINT16;            /* 16-bit unsigned integer            */
  16. typedef long            SINT32;            /* 32-bit signed integer            */
  17. typedef unsigned long    UINT32;            /* 32-bit unsigned integer            */
  18. typedef signed char        SINT8;            /* 8-bit signed integer                */
  19. typedef unsigned char    UINT8;            /* 8-bit unsigned integer            */
  20. #endif
  21.  
  22. /****************************************************************************
  23. **
  24. **    For more information about the original Truevision TGA(tm) file format,
  25. **    or for additional information about the new extensions to the
  26. **    Truevision TGA file, refer to the "Truevision TGA File Format
  27. **    Specification Version 2.0" available from Truevision or your
  28. **    Truevision dealer.
  29. **
  30. **  FILE STRUCTURE FOR THE ORIGINAL TRUEVISION TGA FILE                
  31. **      FIELD 1 :    NUMBER OF CHARACTERS IN ID FIELD (1 BYTES)    
  32. **      FIELD 2 :    COLOR MAP TYPE (1 BYTES)            
  33. **      FIELD 3 :    IMAGE TYPE CODE (1 BYTES)            
  34. **                    = 0    NO IMAGE DATA INCLUDED        
  35. **                    = 1    UNCOMPRESSED, COLOR-MAPPED IMAGE
  36. **                    = 2    UNCOMPRESSED, TRUE-COLOR IMAGE    
  37. **                    = 3    UNCOMPRESSED, BLACK AND WHITE IMAGE
  38. **                    = 9    RUN-LENGTH ENCODED COLOR-MAPPED IMAGE
  39. **                    = 10 RUN-LENGTH ENCODED TRUE-COLOR IMAGE
  40. **                    = 11 RUN-LENGTH ENCODED BLACK AND WHITE IMAGE
  41. **      FIELD 4 :    COLOR MAP SPECIFICATION    (5 BYTES)        
  42. **                4.1 : COLOR MAP ORIGIN (2 BYTES)    
  43. **                4.2 : COLOR MAP LENGTH (2 BYTES)    
  44. **                4.3 : COLOR MAP ENTRY SIZE (2 BYTES)    
  45. **      FIELD 5 :    IMAGE SPECIFICATION (10 BYTES)            
  46. **                5.1 : X-ORIGIN OF IMAGE (2 BYTES)    
  47. **                5.2 : Y-ORIGIN OF IMAGE (2 BYTES)    
  48. **                5.3 : WIDTH OF IMAGE (2 BYTES)        
  49. **                5.4 : HEIGHT OF IMAGE (2 BYTES)        
  50. **                5.5 : IMAGE PIXEL SIZE (1 BYTE)        
  51. **                5.6 : IMAGE DESCRIPTOR BYTE (1 BYTE)     
  52. **      FIELD 6 :    IMAGE ID FIELD (LENGTH SPECIFIED BY FIELD 1)    
  53. **      FIELD 7 :    COLOR MAP DATA (BIT WIDTH SPECIFIED BY FIELD 4.3 AND
  54. **                NUMBER OF COLOR MAP ENTRIES SPECIFIED IN FIELD 4.2)
  55. **      FIELD 8 :    IMAGE DATA FIELD (WIDTH AND HEIGHT SPECIFIED IN
  56. **                FIELD 5.3 AND 5.4)                
  57. ****************************************************************************/
  58.  
  59. typedef struct _devDir
  60. {
  61.     UINT16    tagValue;
  62.     UINT32    tagOffset;
  63.     UINT32    tagSize;
  64. } DevDir;
  65.  
  66. typedef struct _TGAFile
  67. {
  68.     UINT8    idLength;        /* length of ID string */
  69.     UINT8    mapType;        /* color map type */
  70.     UINT8    imageType;        /* image type code */
  71.     UINT16    mapOrigin;        /* starting index of map */
  72.     UINT16    mapLength;        /* length of map */
  73.     UINT8    mapWidth;        /* width of map in bits */
  74.     UINT16    xOrigin;        /* x-origin of image */
  75.     UINT16    yOrigin;        /* y-origin of image */
  76.     UINT16    imageWidth;        /* width of image */
  77.     UINT16    imageHeight;    /* height of image */
  78.     UINT8    pixelDepth;        /* bits per pixel */
  79.     UINT8    imageDesc;        /* image descriptor */
  80.     char    idString[256];    /* image ID string */
  81.     UINT16    devTags;        /* number of developer tags in directory */
  82.     DevDir    *devDirs;        /* pointer to developer directory entries */
  83.     UINT16    extSize;        /* extension area size */
  84.     char    author[41];        /* name of the author of the image */
  85.     char    authorCom[4][81];    /* author's comments */
  86.     UINT16    month;            /* date-time stamp */
  87.     UINT16    day;
  88.     UINT16    year;
  89.     UINT16    hour;
  90.     UINT16    minute;
  91.     UINT16    second;
  92.     char    jobID[41];        /* job identifier */
  93.     UINT16    jobHours;        /* job elapsed time */
  94.     UINT16    jobMinutes;
  95.     UINT16    jobSeconds;
  96.     char    softID[41];        /* software identifier/program name */
  97.     UINT16    versionNum;        /* software version designation */
  98.     UINT8    versionLet;
  99.     UINT32    keyColor;        /* key color value as A:R:G:B */
  100.     UINT16    pixNumerator;    /* pixel aspect ratio */
  101.     UINT16    pixDenominator;
  102.     UINT16    gammaNumerator;    /* gamma correction factor */
  103.     UINT16    gammaDenominator;
  104.     UINT32    colorCorrectOffset;    /* offset to color correction table */
  105.     UINT32    stampOffset;    /* offset to postage stamp data */
  106.     UINT32    scanLineOffset;    /* offset to scan line table */
  107.     UINT8    alphaAttribute;    /* alpha attribute description */
  108.     UINT32    *scanLineTable;    /* address of scan line offset table */
  109.     UINT8    stampWidth;        /* width of postage stamp */
  110.     UINT8    stampHeight;    /* height of postage stamp */
  111.     void    *postStamp;        /* address of postage stamp data */
  112.     UINT16    *colorCorrectTable;
  113.     UINT32    extAreaOffset;    /* extension area offset */
  114.     UINT32    devDirOffset;    /* developer directory offset */
  115.     char    signature[18];    /* signature string    */
  116. } TGAFile;
  117.