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