⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdimage.inc

📁 Powerbasic 对GDI 的操作 很漂亮的代码!
💻 INC
📖 第 1 页 / 共 5 页
字号:
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.09
' Draw a text using a True Type Font, ARGB color, optional 3D effect and orientation
  DECLARE FUNCTION ZD_DrawTextToDC LIB "GDIMAGE.DLL" ALIAS "ZD_DrawTextToDC" ( _
  BYVAL hGDImageDC AS LONG, _          ' The GDImage DC (ZI_GetDC)
  zUseText AS ASCIIZ, _                ' The text to display
  BYVAL x AS LONG, _                   ' The X seed coordinate
  BYVAL y AS LONG, _                   ' The Y seed coordinate
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use
  zUseFont AS ASCIIZ, _                ' The "Tue Type Font" name to use
  BYVAL UseSize AS LONG, _             ' The size of the font in pixel
  OPTIONAL BYVAL UseShadow AS LONG, _  ' The shadow 3D offset
  OPTIONAL BYVAL Orientation AS LONG _ ' The text orientation (%ZD_TextHorzUp, %ZD_TextVertUp, %ZD_TextVertDn)
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.09
' Compute an ARGB color to ensure compatibility with GDI+
  DECLARE FUNCTION ZD_ColorARGB LIB "GDIMAGE.DLL" ALIAS "ZD_ColorARGB"( _
  BYVAL AlphaChannel AS BYTE, _ ' The translucency level ranging from 0 to 255.
  BYVAL ColrRGB??? _            ' The classical RGB() color to use.
  ) AS LONG
' Return:
' A 32-bit ARGB color.
'****************************************************************************
'
'****************************************************************************
' Version 1.09
' To retrieve the bounding size in pixel of specifc text using a True Type Font
' of a specific size.
  DECLARE FUNCTION ZD_GetTextBound LIB "GDIMAGE.DLL" ALIAS "ZD_GetTextBound" ( _
  zUseText AS ASCIIZ, _                ' The text to display.
  zUseFont AS ASCIIZ, _                ' The "Tue Type Font" name to use.
  BYVAL UseSize AS LONG, _             ' The size of the font in pixel.
  BYREF BoundingWidth AS LONG, _       ' The bounding width.
  BYREF BoundingHeight AS LONG, _      ' The bounding height.
  OPTIONAL BYVAL Orientation AS LONG _ ' The text orientation (%ZD_TextHorzUp, %ZD_TextVertUp, %ZD_TextVertDn).
  ) AS LONG
' Return:
' The width and height of the bounding rectangle that matches the text being used.
'****************************************************************************
'
'****************************************************************************
' Version 1.09
' Create a TEXT overlay object.
' Each overlay object must have a unique identifier.
' TEXT overlay is independant of the image background that is not altered.
  DECLARE FUNCTION ZD_DrawTextToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawTextToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  zUseText AS ASCIIZ, _                ' The text to display.
  BYVAL x AS LONG, _                   ' Top left X coordinate.
  BYVAL y AS LONG, _                   ' Top left Y coordinate.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  zUseFont AS ASCIIZ, _                ' The "Tue Type Font" name to use.
  BYVAL UseSize AS LONG, _             ' The size of the font in pixel.
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  OPTIONAL BYVAL UseShadow AS LONG, _  ' The shadow 3D offset.
  OPTIONAL BYVAL Orientation AS LONG _ ' The text orientation (%ZD_TextHorzUp, %ZD_TextVertUp, %ZD_TextVertDn).
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.16
' To change on the fly the text of a TEXT overlay.
  DECLARE SUB ZD_SetObjectText LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectText" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  zUseText AS ASCIIZ _                 ' The text to display
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Create a RECTANGLE overlay object.
' Each overlay object must have a unique identifier.
' RECTANGLE overlay is independant of the image background that is not altered.
  DECLARE FUNCTION ZD_DrawRectangleToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawRectangleToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL x AS LONG, _                   ' Top left X coordinate.
  BYVAL y AS LONG, _                   ' Top left Y coordinate.
  BYVAL xWidth AS LONG, _              ' Rectangle width.
  BYVAL yHeight AS LONG, _             ' Rectangle height.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  BYVAL BorderSize AS LONG, _          ' Size of the border (can be NULL).
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  BYVAL ZD_STYLE AS LONG, _            ' The object Drawing STYLE (see below).
  OPTIONAL BYVAL Use3D AS LONG _       ' The shadow 3D offset.
  ) AS LONG
' GDImage Drawing STYLE                  Drawing mode:
' ---------------------                  -------------
' %ZD_DRAW_OUTLINE                       Border only (frame mode)
' %ZD_DRAW_FILLED                        Fill mode
' %ZD_DRAW_3DIN                          Fill with 3D-IN effect
' %ZD_DRAW_3DOUT                         Fill with 3D_Out effect
'
' Return:
' TRUE (-1) if visible, FALSE (0) if not
'****************************************************************************
'
'****************************************************************************
' Create ARROW overlay object.
' Version 1.14
' Each overlay object must have a unique identifier.
  DECLARE FUNCTION ZD_DrawArrowToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawArrowToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL SeedX AS LONG, _               ' Swap SeedX and TargetX to select arrow orientation.
  BYVAL SeedY AS LONG, _               ' Swap SeedY and TargetY to select arrow orientation.
  BYVAL TargetX AS LONG, _             ' Swap TargetX and SeedX to select arrow orientation.
  BYVAL TargetY AS LONG, _             ' Swap TargetY and SeedY to select arrow orientation.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  BYVAL ArrowSize AS LONG, _           ' Size of the Arrow.
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  BYVAL ZD_STYLE AS LONG, _            ' The Drawing mode.
  OPTIONAL BYVAL Use3D AS LONG _       ' The shadow 3D offset.
  ) AS LONG
