Function Reference


_GDIPlus_EffectCreateColorLUT

Creates a ColorLUT class effect object

#include <GDIPlus.au3>
_GDIPlus_EffectCreateColorLUT ( $aColorLUT )

Parameters

$aColorLUT An array[256][4] of a color lookup table for the color channels, alpha, red, green, and blue:
    [0][0] - first adjustment value for the alpha channel
    [0][1] - first adjustment value for the red channel
    [0][2] - first adjustment value for the green channel
    [0][3] - first adjustment value for the blue channel
    [1][0] - second adjustment value for the alpha channel
    [1][1] - second adjustment value for the red channel
    [1][2] - second adjustment value for the green channel
    [1][3] - second adjustment value for the blue channel
    ...
    255][0] - last adjustment value for the alpha channel
    [255][1] - last adjustment value for the red channel
    [255][2] - last adjustment value for the green channel
    [255][3] - last adjustment value for the blue channel

Return Value

Success: a handle to an Effect object.
Failure: 0 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).
@error: -1 - GDIPlus.dll does not support this function.
10 - Invalid parameter.

Remarks

A lookup table specifies how existing color channel values should be replaced by new values.
A color channel value of j is replaced by the jth entry in the lookup table for that channel.
For example, an existing blue channel value of 25 would be replaced by the value of $aColorLUT[25][3].

When you are done with the Effect object, call _GDIPlus_EffectDispose() to release the resources.

Related

_GDIPlus_EffectCreate, _GDIPlus_EffectDispose

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

_Example()

Func _Example()
    If Not _GDIPlus_Startup() Or @extended < 6 Then
                MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available")
                Return
        EndIf

        Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)")
        If @error Or Not FileExists($sFile) Then Return

        Local $hImage = _GDIPlus_ImageLoadFromFile($sFile)

        Local $iWidth = 600
        Local $iHeight = _GDIPlus_ImageGetHeight($hImage) * 600 / _GDIPlus_ImageGetWidth($hImage)

        Local $hGui = GUICreate("GDI+ v1.1 (" & @ScriptName & ")", $iWidth, $iHeight)
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
        GUISetState(@SW_SHOW)

        Local $aColorLUT[256][4]
        For $i = 0 To 255
                $aColorLUT[$i][0] = $i
                $aColorLUT[$i][1] = 0
                $aColorLUT[$i][2] = 0
                $aColorLUT[$i][3] = $i
        Next

        Local $hEffect = _GDIPlus_EffectCreateColorLUT($aColorLUT)
        _GDIPlus_BitmapApplyEffect($hImage, $hEffect)

        _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        _GDIPlus_EffectDispose($hEffect)
        _GDIPlus_ImageDispose($hImage)
        _GDIPlus_GraphicsDispose($hGraphics)
        _GDIPlus_Shutdown()
EndFunc   ;==>_Example