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

📄 gdimage.inc

📁 Powerbasic 对GDI 的操作 很漂亮的代码!
💻 INC
📖 第 1 页 / 共 5 页
字号:
' Return:
' The STYLE of the object.
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' Set the STYLE of a GDImage overlay object
  DECLARE SUB ZD_SetObjectStyle LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectStyle" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL UseStyle AS LONG _             ' The new style to use (must be a valid GDImage style).
  )
' See: GDImage overlay Generic STYLE
' Note: Use ZI_UpdateWindow to refresh the display after the style change.
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' To set up the Alpha channel of a specific sprite object
  DECLARE SUB ZD_SetObjectAlpha LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectAlpha" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL Alpha AS BYTE, _               ' The alpha channel (range 0-255, 0 = transparent, 255 = opaque).
  BYVAL RedrawParent AS LONG _         ' TRUE causes immediat redraw of the object parent
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' To get the ARGB parameters of a specific sprite object
  DECLARE SUB ZD_GetObjectARGB LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectARGB" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYREF Alpha AS BYTE, _               ' The alpha channel (range 0-255, 0 = transparent, 255 = opaque).
  BYREF Red AS BYTE, _                 ' The RED component (0-255).
  BYREF Green AS BYTE, _               ' The GREEN component (0-255).
  BYREF Blue AS BYTE _                 ' The BLUE component (0-255).
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' To set the ARGB parameters of a specific sprite object
  DECLARE SUB ZD_SetObjectARGB LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectARGB" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL Alpha AS BYTE, _               ' The alpha channel (range 0-255, 0 = transparent, 255 = opaque).
  BYVAL Red AS BYTE, _                 ' The RED component (0-255).
  BYVAL Green AS BYTE, _               ' The GREEN component (0-255).
  BYVAL Blue AS BYTE _                 ' The BLUE component (0-255).
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Retrieve the immediate parent of the overlay object
  DECLARE FUNCTION ZD_GetObjectParent LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectParent" ( _
  BYVAL ObjID AS LONG _                ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  ) AS LONG
' Return:
' The GDImage control handle of the parent.
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Retrieve the bounding size that best fit the overlay object region
  DECLARE SUB ZD_GetObjectBound LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectBound" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  BYREF BoundWidth AS LONG, _          ' The bounding with
  BYREF BoundHeight AS LONG _          ' The bounding height
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Retrieve overlay object X, Y coordinates
  DECLARE SUB ZD_GetObjectXY LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectXY" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  BYREF x AS LONG, _                   ' The X coordinate
  BYREF y AS LONG _                    ' The Y coordinate
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.10
' Set the X,Y coordinates of an overlay object.
  DECLARE SUB ZD_SetObjectXY LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectXY" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  BYVAL x AS LONG, _                   ' The X coordinate
  BYVAL y AS LONG, _                   ' The Y coordinate
  BYVAL RedrawParent AS LONG _         ' TRUE causes immediat redraw of the object parent
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' To Get the Z-order of an overlay object
  DECLARE FUNCTION ZD_GetObjectZorder LIB "GDIMAGE.DLL" ALIAS "ZD_GetObjectZorder" ( _
  BYVAL ObjID AS LONG _                ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  ) AS LONG
' Return:
' The overlay object Z-order
'****************************************************************************
'
'****************************************************************************
' Version 1.14
' You can use these constants
  %ZD_ORDER_TOP    = &HFFFFFF          ' Z-order Top
  %ZD_ORDER_BOTTOM = &HFFFF&           ' Z-Order Bottom
' To Set the Z-order of an overlay object
  DECLARE FUNCTION ZD_SetObjectZorder LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectZorder" ( _
  BYVAL ObjID AS LONG, _               ' The unique object IDentifier (each object MUST USE A UNIQUE one)
  BYVAL SetOrder AS LONG _             ' The new Z-order of the object
  ) AS LONG
' Return:
' 0 = Error
' ELSE the PREVIOUS z-order of the object.
'****************************************************************************
'
'****************************************************************************
' Version 1.17
' Create a sprite BITMAP (overlay object).
  DECLARE FUNCTION ZD_DrawBitmapToCtrl LIB "GDIMAGE.DLL" ALIAS "ZD_DrawBitmapToCtrl" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  BYVAL x AS LONG, _                   ' The X coordinate.
  BYVAL y AS LONG, _                   ' The Y coordinate.
  BYVAL hBitmap AS LONG, _
  BYVAL ColrARGB AS LONG, _
  BYVAL ObjID AS LONG, _
  BYVAL ZS_STYLE AS LONG _
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error.
'****************************************************************************
'
'****************************************************************************
' Version 1.20
' To be used with a bitmap object.
' Retrieve a copy of the entire bitmap for the object IDentifier being used,
' 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 ZD_SetBitmapObjectBits.
' (see ZD_SetBitmapObjectBits)
  DECLARE FUNCTION ZD_GetBitmapObjectBits LIB "GDIMAGE.DLL" ALIAS "ZD_GetBitmapObjectBits" ( _
  BYVAL ObjID AS LONG, _                   ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  PixelArray() AS LONG _                   ' Array using 2 dimensions (Y,Y) matching the pixel coordinates.
  ) AS LONG