' To change the arrow orientation, swap Seed and Target coordinates
' GDImage Drawing STYLE                  Drawing mode:
' ---------------------                  -------------
' %ZD_DRAW_FILLED                        Fill mode ONLY
'
' Return:
' TRUE (-1) if success, FALSE (0) if error
'****************************************************************************
'
'****************************************************************************
' Create ELLIPSE overlay object.
' Version 1.14
' Each overlay object must have a unique identifier.
  DECLARE FUNCTION ZD_DrawEllipseToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawEllipseToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL TopLeftX AS LONG, _            ' The top X of the rectangular region matching the ellipse size.
  BYVAL TopLeftY AS LONG, _            ' The top Y of the rectangular region matching the ellipse size.
  BYVAL BottomRightX AS LONG, _        ' The bottom X of the rectangular region matching the ellipse size.
  BYVAL BottomRightY AS LONG, _        ' The bottom Y of the rectangular region matching the ellipse size.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  BYVAL OutlineSize AS LONG, _         ' Size of the outline.
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  BYVAL ZD_STYLE AS LONG, _            ' The object Drawing STYLE (see below).
  OPTIONAL BYVAL Use3D AS LONG _       ' The shadow 3D offset.
  ) AS LONG
' The ellipse coordinates must match a rectangualr perimeter
' GDImage Drawing STYLE                  Drawing mode:
' ---------------------                  -------------
' %ZD_DRAW_OUTLINE                       Border only (frame mode)
' %ZD_DRAW_FILLED                        Fill mode
' %ZD_DRAW_3DIN                          Fill with 3D-IN effect
' %ZD_DRAW_3DOUT                         Fill with 3D_Out effect
'
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' Create CURVE overlay object.
' Version 1.14
' Each overlay object must have a unique identifier.
  DECLARE FUNCTION ZD_DrawCurveToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawCurveToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL pXY AS POINTS PTR, _           ' Pointer to an ARRAY of POINTS (holding x,y coordinates of each point).
  BYVAL ArraySize AS LONG, _           ' UBOUND - LBOUND + 1 = number of point in the array.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  BYVAL CurveSize AS LONG, _           ' Size of the curve.
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  BYVAL ZD_STYLE AS LONG, _            ' The object Drawing STYLE (see below).
  OPTIONAL BYVAL Use3D AS LONG _       ' The shadow 3D offset.
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'
' GDImage Drawing STYLE                  Drawing mode:
' ---------------------                  -------------
' %ZD_DRAW_OUTLINE                       Border only (frame mode)
' %ZD_DRAW_FILLED                        Fill mode
' %ZD_DRAW_3DIN                          Fill with 3D-IN effect
' %ZD_DRAW_3DOUT                         Fill with 3D_Out effect
' %ZD_DRAW_OPEN                          Do not apply to rectangle
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' Create POLYLINE overlay object.
' Version 1.14
' Each overlay object must have a unique identifier.
  DECLARE FUNCTION ZD_DrawPolyLineToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawPolyLineToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL pXY AS POINTS PTR, _           ' Pointer to an ARRAY of POINTS (holding x,y coordinates of each point).
  BYVAL ArraySize AS LONG, _           ' UBOUND - LBOUND + 1 = number of point in the array.
  BYVAL ColrARGB AS LONG, _            ' The ARGB color to use.
  BYVAL CurveSize AS LONG, _           ' Size of the polyline.
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ZS_STYLE AS LONG, _            ' The object Generic STYLE (use at least %ZS_VISIBLE to show it).
  BYVAL ZD_STYLE AS LONG, _            ' The object Drawing STYLE (see below).
  OPTIONAL BYVAL Use3D AS LONG _       ' The shadow 3D offset.
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error
'
' GDImage Drawing STYLE                  Drawing mode:
' ---------------------                  -------------
' %ZD_DRAW_OUTLINE                       Border only (frame mode)
' %ZD_DRAW_FILLED                        Fill mode
' %ZD_DRAW_3DIN                          Fill with 3D-IN effect
' %ZD_DRAW_3DOUT                         Fill with 3D_Out effect
' %ZD_DRAW_OPEN                          Do not apply to rectangle
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Process pending window or dialog messages during animation sequence.
  DECLARE FUNCTION ZD_DoEvents LIB "GDIMAGE.DLL" ALIAS "ZD_DoEvents" () AS LONG
' Return:
' %WM_QUIT if user presses on exit button else %NULL.
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' To show or hide a GDImage overlay object
  DECLARE SUB ZD_ShowObject LIB "GDIMAGE.DLL" ALIAS "ZD_ShowObject" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ShowOrHide AS LONG _           ' %TRUE = SHOW, %FALSE = HIDE.
  )
' Apply to any of the ZD_DrawXXXToCtrl functions.
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Check for visibility of a GDImage overlay object
  DECLARE FUNCTION ZD_IsObjectVisible LIB "GDIMAGE.DLL" ALIAS "ZD_IsObjectVisible" ( _
  BYVAL ObjID AS LONG _                ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  ) AS LONG
' Return:
' TRUE (-1) if visible, FALSE (0) if not.
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' Get the STYLE of a GDImage overlay object
  DECLARE FUNCTION ZD_GetObjectStyle LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectStyle" ( _
  BYVAL ObjID AS LONG _                ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  ) AS LONG

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -