Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




1 /*\r
2 \r
3   ShadowFlare GRP Library. (c) ShadowFlare Software 2002\r
4 \r
5   Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
6 */\r
7 \r
8 #ifndef GRPAPI_INCLUDED\r
9 #define GRPAPI_INCLUDED\r
10 \r
11 #include <windows.h>\r
12 \r
13 #ifdef GRPAPI_EXPORTS\r
14 #define GRPAPI __declspec(dllexport)\r
15 #else\r
16 #define GRPAPI __declspec(dllimport)\r
17 #endif\r
18 \r
19 #ifdef __cplusplus\r
20 extern "C" {\r
21 #endif\r
22 \r
23 // These no longer need to be called\r
24 extern void LoadGrpApiLib();\r
25 extern void FreeGrpApiLib();\r
26 \r
27 typedef struct {\r
28         WORD nFrames;\r
29         WORD wMaxWidth;\r
30         WORD wMaxHeight;\r
31 } GRPHEADER;\r
32 \r
33 #define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally\r
34 #define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically\r
35 #define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color\r
36                                    // Second byte of flags is the red component of\r
37                                    // the shadow's color, third byte is green,\r
38                                    // fourth byte is blue; like this:\r
39                                    // SHADOW_COLOR|0xBBGGRR00\r
40                                    // This can be accomplished by using the left shift\r
41                                    // operator like this:  SHADOW_COLOR|(color << 8)\r
42 #define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.\r
43                                    // The dwAlpha parameter will only be used when this\r
44                                    // flag is specified.  dwAlpha is an RGB value\r
45                                    // (0xBBGGRR).\r
46                                    // Note: Because of the extra calculations required,\r
47                                    // alpha blended graphics take longer to draw\r
48 #define USE_INDEX       0x00000010 // Only valid when used with a custom SetPixel function.\r
49                                    // This flag cannot be used in combination with\r
50                                    // ALPHA_BLEND or SHADOW_COLOR\r
51                                    // When this flag is used, the index to a color in the\r
52                                    // palette will be passed to your custom SetPixel\r
53                                    // function instead of the actual color.\r
54 \r
55 // Palette is an array of 256 DWORD's\r
56 // For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
57 // or a file not in an archive\r
58 typedef BOOL   (WINAPI* funcLoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer);\r
59 typedef HANDLE (WINAPI* funcLoadGrp)(LPCSTR lpFileName);\r
60 typedef BOOL   (WINAPI* funcDestroyGrp)(HANDLE hGrp);\r
61 typedef BOOL   (WINAPI* funcDrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
62 typedef BOOL   (WINAPI* funcGetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo);\r
63 extern funcLoadPalette LoadPalette;\r
64 extern funcLoadGrp LoadGrp;\r
65 extern funcDestroyGrp DestroyGrp;\r
66 extern funcDrawGrp DrawGrp;\r
67 extern funcGetGrpInfo GetGrpInfo;\r
68 \r
69 typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);\r
70 extern funcCreateGrp CreateGrp;\r
71 \r
72 typedef COLORREF (WINAPI* GETPIXELPROC)(\r
73   HDC hDC, // same value as hdcDest from DrawGrp,\r
74                // does not need to be used as an HDC,\r
75                // can be used for any other type of pointer\r
76   int X,   // x-coordinate of pixel\r
77   int Y    // y-coordinate of pixel\r
78 );\r
79 typedef void (WINAPI* SETPIXELPROC)(\r
80         HDC hDC,          // same value as hdcDest from DrawGrp,\r
81                           // does not need to be used as an HDC,\r
82                           // can be used for any other type of pointer\r
83         int X,            // x-coordinate of pixel\r
84         int Y,            // y-coordinate of pixel\r
85         COLORREF clrColor // new pixel color\r
86 );\r
87 \r
88 // Call these to have DrawGrp use custom functions for reading and drawing pixels\r
89 // so that you can have it read from and write to a buffer, for example.\r
90 typedef void (WINAPI* funcSetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc);\r
91 typedef void (WINAPI* funcSetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);\r
92 extern funcSetFunctionGetPixel SetFunctionGetPixel; // Only used with ALPHA_BLEND\r
93 extern funcSetFunctionSetPixel SetFunctionSetPixel;\r
94 \r
95 // Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
96 typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);\r
97 extern funcSetMpqDll SetMpqDll;\r
98 \r
99 // These no longer need to be called\r
100 typedef BOOL   (WINAPI* funcLoadGrpApi)();\r
101 typedef void   (WINAPI* funcFreeGrpApi)();\r
102 extern funcLoadGrpApi LoadGrpApi;\r
103 extern funcFreeGrpApi FreeGrpApi;\r
104 \r
105 #ifdef __cplusplus\r
106 };  // extern "C" \r
107 #endif\r
108 \r
109 #endif\r
110 \r