Commit | Line | Data |
14362b19 |
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 |
8531f378 |
40 | // This can be accomplished by using the left shift\r |
41 | // operator like this: SHADOW_COLOR|(color << 8)\r |
14362b19 |
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 |
8531f378 |
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 |
14362b19 |
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 |
7f7b4247 |
69 | typedef COLORREF (WINAPI* GETPIXELPROC)(\r |
70 | HDC hDC, // same value as hdcDest from DrawGrp,\r |
71 | // does not need to be used as an HDC,\r |
72 | // can be used for any other type of pointer\r |
73 | int X, // x-coordinate of pixel\r |
74 | int Y // y-coordinate of pixel\r |
75 | );\r |
76 | typedef void (WINAPI* SETPIXELPROC)(\r |
77 | HDC hDC, // same value as hdcDest from DrawGrp,\r |
78 | // does not need to be used as an HDC,\r |
79 | // can be used for any other type of pointer\r |
80 | int X, // x-coordinate of pixel\r |
81 | int Y, // y-coordinate of pixel\r |
82 | COLORREF clrColor // new pixel color\r |
83 | );\r |
84 | \r |
85 | // Call these to have DrawGrp use custom functions for reading and drawing pixels\r |
86 | // so that you can have it read from and write to a buffer, for example.\r |
87 | typedef void (WINAPI* funcSetFunctionGetPixel)(GETPIXELPROC lpGetPixelProc);\r |
88 | typedef void (WINAPI* funcSetFunctionSetPixel)(SETPIXELPROC lpSetPixelProc);\r |
ff024783 |
89 | extern funcSetFunctionGetPixel SetFunctionGetPixel; // Only used with ALPHA_BLEND\r |
7f7b4247 |
90 | extern funcSetFunctionSetPixel SetFunctionSetPixel;\r |
91 | \r |
92 | // Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r |
93 | typedef BOOL (WINAPI* funcSetMpqDll)(LPCSTR lpDllFileName);\r |
94 | extern funcSetMpqDll SetMpqDll;\r |
95 | \r |
14362b19 |
96 | // These no longer need to be called\r |
97 | typedef BOOL (WINAPI* funcLoadGrpApi)();\r |
98 | typedef void (WINAPI* funcFreeGrpApi)();\r |
99 | extern funcLoadGrpApi LoadGrpApi;\r |
100 | extern funcFreeGrpApi FreeGrpApi;\r |
101 | \r |
102 | #ifdef __cplusplus\r |
103 | }; // extern "C" \r |
104 | #endif\r |
105 | \r |
106 | #endif\r |
107 | \r |