Function Reference


_WinAPI_RadialGradientFill

Fills radial gradient

#include <WinAPIGdi.au3>
_WinAPI_RadialGradientFill ( $hDC, $iX, $iY, $iRadius, $iRGB1, $iRGB2 [, $fAngleStart = 0 [, $fAngleEnd = 360 [, $fStep = 5]]] )

Parameters

$hDC Handle to the device context.
$iX The x-coordinate of the central point, in logical units.
$iY The y-coordinate of the central point, in logical units.
$iRadius The circle radius to filling the gradient.
$iRGB1 The color information at the central point.
$iRGB2 The color information at the edges of circle.
$fAngleStart [optional] The angle to start filling at, in degree. Default is 0.
$fAngleEnd [optional] The angle to end filling at, in degree. Default is 360.
$fStep [optional] The gradient filling step in degree. The larger value of this parameter, the gradient will be
better, but it's require more time, and vice versa. Default is 5.

Return Value

Success: 1.
Failure: 0.

Remarks

This function does not fills gradient with transparency, and does not use antialiasing.

Example

#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIGdiDC.au3>
#include <WinAPIHObj.au3>

; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 400)
Local $idPic = GUICtrlCreatePic('', 0, 0, 400, 400)
Local $hPic = GUICtrlGetHandle($idPic)

; Create gradient
Local $hDC = _WinAPI_GetDC($hPic)
Local $hDestDC = _WinAPI_CreateCompatibleDC($hDC)
Local $hBitmap = _WinAPI_CreateCompatibleBitmapEx($hDC, 400, 400, 0xFFFFFF)
Local $hDestSv = _WinAPI_SelectObject($hDestDC, $hBitmap)
For $i = 0 To 315 Step 45
    _WinAPI_RadialGradientFill($hDestDC, 200, 200, 180, Random(0, 0xFFFFFF, 1), 0xFFFFFF, $i, $i + 45)
Next
_WinAPI_ReleaseDC($hPic, $hDC)
_WinAPI_SelectObject($hDestDC, $hDestSv)
_WinAPI_DeleteDC($hDestDC)

; Set gradient to control
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
Local $hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
    _WinAPI_DeleteObject($hBitmap)
EndIf

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE