Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ctgaloader.h

Go to the documentation of this file.
00001 #ifndef TGA_LOADER_CLASS_PROTECTION
00002 #define TGA_LOADER_CLASS_PROTECTION
00003 
00004 #include <windows.h>
00005 #include "cimagedata.h"
00006 #include <string>
00007 using std::string;
00008 
00009 
00010 #define HEADER_SIZE 18L
00011 
00012 
00013 class CTGALoader {
00014 
00015 #pragma pack(push)
00016 #pragma pack(1)
00017 
00018         struct {
00019                 BYTE cIDLength;
00020                 BYTE cColorMapType;
00021                 BYTE cImageType;
00022                 //color map spec
00023                 WORD ucFirstEntryIndex;
00024                 WORD ucColorMapLength;
00025                 BYTE cColorMapEntrySize;
00026                 //image spec
00027                 WORD ucXOrigin;
00028                 WORD ucYOrigin;
00029                 WORD ucImageWidth;
00030                 WORD ucImageHeight;
00031                 BYTE cPixelDepth;
00032                 BYTE cImageDescriptor;
00033         } m_sTgaHeader;
00034 
00035 
00036         struct {
00037                 char cFooter[26];
00038                 char cSignature[17];
00039                 DWORD udExtensionAreaOffset;
00040                 DWORD udDeveloperDirectoryOffset;
00041                 BYTE cAsciiChar;
00042                 BYTE cStringTerminator;
00043         } m_sTgaFooter;
00044 
00045 #pragma pack(pop)
00046 
00047 
00048         int m_GetHeader(char *filename);
00049         int m_GetFooter(char *filename);
00050         int m_ExtractImageData(char *filename, ImageData_t *psImage);
00051 
00052 public:
00053         
00054         ImageData_t *LoadTgaImage(char *filename);
00055         bool SaveTgaImage(string path, ImageData_t *psImage);
00056 };
00057 
00058 
00059 #endif

Generated on Thu Jan 30 21:35:43 2003 for 3DVis by doxygen1.3-rc2