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




ShadowFlare [Mon, 11 Sep 2006 23:14:12 +0000 (23:14 +0000)]
grpapi/GrpApi.bas [new file with mode: 0644]

diff --git a/grpapi/GrpApi.bas b/grpapi/GrpApi.bas
new file mode 100644 (file)
index 0000000..c34bbed
--- /dev/null
@@ -0,0 +1,69 @@
+Attribute VB_Name = "GrpApi"\r
+Option Explicit\r
+\r
+'  ShadowFlare GRP Library. (c) ShadowFlare Software 2002-2006\r
+\r
+'  Any comments or suggestions are accepted at blakflare@hotmail.com (ShadowFlare)\r
+\r
+Type GRPHEADER\r
+    nFrames As Integer\r
+    wMaxWidth As Integer\r
+    wMaxHeight As Integer\r
+End Type\r
+\r
+Public Const HORIZONTAL_FLIP As Long = &H1& ' Flips the graphic horizontally\r
+Public Const VERTICAL_FLIP   As Long = &H2& ' Flips the graphic vertically\r
+Public Const SHADOW_COLOR    As Long = &H4& ' Causes the graphic to be drawn in one color\r
+                                            ' Second byte of flags is the red component of\r
+                                            ' the shadow's color, third byte is green,\r
+                                            ' fourth byte is blue; like this:\r
+                                            ' 'SHADOW_COLOR Or &HBBGGRR00'\r
+Public Const ALPHA_BLEND     As Long = &H8& ' Blends the graphic with what it is being drawn over.\r
+                                            ' The dwAlpha parameter will only be used when this\r
+                                            ' flag is specified.  dwAlpha is an RGB value\r
+                                            ' (&HBBGGRR).\r
+                                            ' Note: Because of the extra calculations required,\r
+                                            ' alpha blended graphics take longer to draw\r
+\r
+' Palette is an array of 256 Longs.  Pass the first element of the array to these functions,\r
+' rather than the actual array\r
+' For LoadPalette and LoadGrp, lpFileName may be a file in an open mpq archive\r
+' or a file not in an archive\r
+Declare Function LoadPalette Lib "Grpapi.dll" (ByVal lpFileName As String, dwPalette As Long) As Boolean\r
+Declare Function LoadGrp Lib "Grpapi.dll" (ByVal lpFileName As String) As Long\r
+Declare Function DestroyGrp Lib "Grpapi.dll" (ByVal hGrp As Long) As Boolean\r
+Declare 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
+Declare Function GetGrpInfo Lib "Grpapi.dll" (ByVal hGrp As Long, GrpInfo As GRPHEADER) As Boolean\r
+\r
+Declare Function GetDC Lib "User32.dll" (ByVal hWnd As Long) As Long\r
+Declare Function ReleaseDC Lib "User32.dll" (ByVal hWnd As Long, ByVal hDC As Long) As Long\r
+\r
+' Call these to have DrawGrp use custom functions for reading and drawing pixels\r
+' so that you can have it read from and write to a buffer, for example.\r
+' Requires Visual Basic 5 or higher\r
+'\r
+' The functions must be in this form:\r
+'\r
+' Function GetPixelProc (ByRef value As any_type, X As Long, Y As Long) As Long\r
+' Sub SetPixelProc (ByRef value As any_type, X As Long, Y As Long, clrColor As Long)\r
+'\r
+' or\r
+'\r
+' Function GetPixelProc (ByVal value As any_type, X As Long, Y As Long) As Long\r
+' Sub SetPixelProc (ByVal value As any_type, X As Long, Y As Long, clrColor As Long)\r
+'\r
+' Replace "any_type" with whatever type you want.  This parameter gets the data from\r
+' DrawGrp's hdcDest parameter.  You can either pass a number to DrawGrp and use the\r
+' "ByVal" versions of the above functions, or you can use AddressOf to get a reference\r
+' to a variable and use it for the "ByRef" versions.\r
+' GetPixelProc should return an RGB color value.\r
+Declare Sub SetFunctionGetPixel Lib "Grpapi.dll" (lpGetPixelProc As Long)\r
+Declare Sub SetFunctionSetPixel Lib "Grpapi.dll" (lpSetPixelProc As Long)\r
+\r
+' Call this to make a different Storm.dll-compatible MPQ library be used (like SFMPQ).\r
+Declare Function SetMpqDll Lib "Grpapi.dll" (ByVal lpDllFileName As String) As Boolean\r
+\r
+' These no longer need to be called\r
+Declare Function LoadGrpApi Lib "Grpapi.dll" () As Boolean\r
+Declare Sub FreeGrpApi Lib "Grpapi.dll" ()\r
+\r