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




8698fd19f9f93a6aa43dff66270b5680effde71f
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 #define ALPHA_BLEND     0x00000008 // Blends the graphic with what it is being drawn over.\r
41                                    // The dwAlpha parameter will only be used when this\r
42                                    // flag is specified.  dwAlpha is an RGB value\r
43                                    // (0xBBGGRR).\r
44                                    // Note: Because of the extra calculations required,\r
45                                    // alpha blended graphics take longer to draw\r
46 \r
47 // Palette is an array of 256 DWORD's\r
48 // For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
49 // or a file not in an archive\r
50 typedef BOOL   (WINAPI* funcLoadPalette)(LPCSTR lpFileName, DWORD *dwPaletteBuffer);\r
51 typedef HANDLE (WINAPI* funcLoadGrp)(LPCSTR lpFileName);\r
52 typedef BOOL   (WINAPI* funcDestroyGrp)(HANDLE hGrp);\r
53 typedef BOOL   (WINAPI* funcDrawGrp)(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
54 typedef BOOL   (WINAPI* funcGetGrpInfo)(HANDLE hGrp, GRPHEADER *GrpInfo);\r
55 extern funcLoadPalette LoadPalette;\r
56 extern funcLoadGrp LoadGrp;\r
57 extern funcDestroyGrp DestroyGrp;\r
58 extern funcDrawGrp DrawGrp;\r
59 extern funcGetGrpInfo GetGrpInfo;\r
60 \r
61 typedef COLORREF (WINAPI* GETPIXELPROC)(\r
62   HDC hDC, // same value as hdcDest from DrawGrp,\r
63                // does not need to be used as an HDC,\r
64                // can be used for any other type of pointer\r
65   int X,   // x-coordinate of pixel\r
66   int Y    // y-coordinate of pixel\r
67 );\r
68 typedef void (WINAPI* SETPIXELPROC)(\r
69         HDC hDC,          // same value as hdcDest from DrawGrp,\r
70                           // does not need to be used as an HDC,\r
71                           // can be used for any other type of pointer\r
72         int X,            // x-coordinate of pixel\r
73         int Y,            // y-coordinate of pixel\r
74         COLORREF clrColor // new pixel color\r
75 );\r
76 \r
77 // Call these to have DrawGrp use custom functions for reading and drawing pixels\r
78 // so that you can have it read from and write to a buffer, for example.\r
79 typedef void (WINAPI* funcSetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc);\r
80 typedef void (WINAPI* funcSetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);\r
81 extern funcSetFunctionGetPixel SetFunctionGetPixel;\r
82 extern funcSetFunctionSetPixel SetFunctionSetPixel;\r
83 \r
84 // Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
85 typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);\r
86 extern funcSetMpqDll SetMpqDll;\r
87 \r
88 // These no longer need to be called\r
89 typedef BOOL   (WINAPI* funcLoadGrpApi)();\r
90 typedef void   (WINAPI* funcFreeGrpApi)();\r
91 extern funcLoadGrpApi LoadGrpApi;\r
92 extern funcFreeGrpApi FreeGrpApi;\r
93 \r
94 #ifdef __cplusplus\r
95 };  // extern "C" \r
96 #endif\r
97 \r
98 #endif\r
99 \r