Specifies whether gamma correction is enabled for a linear gradient brush
#include <GDIPlus.au3>
_GDIPlus_LineBrushSetGammaCorrection ( $hLineGradientBrush [, $bUseGammaCorrection = True] )
$hLineGradientBrush | Pointer to a LinearGradientBrush object |
$bUseGammaCorrection | [optional] If True, gamma correction is enabled; otherwise gamma correction is disabled |
Success: | True. |
Failure: | False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
By default, gamma correction is disabled during creation of a LinearGradientBrush object.
Gamma correction is often done to match the intensity contrast of the gradient to the ability of the human eye to perceive intensity changes.
Search GdipSetLineGammaCorrection in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
_GDIPlus_Startup() ;initialize GDI+
Local Const $iWidth = 600, $iHeight = 300, $iBgColor = 0x303030 ;$iBGColor format RRGGBB
Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", $iWidth, $iHeight) ;create a test GUI
GUISetBkColor($iBgColor, $hGUI) ;set GUI background color
GUISetState(@SW_SHOW)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing)
Local $hBrush = _GDIPlus_LineBrushCreate(0, 0, 0, 280, 0xFFFFFF00, 0xFF4020FF, 1) ;create linear gradient flipped brush
_GDIPlus_GraphicsFillRect($hGraphics, 10, 10, 280, 280, $hBrush) ;draw the filled rectangle
_GDIPlus_LineBrushSetGammaCorrection($hBrush)
_GDIPlus_GraphicsFillRect($hGraphics, 310, 10, 280, 280, $hBrush) ;draw the filled rectangle
_GDIPlus_GraphicsDrawString($hGraphics, "w/o gamma correction", 14, 14)
_GDIPlus_GraphicsDrawString($hGraphics, "w/ gamma correction", 314, 14)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;cleanup GDI+ resources
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
EndFunc ;==>Example