📄 gdimage.inc
字号:
zFullImagePath AS ASCIIZ, _ ' The name of an image file.
BitmapWidth AS LONG, _ ' The width of the bitmap.
BitmapHeight AS LONG _ ' The Height of the bitmap.
) AS LONG
' Return:
' A valid GDI bitmap handle (do not confuse GDI bitmap handle and GDI+ Image handle).
' Important:
' You must use DeleteObject(GDIBitmapHandle) when you do not need it anymore.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' To load the specified bitmap resource from the module's executable file.
' The resource can use any of the supported GDImage graphic format.
' (See RESOURCE.RC example)
DECLARE FUNCTION ZI_LoadBitmap LIB "GDIMAGE.DLL" ALIAS "ZI_LoadBitmap" ( _
zResourceName AS ASCIIZ _ ' The resource name identifier.
) AS LONG
' Return:
' A valid GDI bitmap handle (do not confuse GDI bitmap handle and GDI+ Image handle).
' Important:
' You must use DeleteObject(GDIBitmapHandle) when you do not need it anymore.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Create a valid GDIPLUS Image handle from FILE using any of the supported GDImage format.
DECLARE FUNCTION ZI_CreateImageFromFile LIB "GDIMAGE.DLL" ALIAS "ZI_CreateImageFromFile" ( _
zFullPathName AS ASCIIZ, _ ' Full path name to the graphic file to load.
imageWidth AS LONG, _ ' The image width.
imageHeight AS LONG, _ ' The image height.
BYVAL RemoveARGBColor AS LONG, _ ' Boolean flag use %TRUE to remove ARGBColorToRemove.
BYVAL ARGBColorToRemove AS LONG _ ' The ARGB color to remove.
) AS LONG
' Return:
' A valid GDIPLUS Image handle (do not confuse with a GDI Bitmap handle),
' or NULL if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Create an empty image background (Bitmap) into a GDImage control.
' Use it to perform direct drawing, everything lying out of it (overlay objects) would be clipped.
DECLARE FUNCTION ZI_CreateImageBackground LIB "GDIMAGE.DLL" ALIAS "ZI_CreateImageBackground" ( _
BYVAL hGDImageCtrl AS LONG, _ ' The GDImage control handle.
BYVAL BitmapWidth AS LONG, _ ' The width of the bitmap.
BYVAL BitmapHeight AS LONG _ ' The Height of the bitmap.
) AS LONG
' Return:
' A valid GDImage DC (ZI_GetDC) you can use to draw in.
' Note: After drawing into the provided DC, use ZI_UpdateWindow to refresh the display.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Remove a GDIPLUS Image object from memory.
DECLARE SUB ZI_DeleteImageObject LIB "GDIMAGE.DLL" ALIAS "ZI_DeleteImageObject" ( _
hImage AS LONG _ ' A valid GDIPLUS Image handle
)
' Comment:
' Use it as you would do with DeleteObject for a standard BITAMP handle.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Perform image rotation in the specified DC, using a GDIPLUS Image handle.
DECLARE SUB ZI_RotateImage LIB "GDIMAGE.DLL" ALIAS "ZI_RotateImage" ( _
BYVAL hDC AS LONG, _ ' A valid Device Context
BYVAL hImage AS LONG, _ ' A valid GDIPLUS Image handle
BYVAL x AS LONG, _ ' The X coordinate
BYVAL y AS LONG, _ ' The Y coordinate
BYVAL AngleDegree AS LONG, _ ' The rotation angle in degree to use
BYVAL UseAlpha AS LONG _ ' The Alpha channel value (use 255 for standard opaque mode)
)
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Render GDIPLUS Image rotation into a specific GDImage control.
DECLARE SUB ZI_RenderImageRotationToWindow LIB "GDIMAGE.DLL" ALIAS "ZI_RenderImageRotationToWindow" ( _
BYVAL hGDImageCtrl AS LONG, _ ' The GDImage control handle.
BYVAL hImage AS LONG, _ ' A valid GDIPLUS Image handle.
BYVAL x AS LONG, _ ' The X coordinate.
BYVAL y AS LONG, _ ' The Y coordinate.
BYVAL AngleDegree AS LONG, _ ' The rotation angle in degree to use.
BYVAL UseAlpha AS LONG _ ' The Alpha channel value (use 255 for standard opaque mode).
)
'****************************************************************************
'
'****************************************************************************
' Version 1.18
' Use a Bitmap to paint a tiled background in a specific GDImage control.
' Bitmap can provide from file or resource using any of the GDImage supported graphic format.
DECLARE FUNCTION ZI_SetTiledBackground LIB "GDIMAGE.DLL" ALIAS "ZI_SetTiledBackground" ( _
BYVAL hGDImageCtrl AS LONG, _ ' The GDImage control handle.
BYVAL UseBitmap AS LONG _
) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.18
' Retrieve the Bitmap handle being used to tile a background in a specific GDImage control.
DECLARE FUNCTION ZI_GetTiledBackground LIB "GDIMAGE.DLL" ALIAS "ZI_GetTiledBackground" ( _
BYVAL hGDImageCtrl AS LONG _ ' The GDImage control handle.
) AS LONG
' Return:
' The background Bitmap handle, or NULL if there is no tiled background.
'****************************************************************************
'
'****************************************************************************
' Version 1.19
' Retrieve a copy of the entire bitmap for the selected GDImageDC,
' using a 2 dimensions array of the form (x,y) pointing directly to pixel.
' You can use the array coordinates as you would do with a standard DC,
' because pixel 0,0 is at coordinate Array(0,0).
' Once your are done with the array, the bitmap is replaced using ZI_SetDIBits.
' (see ZI_SetDIBits)
DECLARE FUNCTION ZI_GetDIBits LIB "GDIMAGE.DLL" ALIAS "ZI_GetDIBits" ( _
BYVAL hGDImageDC AS LONG, _ ' Any memory bitmap Device Context (like ZI_GetDC).
PixelArray() AS LONG _ ' Array using 2 dimensions (Y,Y) matching the pixel coordinates.
) AS LONG
' Return:
' Null if error, else success.
' Comment:
' Each pixel use ARGB color of the form Alpha, Red, Blue, Green (reading from left to right).
'****************************************************************************
'
'****************************************************************************
' Version 1.19
' Replace a copy of a bitmap that was retrieved as a device-independent bitmap.
' (see ZI_GetDIBits)
DECLARE FUNCTION ZI_SetDIBits LIB "GDIMAGE.DLL" ALIAS "ZI_SetDIBits" ( _
BYVAL hGDImageDC AS LONG, _ ' Any memory bitmap Device Context (like ZI_GetDC).
PixelArray() AS LONG, _ ' Array using 2 dimensions (Y,Y) matching the pixel coordinates.
OPTIONAL BYVAL DoNotClearArray AS LONG _ ' Boolean flag, %TRUE = DO NOT clear the array
)AS LONG
' Return:
' Null if error, else success.
'****************************************************************************
'
'****************************************************************************
' Version 1.22
' Delete the memory bitmap and device context associated to a GDImage control.
DECLARE FUNCTION ZI_DeleteControlBitmap LIB "GDIMAGE.DLL" ALIAS "ZI_DeleteControlBitmap" ( _
BYVAL hGDImageCtrl AS LONG _ ' The GDImage control handle.
) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error
'****************************************************************************
'
'****************************************************************************
' Load a graphic file and Resize it on the fly to create a Bitmap matching a specific size.
' Version 1.26
DECLARE FUNCTION ZI_FitImageFromFile LIB "GDIMAGE.DLL" ALIAS "ZI_FitImageFromFile" ( _
zFullPathName AS ASCIIZ, _ ' The name of the graphic file.
BYVAL BoundWidth AS LONG, _ ' The bounding width.
BYVAL BoundHeight AS LONG _ ' The bounding height.
) AS LONG
' Note:
' The image will be stretched to match the bounding size, however keeping the original aspect ratio
' between width and height.
' Return:
' A valid GDI bitmap handle (do not confuse GDI bitmap handle and GDI+ Image handle).
'****************************************************************************
'
'****************************************************************************
' Version 1.36
' To render a GDIPLUS image rotation into a provided bitmap handle.
DECLARE FUNCTION ZI_RenderRotationFromImageToBitmap LIB "GDIMAGE.DLL" ALIAS "ZI_RenderRotationFromImageToBitmap" ( _
BYVAL SrceBitmap AS LONG, _ ' A valid GDImage bitmap handle.
BYVAL Img AS LONG, _ ' A valid GDImage - GDIPLUS handle.
BYVAL AngleDegree AS LONG, _ ' The angle rotation in degree.
BYVAL UseAlpha AS LONG _ ' The alpha channel value in the range (0-255).
) AS LONG
' Return:
' A new bitmap handle that combines the GDImage Bitmap and the GDIPLUS Image handle together.
'****************************************************************************
'
'****************************************************************************
' Version 1.37
' Display an image using a grayed mask to perform gradient translucency
DECLARE SUB ZI_DrawAlphaBlend LIB "GDIMAGE.DLL" ALIAS "ZI_DrawAlphaBlend" ( _
BYVAL hDCDest AS LONG, _ ' A valid Device Context.
BYVAL x AS LONG, _ ' The X coordinate.
BYVAL y AS LONG, _ ' The Y coordinate.
zImage AS ASCIIZ, _ ' Full path name to the graphic file to load.
zMask AS ASCIIZ _ ' Full path name to the grayed mask graphic file.
)
'****************************************************************************
'
'****************************************************************************
' Version 2.06
' Save a memory Bitmap to any of the supported graphic format
' Must be a supported graphic format, see $GDIPLUSEXT.
DECLARE FUNCTION ZI_SaveBitmapToFile LIB "GDIMAGE.DLL" ALIAS "ZI_SaveBitmapToFile" ( _
zFullPathName AS ASCIIZ, _ ' Full path name of the graphic file to save.
BYVAL hBitmap AS LONG, _ ' Bitmap handle.
OPTIONAL BYVAL JpegQuality AS LONG _ ' Optional JPEG encoding quality 1-100:
) AS LONG ' Default 0 = QalityMax = 100
' Return:
' Successfull ErrCode& = 0
' Error ErrCode
'****************************************************************************
'
'****************************************************************************
'****************************************************************************
'****************************************************************************
'*** ***
'*** DRAWING FUNCTIONS ***
'*** ***
'****************************************************************************
'****************************************************************************
'
' CONSTANTS prefixed with %ZD_ apply to DRAWING functions
%ZD_TRANSCOLOR = &HFF00FF ' Magenta color that is the default GDImage transparent color
%ZD_TOPLEFTCOLOR = -1 ' Pixel color at location 0,0
'
' ZD_DrawText constants
' Version 1.09
%ZD_TextHorzUp = &H0 ' Horizontal text orientation
%ZD_TextVertUp = &H1 ' Vertical text orientation from bottom to top
%ZD_TextVertDn = &H2 ' Vertical text orientation from top to bottom
%ZD_HIDE = &H0 ' FALSE
%ZD_SHOW = &H1 ' TRUE
' GDImage overlay Generic STYLE must be a 2^
%ZS_HIDDEN = %ZD_HIDE
%ZS_VISIBLE = %ZD_SHOW ' VISIBLE, same as %WS_VISIBLE
%ZS_SCROLL = &H2 ' MOVE with scroll bars, default is FIX (do not scroll)
%ZS_DRAFT = &H4 ' Draft drawing mode
' GDImage Drawing STYLE For all ZD_Drawxxx functions
%ZD_DRAW_OUTLINE = 1
%ZD_DRAW_FILLED = 2
%ZD_DRAW_3DIN = 3
%ZD_DRAW_3DOUT = 4
%ZD_DRAW_OPEN = 5
'
%ZD_DRAW_REDRAW = -1 ' Forces immediat redraw of parent object
%ZD_DRAW_DEFERRED = 0 ' Defers redraw of parent object
'
'****************************************************************************
' Version 1.00
' Fills a rectangle using a specific RGB color.
DECLARE SUB ZD_FillRect LIB "GDIMAGE.DLL" ALIAS "ZD_FillRect" ( _
BYVAL hGDImageDC AS LONG, _ ' The GDImage DC (ZI_GetDC)
BYVAL x AS LONG, _ ' The top left horizontal coordinate of the rectangle
BYVAL y AS LONG, _ ' The top left vertical coordinate of the rectangle
BYVAL xW AS LONG, _ ' The rectangle width
BYVAL yH AS LONG, _ ' The rectangle height
BYVAL RGBcolor AS LONG _ ' The RGB color to use
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -