summaryrefslogtreecommitdiff
path: root/inc/AlienImage_GIFLZWDict.hxx
blob: b01d9de69b7898df78e5d8d55e661d04d76f5fcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//============================================================================
//==== Titre: AlienImage_GIFLZWDict.hxx
//============================================================================

#ifndef _AlienImage_GIFLZWDict_HeaderFile
#define _AlienImage_GIFLZWDict_HeaderFile

//==== Definition de Type ====================================================
#include <Standard_Type.hxx>
const Handle(Standard_Type)& STANDARD_TYPE(AlienImage_GIFLZWDict);

//============================================================================
#include <OSD_File.hxx>

#ifndef WNT
typedef unsigned int   DWORD; // 32-bit signed
typedef int            LONG;  // 32-bit unsigned
typedef unsigned int   ULONG, UINT; // 32-bit signed
typedef unsigned short WORD;  // 16-bit unsigned
typedef unsigned char  BYTE;  // 8-bit unsigned
typedef unsigned int   BOOL;
typedef int*           PINT;
typedef unsigned char* PBYTE;
typedef void*          LPVOID;
#else
#ifdef NOGDI
#undef NOGDI /* we need GDI definitions here... */
#endif
# include <windows.h>
#endif

#if defined(__alpha)  || defined(DECOSF1) || defined(WNT)
#  define SWAP_WORD(__w)  (__w)
#  define SWAP_DWORD(__w)  (__w)
#else
#  define SWAP_WORD(__w) ((((__w)&0xFF) << 8) | (((__w)&0xFF00) >> 8))
#  define SWAP_DWORD(__w) ((((__w)&0x000000FF) << 24) | (((__w)&0x0000FF00) << 8) \
         |  (((__w)&0xFF0000) >> 8)  |  (((__w)&0xFF000000) >> 24)  )
#endif

#define NBITS     12
#define TBL_SIZE  5021
#define MAX_CODE  (  ( 1 << NBITS ) - 1  )
#define BUFF_SIZE 255
#define UNUSED -1
#define TRUE 1
#define FALSE 0

//=============================================================================
// Functions and structs to write GIF image to file.
//=============================================================================
extern int _lzw_encode (OSD_File&, const BYTE*, int, int, int);

typedef struct {
  char gifID[ 6 ];
  WORD scrnWidth;
  WORD scrnHeight;
  BYTE scrnFlag;
} SCREEN_DESCR;

typedef struct {
  WORD imgX;
  WORD imgY;
  WORD imgWidth;
  WORD imgHeight;
  BYTE imgFlag;
} IMAGE_DESCR;

typedef struct {
  int code;
  int prnt;
  BYTE byte;
} AlienImage_GIFLZWDict;

//=============================================================================
// Functions to convert from 24 to 8 color image
//=============================================================================
#define PAD(a)     (   ( a ) % sizeof ( LONG ) ?                         \
                    sizeof ( LONG ) - (  ( a ) % sizeof ( LONG )  ) : 0  )
#define MALLOC(s) calloc (  ( s ), 1  )
#define FREE(p)   free   (  ( p )     )

#ifndef WNT
typedef struct {
  BYTE rgbBlue;
  BYTE rgbGreen;
  BYTE rgbRed;
  BYTE rgbReserved;
} RGBQUAD, *LPRGBQUAD;

#define __fastcall
#endif // WNT

BOOL __fastcall _convert24to8 (LPRGBQUAD, PBYTE, PBYTE, int, int);

#endif // _AlienImage_GIFLZWDict_HeaderFile