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-2006\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 #ifndef GRPAPI_STATIC\r
14 \r
15 #ifdef GRPAPI_EXPORTS\r
16 #define GRPAPI __declspec(dllexport)\r
17 #else\r
18 #define GRPAPI __declspec(dllimport)\r
19 #endif\r
20 \r
21 #else\r
22 #define GRPAPI\r
23 #endif\r
24 \r
25 #ifdef __cplusplus\r
26 extern "C" {\r
27 #endif\r
28 \r
29 typedef struct {\r
30         WORD nFrames;\r
31         WORD wMaxWidth;\r
32         WORD wMaxHeight;\r
33 } GRPHEADER;\r
34 \r
35 #define HORIZONTAL_FLIP 0x00000001 // Flips the graphic horizontally\r
36 #define VERTICAL_FLIP   0x00000002 // Flips the graphic vertically\r
37 #define SHADOW_COLOR    0x00000004 // Causes the graphic to be drawn in one color\r
38                                    // Second byte of flags is the red component of\r
39                                    // the shadow's color, third byte is green,\r
40                                    // fourth byte is blue; like this:\r
41                                    // SHADOW_COLOR|0xBBGGRR00\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 \r
49 // Palette is an array of 256 DWORD's\r
50 // For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
51 // or a file not in an archive\r
52 BOOL   GRPAPI WINAPI LoadPalette(LPCSTR lpFileName, DWORD *dwPaletteBuffer);\r
53 HANDLE GRPAPI WINAPI LoadGrp(LPCSTR lpFileName);\r
54 BOOL   GRPAPI WINAPI DestroyGrp(HANDLE hGrp);\r
55 BOOL   GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
56 BOOL   GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo);\r
57 \r
58 typedef COLORREF (WINAPI* GETPIXELPROC)(\r
59   HDC hDC, // same value as hdcDest from DrawGrp,\r
60                // does not need to be used as an HDC,\r
61                // can be used for any other type of pointer\r
62   int X,   // x-coordinate of pixel\r
63   int Y    // y-coordinate of pixel\r
64 );\r
65 typedef void (WINAPI* SETPIXELPROC)(\r
66         HDC hDC,          // same value as hdcDest from DrawGrp,\r
67                           // does not need to be used as an HDC,\r
68                           // can be used for any other type of pointer\r
69         int X,            // x-coordinate of pixel\r
70         int Y,            // y-coordinate of pixel\r
71         COLORREF clrColor // new pixel color\r
72 );\r
73 \r
74 // Call these to have DrawGrp use custom functions for reading and drawing pixels\r
75 // so that you can have it read from and write to a buffer, for example.\r
76 void GRPAPI WINAPI SetFunctionGetPixel(GETPIXELPROC lpGetPixelProc);\r
77 void GRPAPI WINAPI SetFunctionSetPixel(SETPIXELPROC lpSetPixelProc);\r
78 \r
79 // Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
80 BOOL GRPAPI WINAPI SetMpqDll(LPCSTR lpDllFileName);\r
81 \r
82 // These no longer need to be called\r
83 BOOL   GRPAPI WINAPI LoadGrpApi();\r
84 void   GRPAPI WINAPI FreeGrpApi();\r
85 \r
86 #ifdef __cplusplus\r
87 };  // extern "C" \r
88 #endif\r
89 \r
90 #endif\r
91 \r