From: ShadowFlare Date: Mon, 11 Sep 2006 23:34:08 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://sfsrealm.hopto.org/projects/?a=commitdiff_plain;h=4d7b76a0306a5577bc7b2dd3264e75ea419f6942;p=grpapi.git --- diff --git a/drawgrp/drawgrp.vcproj b/drawgrp/drawgrp.vcproj index b7b5f2f..9f93088 100644 --- a/drawgrp/drawgrp.vcproj +++ b/drawgrp/drawgrp.vcproj @@ -318,6 +318,10 @@ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" > + + diff --git a/grpapi/GrpApi.bas b/grpapi/GrpApi.bas index c34bbed..1f6b6f1 100644 --- a/grpapi/GrpApi.bas +++ b/grpapi/GrpApi.bas @@ -24,6 +24,12 @@ Public Const ALPHA_BLEND As Long = &H8& ' Blends the graphic with what it is ' (&HBBGGRR). ' Note: Because of the extra calculations required, ' alpha blended graphics take longer to draw +Public Const USE_INDEX As Long = &H10& ' Only valid when used with a custom SetPixel function. + ' This flag cannot be used in combination with + ' ALPHA_BLEND or SHADOW_COLOR + ' When this flag is used, the index to a color in the + ' palette will be passed to your custom SetPixel + ' function instead of the actual color. ' Palette is an array of 256 Longs. Pass the first element of the array to these functions, ' rather than the actual array @@ -38,6 +44,36 @@ Declare Function GetGrpInfo Lib "Grpapi.dll" (ByVal hGrp As Long, GrpInfo As GRP Declare Function GetDC Lib "User32.dll" (ByVal hWnd As Long) As Long Declare Function ReleaseDC Lib "User32.dll" (ByVal hWnd As Long, ByVal hDC As Long) As Long +' An array of the raw image data to encode should be passed to lpImageData. To do this, +' pass the first byte of the array to the function. The size of the buffer containing +' the data should be nFrames * wMaxWidth * wMaxHeight * 2 +' and the values should be arranged row by row of the frame, with the top row first. +' After all the rows of a frame have been put into the buffer, the rows of the next frame +' go after it. For transparent pixels, they should be set to -1. All other pixels should +' have the high order byte set to zero, meaning that they should not be negative and the +' values should not exceed 255 (&HFF). The values used for the colors are indexes into the +' color palette. +' Pass True to bNoCompress if you need an uncompressed GRP. +' Pass a variable to nGrpSize to receive the size in bytes of the resulting encoded GRP. +' The return value of this function is actually a pointer to the GRP data. This is what your +' program should save to a file. The size of this buffer is the value received by nGrpSize. +' When your program is done with the returned buffer, it should call DestroyGrp on the +' buffer that was returned by this function to free up the memory from it. +' The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo. +Declare Function CreateGrp Lib "Grpapi.dll" (ByRef lpImageData As Integer, ByVal nFrames As Integer, ByVal wMaxWidth As Integer, ByVal wMaxHeight As Integer, ByVal bNoCompress As Boolean, ByRef nGrpSize As Long) As Long + +' Use this function to make a copy the memory at the location returned by CreateGrp. +' Pass the address ByVal to Source. Pass either a byte array or a string to Destination. +' The size of the array or string must be at least the size of the GRP data before +' attempting to copy it to the array or string. +' To pass a byte array, pass the first byte of the array ByRef. To pass a string, +' pass the string ByVal. +Declare Sub CopyMemory Lib "Kernel32.dll" _ + Alias "RtlMoveMemory" ( _ + ByRef Destination As Any, _ + ByRef Source As Any, _ + ByVal Length As Long) + ' Call these to have DrawGrp use custom functions for reading and drawing pixels ' so that you can have it read from and write to a buffer, for example. ' Requires Visual Basic 5 or higher @@ -66,4 +102,3 @@ Declare Function SetMpqDll Lib "Grpapi.dll" (ByVal lpDllFileName As String) As B ' These no longer need to be called Declare Function LoadGrpApi Lib "Grpapi.dll" () As Boolean Declare Sub FreeGrpApi Lib "Grpapi.dll" () - diff --git a/grpapi/grpapi.h b/grpapi/grpapi.h index bfa6864..ca5262c 100644 --- a/grpapi/grpapi.h +++ b/grpapi/grpapi.h @@ -63,6 +63,21 @@ BOOL GRPAPI WINAPI DestroyGrp(HANDLE hGrp); BOOL GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha); BOOL GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo); +// A pointer to the raw image data to encode should be passed to lpImageData. The size of +// the buffer containing the data should be nFrames * wMaxWidth * wMaxHeight * sizeof(short) +// and the values should be arranged row by row of the frame, with the top row first. +// After all the rows of a frame have been put into the buffer, the rows of the next frame +// go after it. For transparent pixels, they should be set to -1. All other pixels should +// have the high order byte set to zero, meaning that they should not be negative and the +// values should not exceed 255 (0xFF). The values used for the colors are indexes into the +// color palette. +// Pass TRUE to bNoCompress if you need an uncompressed GRP. +// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP. +// The return value of this function is actually a pointer to the GRP data. This is what your +// program should save to a file. The size of this buffer is the value received by nGrpSize. +// When your program is done with the returned buffer, it should call DestroyGrp on the +// buffer that was returned by this function to free up the memory from it. +// The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo. HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize); typedef COLORREF (WINAPI* GETPIXELPROC)( @@ -98,4 +113,3 @@ void GRPAPI WINAPI FreeGrpApi(); #endif #endif - diff --git a/grpapi/grpapi.rc b/grpapi/grpapi.rc index b57a449..7e28c64 100644 --- a/grpapi/grpapi.rc +++ b/grpapi/grpapi.rc @@ -54,8 +54,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,1 - PRODUCTVERSION 1,0,1,1 + FILEVERSION 1,1,0,1 + PRODUCTVERSION 1,1,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -76,12 +76,12 @@ BEGIN #else VALUE "FileDescription", "ShadowFlare GRP Library\0" #endif - VALUE "FileVersion", "1.01\0" + VALUE "FileVersion", "1.10\0" VALUE "InternalName", "grpapi\0" VALUE "LegalCopyright", "Copyright © ShadowFlare Software 2002-2006\0" VALUE "OriginalFilename", "grpapi.dll\0" VALUE "ProductName", "GRP Library\0" - VALUE "ProductVersion", "1, 0, 1, 1\0" + VALUE "ProductVersion", "1, 1, 0, 1\0" VALUE "Web Address", "http://shadowflare.samods.org/\0" END END diff --git a/grpapi/grpapi_no-lib.h b/grpapi/grpapi_no-lib.h index 2af7eec..a31b369 100644 --- a/grpapi/grpapi_no-lib.h +++ b/grpapi/grpapi_no-lib.h @@ -66,6 +66,21 @@ extern funcDestroyGrp DestroyGrp; extern funcDrawGrp DrawGrp; extern funcGetGrpInfo GetGrpInfo; +// A pointer to the raw image data to encode should be passed to lpImageData. The size of +// the buffer containing the data should be nFrames * wMaxWidth * wMaxHeight * sizeof(short) +// and the values should be arranged row by row of the frame, with the top row first. +// After all the rows of a frame have been put into the buffer, the rows of the next frame +// go after it. For transparent pixels, they should be set to -1. All other pixels should +// have the high order byte set to zero, meaning that they should not be negative and the +// values should not exceed 255 (0xFF). The values used for the colors are indexes into the +// color palette. +// Pass TRUE to bNoCompress if you need an uncompressed GRP. +// Pass a pointer to a DWORD value to nGrpSize to receive the size in bytes of the resulting encoded GRP. +// The return value of this function is actually a pointer to the GRP data. This is what your +// program should save to a file. The size of this buffer is the value received by nGrpSize. +// When your program is done with the returned buffer, it should call DestroyGrp on the +// buffer that was returned by this function to free up the memory from it. +// The pointer returned by this function can also be directly used by DrawGrp or GetGrpInfo. typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize); extern funcCreateGrp CreateGrp; @@ -107,4 +122,3 @@ extern funcFreeGrpApi FreeGrpApi; #endif #endif -