Sets the blend factors and the blend positions of a path gradient brush
#include <GDIPlus.au3>
_GDIPlus_PathBrushSetBlend ( $hPathGradientBrush, $aBlends )
$hPathGradientBrush | Pointer to a PathGradientBrush object |
$aBlends | Array of blend factors and blend positions: [0][0] - Number of blend factors and blend positions [1][0] - Factor 1 [1][1] - Position 1 [2][0] - Factor 2 [2][1] - Position 2 [n][0] - Factor n [n][1] - Position n |
Success: | True. |
Failure: | False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
Each factor and position in the array should be in the range 0.0 to 1.0.
Search GdipSetPathGradientBlend in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI = GUICreate("GDI+", 200, 180)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
_GDIPlus_GraphicsClear($hGraphics, 0xFF000000)
Local $hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddEllipse($hPath, 10, 10, 180, 160)
Local $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
_GDIPlus_PathBrushSetCenterPoint($hBrush, 100, 90)
_GDIPlus_PathBrushSetCenterColor($hBrush, 0xFFFF0000)
Local $aBlend[4][2] = [[3]]
$aBlend[1][0] = 0 ;0% center color
$aBlend[1][1] = 0 ;position = boundary
$aBlend[2][0] = 0.7 ;70% center color
$aBlend[2][1] = 0.1 ;10% of distance boundary->center point
$aBlend[3][0] = 1 ;100% center color
$aBlend[3][1] = 1 ;center point
_GDIPlus_PathBrushSetBlend($hBrush, $aBlend)
Local $aRect = _GDIPlus_PathBrushGetRect($hBrush)
_GDIPlus_GraphicsFillRect($hGraphics, $aRect[0], $aRect[1], $aRect[2], $aRect[3], $hBrush)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PathDispose($hPath)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
EndFunc ;==>Example