' Return:
' Null if error, else success.
'****************************************************************************
'
'****************************************************************************
' Version 1.20
' To be used with a bitmap object.
' Replace a copy of a bitmap that was retrieved as a device-independent bitmap.
' (see ZD_GetBitmapObjectBits)
  DECLARE FUNCTION ZD_SetBitmapObjectBits LIB "GDIMAGE.DLL" ALIAS "ZD_SetBitmapObjectBits" ( _
  BYVAL ObjID AS LONG, _                   ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  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.21
  TYPE ZPOLYGON
      pXY        AS DWORD    ' 32-bit unsigned POINTS PTR
      ArraySize  AS INTEGER  ' 16-bit signed SHORT integer
      ObjID      AS LONG     ' 32-bit signed LONG integer
      ColorARGB  AS LONG     ' 32-bit signed LONG integer
      PenSize    AS INTEGER  ' 16-bit signed SHORT integer
      ZS_Style   AS LONG     ' 32-bit signed LONG integer
      ZD_Style   AS LONG     ' 32-bit signed LONG integer
  END TYPE
'****************************************************************************
'
'****************************************************************************
' Version 1.21
' Draws a series of closed polygons.
' Each polygon is outlined or filled by using a specific pen size and ARGB color.
' The polygons drawn by this function can overlap.
  DECLARE FUNCTION ZD_PolyPolygon LIB "GDIMAGE.DLL" ALIAS "ZD_PolyPolygon" ( _
  BYVAL hGDImageCtrl AS LONG, _        ' The GDImage control handle.
  zp() AS ZPOLYGON, _                  ' The polypolygon description.
  BYVAL PolygonCount AS LONG _         ' The plygon count.
  ) AS LONG
' Return:
' TRUE (-1) if success, FALSE (0) if error
'****************************************************************************
'
'****************************************************************************
' Version 1.21
' Show or hide a list of GDImage overlay objects at once.
  DECLARE SUB ZD_ShowObjectList LIB "GDIMAGE.DLL" ALIAS "ZD_ShowObjectList" ( _
  BYVAL ObjectList AS LONG PTR, _     ' A long pointer to an array of object ID
  BYVAL ListSize AS LONG, _           ' The size of the array.
  BYVAL ShowOrHide AS LONG _          ' %TRUE = SHOW, %FALSE = HIDE.
  )
'****************************************************************************
'
'****************************************************************************
' Version 1.36
' Show or Hide a specific GDImage overlay object.
  DECLARE SUB ZD_SetObjectVisibility LIB "GDIMAGE.DLL" ALIAS "ZD_SetObjectVisibility" ( _
  BYVAL ObjID AS LONG, _      ' The unique object IDentifier (each object MUST USE A UNIQUE one).
  BYVAL ShowOrHide AS LONG _  ' A boolean TRUE/FALSE flag to show or hide the object.
  )
'****************************************************************************
'
'
'****************************************************************************
'****************************************************************************
'*                                                                          *
'*                             HELPER FUNCTIONS                             *
'*                                                                          *
'****************************************************************************
'****************************************************************************
'
'****************************************************************************
' Version 1.00
' Retrieve the instance of the current module
  DECLARE FUNCTION zInstance LIB "GDIMAGE.DLL" ALIAS "zInstance" () AS LONG
' Return:
' the instance handle of the running application.
'****************************************************************************
'
'****************************************************************************
' Version 1.07
' Beep the user.
  DECLARE SUB zFocusBeep LIB "GDIMAGE.DLL" ALIAS "zFocusBeep" ()
'****************************************************************************
'
'****************************************************************************
' Version 1.11
' Compute CPU SPEED, handy to compute animation speed.
  DECLARE FUNCTION zGetCPUspeed LIB "GDIMAGE.DLL" ALIAS "zGetCPUspeed" () AS LONG
'****************************************************************************
'
'****************************************************************************
' Version 1.00
' Check if file exist
  DECLARE FUNCTION zExist LIB "GDIMAGE.DLL" ALIAS "zExist" ( _
  BYVAL FullPathName AS STRING _ ' The name of the file to check.
  ) AS LONG
' Return:
' TRUE (-1) if exist, FALSE (0) if not.
'****************************************************************************
'
'****************************************************************************
' Version 1.16
' Generic I/O file manager faster and less overhead than built-in PB's functions.
' OPEN File
  DECLARE FUNCTION zFOpen LIB "GDIMAGE.DLL" ALIAS "zFOpen" ( _
  BYVAL FullPathName AS STRING, _ ' The name

⌨️ 快捷键说明

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