Creates a LinearGradientBrush object from a rectangle, boundary colors and angle of direction
#include <GDIPlus.au3>
_GDIPlus_LineBrushCreateFromRectWithAngle ( $tRECTF, $iARGBClr1, $iARGBClr2, $fAngle [, $bIsAngleScalable = True [, $iWrapMode = 0]] )
$tRECTF | $tagGDIPRECTF that specifies the starting and ending points of the gradient |
$iARGBClr1 | Alpha, Red, Green and Blue components of the starting color of the line |
$iARGBClr2 | Alpha, Red, Green and Blue components of the ending color of the line |
$fAngle | Depending the value of $fIsAngleScalable, this is the angle, in degrees (see remarks) |
$bIsAngleScalable | [optional] If True, the angle of the directional line is scalable. Not scalable otherwise |
$iWrapMode | [optional] Specifies how areas filled with the brush are tiled: 0 - Tiling without flipping 1 - Tiles are flipped horizontally as you move from one tile to the next in a row 2 - Tiles are flipped vertically as you move from one tile to the next in a column 3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column 4 - No tiling takes place |
Success: | a pointer to a new LinearGradientBrush object. |
Failure: | 0 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
If $fIsAngleScalable is True, $iAngle specifies the base angle from which the angle of the directional line is calculated. Otherwise, $iAngle specifies the angle of the directional line. The angle is measured from the top of the rectangle and must be in degrees. The gradient follows the directional line.
After you are done with the object, call _GDIPlus_BrushDispose() to release the object resources.
Search GdipCreateLineBrushFromRectWithAngle in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI, $hGraphic, $hBrush, $tRECTF, $hPen, $fAngle
$hGUI = GUICreate("GDI+", 830, 340)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
$fAngle = 45
$tRECTF = _GDIPlus_RectFCreate(10, 10, 400, 300)
$hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRECTF, 0xFF000000, 0xFFFFFFFF, $fAngle, False)
_GDIPlus_LineBrushSetSigmaBlend($hBrush, 1)
_GDIPlus_GraphicsFillRect($hGraphic, 10, 10, 400, 300, $hBrush)
_GDIPlus_BrushDispose($hBrush)
$tRECTF = _GDIPlus_RectFCreate(420, 10, 400, 300)
$hBrush = _GDIPlus_LineBrushCreateFromRectWithAngle($tRECTF, 0xFF000000, 0xFFFFFFFF, $fAngle, True)
_GDIPlus_LineBrushSetSigmaBlend($hBrush, 1)
_GDIPlus_GraphicsFillRect($hGraphic, 420, 10, 400, 300, $hBrush)
$hPen = _GDIPlus_PenCreate(0x6F00007F, 2)
$fAngle *= 0.01745
_GDIPlus_GraphicsDrawLine($hGraphic, 10, 10, 10 + Cos($fAngle) * 300, 10 + Sin($fAngle) * 300, $hPen)
_GDIPlus_GraphicsDrawString($hGraphic, "$bIsAngleScalable = False", 10, 320)
$fAngle = (400 / 300) * ATan($fAngle)
_GDIPlus_GraphicsDrawLine($hGraphic, 420, 10, 420 + Cos($fAngle) * 300, 10 + Sin($fAngle) * 300, $hPen)
_GDIPlus_GraphicsDrawString($hGraphic, "IsAngleScalable = True", 420, 320)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>Example