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




CommitLineData
4cc17089 1Attribute VB_Name = "GrpApi"\r
2Option Explicit\r
3\r
4' ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006\r
5\r
6' Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
7\r
8Type GRPHEADER\r
9 nFrames As Integer\r
10 wMaxWidth As Integer\r
11 wMaxHeight As Integer\r
12End Type\r
13\r
14Public Const HORIZONTAL_FLIP As Long = &H1& ' Flips the graphic horizontally\r
15Public Const VERTICAL_FLIP As Long = &H2& ' Flips the graphic vertically\r
16Public Const SHADOW_COLOR As Long = &H4& ' Causes the graphic to be drawn in one color\r
17 ' Second byte of flags is the red component of\r
18 ' the shadow's color, third byte is green,\r
19 ' fourth byte is blue; like this:\r
20 ' 'SHADOW_COLOR Or &HBBGGRR00'\r
21Public Const ALPHA_BLEND As Long = &H8& ' Blends the graphic with what it is being drawn over.\r
22 ' The dwAlpha parameter will only be used when this\r
23 ' flag is specified. dwAlpha is an RGB value\r
24 ' (&HBBGGRR).\r
25 ' Note: Because of the extra calculations required,\r
26 ' alpha blended graphics take longer to draw\r
27\r
28' Palette is an array of 256 Longs. Pass the first element of the array to these functions,\r
29' rather than the actual array\r
30' For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
31' or a file not in an archive\r
32Declare Function LoadPalette Lib "Grpapi.dll" (ByVal lpFileName As String, dwPalette As Long) As Boolean\r
33Declare Function LoadGrp Lib "Grpapi.dll" (ByVal lpFileName As String) As Long\r
34Declare Function DestroyGrp Lib "Grpapi.dll" (ByVal hGrp As Long) As Boolean\r
35Declare Function DrawGrp Lib "Grpapi.dll" (ByVal hGrp As Long, ByVal hdcDest As Long, ByVal nXDest As Long, ByVal nYDest As Long, ByVal nFrame As Integer, dwPalette As Long, ByVal dwFlags As Long, ByVal dwAlpha As Long) As Boolean\r
36Declare Function GetGrpInfo Lib "Grpapi.dll" (ByVal hGrp As Long, GrpInfo As GRPHEADER) As Boolean\r
37\r
38Declare Function GetDC Lib "User32.dll" (ByVal hWnd As Long) As Long\r
39Declare Function ReleaseDC Lib "User32.dll" (ByVal hWnd As Long, ByVal hDC As Long) As Long\r
40\r
41' Call these to have DrawGrp use custom functions for reading and drawing pixels\r
42' so that you can have it read from and write to a buffer, for example.\r
43' Requires Visual Basic 5 or higher\r
44'\r
45' The functions must be in this form:\r
46'\r
47' Function GetPixelProc (ByRef value As any_type, X As Long, Y As Long) As Long\r
48' Sub SetPixelProc (ByRef value As any_type, X As Long, Y As Long, clrColor As Long)\r
49'\r
50' or\r
51'\r
52' Function GetPixelProc (ByVal value As any_type, X As Long, Y As Long) As Long\r
53' Sub SetPixelProc (ByVal value As any_type, X As Long, Y As Long, clrColor As Long)\r
54'\r
55' Replace "any_type" with whatever type you want. This parameter gets the data from\r
56' DrawGrp's hdcDest parameter. You can either pass a number to DrawGrp and use the\r
57' "ByVal" versions of the above functions, or you can use AddressOf to get a reference\r
58' to a variable and use it for the "ByRef" versions.\r
59' GetPixelProc should return an RGB color value.\r
60Declare Sub SetFunctionGetPixel Lib "Grpapi.dll" (lpGetPixelProc As Long)\r
61Declare Sub SetFunctionSetPixel Lib "Grpapi.dll" (lpSetPixelProc As Long)\r
62\r
63' Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
64Declare Function SetMpqDll Lib "Grpapi.dll" (ByVal lpDllFileName As String) As Boolean\r
65\r
66' These no longer need to be called\r
67Declare Function LoadGrpApi Lib "Grpapi.dll" () As Boolean\r
68Declare Sub FreeGrpApi Lib "Grpapi.dll" ()\r
69\r