Sign in to follow this  
Followers 0
MachinistProgrammer

Drawing on a window

6 posts in this topic

#1 ·  Posted (edited)

im trying to make an image editor but i need to be able to draw on a GUI and have seen very little to do with it. i made a very crude script do do it but their hase to be a better way

you need px.bmp

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
$Paint = GUICreate("Paint",350,350,-1,-1,-1,-1)
GUISetState(@SW_SHOW,$Paint)

While 1
 $nMsg = GUIGetMsg()
 Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $GUI_EVENT_PRIMARYDOWN
   _paint()
 EndSwitch
WEnd
Func _paint()
 Do
 $cPos = GUIGetCursorInfo()
 GUICtrlCreatePic(@ScriptDir & "\px.bmp",$cPos[0],$cPos[1],10,10)
 Until Not $cPos[2]
EndFunc

Edit: Spelling error

px.bmp

Edited by sycam0inc

All my projects live on github

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can do it with GDIPlus.

Here is an example

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <SendMessage.au3>

Opt("TrayIconDebug", 1)

$Paint = GUICreate("Paint", 350, 350, -1, -1, -1, -1)
_GDIPlus_Startup()

$hGraphic_GUI = _GDIPlus_GraphicsCreateFromHWND($Paint)

$hBuffer_Bmp = _GDIPlus_BitmapCreateFromGraphics(350, 350, $hGraphic_GUI)
$hGraphic_Buffer_Bmp = _GDIPlus_ImageGetGraphicsContext($hBuffer_Bmp)

GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUISetState()

While 1

    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE

            ;release the resources
            _GDIPlus_GraphicsDispose($hGraphic_Buffer_Bmp)
            _GDIPlus_ImageDispose($hBuffer_Bmp)

            _GDIPlus_GraphicsDispose($hGraphic_GUI)
            _GDIPlus_Shutdown()

            Exit

        Case $GUI_EVENT_PRIMARYDOWN

            ;paint the Buffer-Img
            Paint_Buffer()

    EndSwitch
WEnd

Func Paint_Buffer()
    Do

        $cPos = GUIGetCursorInfo()
        _GDIPlus_GraphicsFillRect($hGraphic_Buffer_Bmp, $cPos[0] - 1, $cPos[1] - 1, 2, 2)

        ;don't wait for the processing of the GUI
        _Winapi_PostMessage($Paint, $WM_PAINT, 0, 0)

    Until Not $cPos[2]
EndFunc   ;==>_paint

Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam)

    ;paint the buffer image on the GUI.
    _GDIPlus_GraphicsDrawImage($hGraphic_GUI, $hBuffer_Bmp, 0, 0)

EndFunc   ;==>WM_PAINT

Seems for a workaround to make the points joined.

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here a basic image editor extracted from an older version of AutoIt Windows Screenshooter which I found on my disk:

 

#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GuiMenu.au3>
#include <Misc.au3>
#include <GuiReBar.au3>
#include <ScrollBarConstants.au3>
#include <GuiScrollBars.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>;~~~
#include <GuiToolbar.au3>
#include <StaticConstants.au3>
#include <GuiSlider.au3>


Opt("MustDeclareVars", 1)

Global $sBitmap = FileOpenDialog("Bitte eine Bilddatei laden", "", "Bilder (*.jpg;*.png;*.bmp;*.gif)")
If @error Then Exit
Global Const $dll = DllOpen("user32.dll")
_GDIPlus_Startup()
Global $hBmp = _GDIPlus_BitmapCreateFromFile($sBitmap)
Global $bW = _GDIPlus_ImageGetWidth($hBmp)
Global $bH = _GDIPlus_ImageGetHeight($hBmp)
Global $vBitmap, $IE_tmp, $IE_Pix_Size = 8
Global $hGUI_ImageEditor, $hGUI_ImageEditor_Child, $hGUI_ImageEditor_Blur, $idInput_IE_Blur, $hSlider_IE_Blur, $hGUI_ImageEditor_GS, $hSlider_IE_GS, $idInput_IE_GS, $hGUI_ImageEditor_BW, $hSlider_IE_BW, $idInput_IE_BW
Global $idInput_IE_H, $idInput_IE_HP, $idInput_IE_W, $idInput_IE_WP, $idChkBox_IE_AR, $idLabel_IE_SizeN

Global Enum $idSave_IE = 1500, $idCopy_IE, $idSend_IE, $idUndo_IE, $idPen_IE, $idHighlighter_IE, $idRectangle_IE, $idEllipse_IE, $idArrow_IE, $idColor_IE, $idText_IE, $idText_Conf_IE, $idFX_IE, _
        $idFX_IE_GS, $idFX_IE_BW, $idFX_IE_INV, $idFX_IE_BLUR, $idFX_IE_Pix, $idFX_IE_Rast, $idFX_IE_Resize
Global Const $hCursor_System = _WinAPI_CopyIcon(_WinAPI_LoadCursor(0, 32512))
Global Const $STM_SETIMAGE = 0x0172
Global $hGUI_ImageEditor, $hGUI_ImageEditor_Child, $idPic_ImageEditor, $hToolbar_IE, $IE_iItem, $TB_Button_Chk, $TB_Menu_Chk, $hPen_IE, $hPenArrow_IE, $hCursor_IE, $IE_Bmp_Undo
Global $hGfx_IE, $hGfx_IE_BMP, $hCtx_IE, $hCtx_IE_BMP
Global $IE_Pen_Col = 0xFFFF0000, $IE_PenSize = 4, $IE_HL_Col = 0x30FFFF00, $IE_HL_Col_BGR = 0x00FFFF, $IE_HLSize = 20
Global $IE_Brush_Col = 0x30FFFF00
Global $IE_offset_x = 0, $IE_offset_y = 0, $IE_Tool_Selected = 1
Global $IE_ScrollbarH = False, $IE_ScrollbarV = False, $Undo_IE = False
Global Enum $idIEPen_Size = 1600, $idIEPen_Size_1px, $idIEPen_Size_2px, $idIEPen_Size_4px, $idIEPen_Size_8px, $idIEPen_Size_16px
Global Const $hDll = DllOpen("user32.dll")

Global $IE_Dummy_Ras, $IE_Dummy_Pix, $IE_Dummy_Blur, $IE_Dummy_BW, $IE_Dummy_Res


Global Const $hMenu_IE_PS = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_AddMenuItem($hMenu_IE_PS, "1 px", $idIEPen_Size_1px)
_GUICtrlMenu_AddMenuItem($hMenu_IE_PS, "2 px", $idIEPen_Size_2px)
_GUICtrlMenu_AddMenuItem($hMenu_IE_PS, "4 px", $idIEPen_Size_4px)
_GUICtrlMenu_AddMenuItem($hMenu_IE_PS, "8 px", $idIEPen_Size_8px)
_GUICtrlMenu_AddMenuItem($hMenu_IE_PS, "16 px", $idIEPen_Size_16px)
_GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 2)

Global Const $hMenu_IE_FX = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 0, "Grayscale", $idFX_IE_GS)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 1, "Black & White", $idFX_IE_BW)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 2, "Invert", $idFX_IE_INV)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 3, "Blur", $idFX_IE_BLUR)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 4, "Pixelize", $idFX_IE_Pix)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 5, "Rasterize", $idFX_IE_Rast)
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 6, "")
_GUICtrlMenu_InsertMenuItem($hMenu_IE_FX, 7, "Resize Image", $idFX_IE_Resize)


Opt("MouseCoordMode", 2)
Opt("GUICloseOnESC", 1)
ImageEditor()
Opt("MouseCoordMode", 1)
Opt("GUICloseOnESC", 0)
_WinAPI_SetSystemCursor($hCursor_System, 32512)
_WinAPI_DestroyCursor($hCursor_IE)


DllClose($dll)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_Shutdown()
_GUICtrlMenu_DestroyMenu($hMenu_IE_PS)
_GUICtrlMenu_DestroyMenu($hMenu_IE_FX)
Exit

#region Image Editor
Func ImageEditor()
    Local $hGUI_ImageEditor_W = Int(@DesktopWidth * 0.875)
    Local $hGUI_ImageEditor_H = Int(@DesktopHeight * 0.875)
    Local $IE_TB_Style = BitOR($TBSTYLE_FLAT, $TBSTYLE_TRANSPARENT, $CCS_NORESIZE, $CCS_NOPARENTALIGN)
    Local $hHBITMAP_IE_Icons = Load_BMP_From_Mem(_ImageEditor_ToolbarIcons(), True)
    $hGUI_ImageEditor = GUICreate("AutoIt Windows Screenshooter Basic Image Editor / Image Info: " & $bW & "x" & $bH & " pixel", $hGUI_ImageEditor_W, $hGUI_ImageEditor_H)
    GUISetBkColor(0xDBE3DE, $hGUI_ImageEditor)
    $hToolbar_IE = _GUICtrlToolbar_Create($hGUI_ImageEditor, $IE_TB_Style)
    Local $idToolbar_IE = _WinAPI_GetDlgCtrlID($hToolbar_IE)
    Local $hReBar = _GUICtrlRebar_Create($hGUI_ImageEditor, BitOR($CCS_TOP, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
    Local $aStrings[14]
    Local $aInfo = ControlGetPos($hGUI_ImageEditor, "AutoIt Windows Screenshooter Basic Image Editor", $idToolbar_IE)
    Local $height_delta = 54

    #region Toolbar
    $aStrings[0] = _GUICtrlToolbar_AddString($hToolbar_IE, "  &Save  ")
    $aStrings[1] = _GUICtrlToolbar_AddString($hToolbar_IE, "  &Copy  ")
    $aStrings[2] = _GUICtrlToolbar_AddString($hToolbar_IE, "  S&end  ")
    $aStrings[3] = _GUICtrlToolbar_AddString($hToolbar_IE, "&Undo")
    $aStrings[4] = _GUICtrlToolbar_AddString($hToolbar_IE, "  &Pen  ")
    $aStrings[5] = _GUICtrlToolbar_AddString($hToolbar_IE, "Pen S&ize")
    $aStrings[6] = _GUICtrlToolbar_AddString($hToolbar_IE, "&Highlighter")
    $aStrings[7] = _GUICtrlToolbar_AddString($hToolbar_IE, "&Rectangle")
    $aStrings[8] = _GUICtrlToolbar_AddString($hToolbar_IE, "&Ellipse")
    $aStrings[9] = _GUICtrlToolbar_AddString($hToolbar_IE, "&Arrow")
    $aStrings[10] = _GUICtrlToolbar_AddString($hToolbar_IE, "C&olor")
    $aStrings[11] = _GUICtrlToolbar_AddString($hToolbar_IE, "  &Text  ")
    $aStrings[12] = _GUICtrlToolbar_AddString($hToolbar_IE, "Confi&g")
    $aStrings[13] = _GUICtrlToolbar_AddString($hToolbar_IE, "F&X")


    _GUICtrlToolbar_SetBitmapSize($hToolbar_IE, 24, 24)
    _GUICtrlToolbar_AddBitmap($hToolbar_IE, 1, 0, $hHBITMAP_IE_Icons)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idSave_IE, 2, $aStrings[0], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idCopy_IE, 3, $aStrings[1], $BTNS_AUTOSIZE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idSend_IE, 4, $aStrings[2], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idUndo_IE, 0, $aStrings[3], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idHighlighter_IE, 6, $aStrings[6], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idPen_IE, 5, $aStrings[4], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idIEPen_Size, 8, $aStrings[5], $BTNS_DROPDOWN + $BTNS_WHOLEDROPDOWN + $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idRectangle_IE, 9, $aStrings[7], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idEllipse_IE, 10, $aStrings[8], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idArrow_IE, 11, $aStrings[9], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idColor_IE, 12, $aStrings[10], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idText_IE, 13, $aStrings[11], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButton($hToolbar_IE, $idText_Conf_IE, 14, $aStrings[12], $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)

    _GUICtrlToolbar_AddButton($hToolbar_IE, $idFX_IE, 15, $aStrings[13], $BTNS_DROPDOWN + $BTNS_WHOLEDROPDOWN + $BTNS_AUTOSIZE)
    _GUICtrlToolbar_AddButtonSep($hToolbar_IE)
    #endregion

    Local $hHBitmap_ImageEditor = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    $hGUI_ImageEditor_Child = GUICreate("", $hGUI_ImageEditor_W, $hGUI_ImageEditor_H - $height_delta, 0, $height_delta, $WS_POPUP, $WS_EX_MDICHILD, $hGUI_ImageEditor)
    GUISetBkColor(0x808080, $hGUI_ImageEditor_Child)

    If $bW < $hGUI_ImageEditor_W Or $bH < ($hGUI_ImageEditor_H - $height_delta) Then
        $IE_offset_x = -($hGUI_ImageEditor_W - $bW) / 2
        $IE_offset_y = -(($hGUI_ImageEditor_H - $height_delta) - $bH) / 2
        $idPic_ImageEditor = GUICtrlCreatePic("", $IE_offset_x * - 1, ($hGUI_ImageEditor_H - $bH) / 2 - $height_delta / 2, $bW, $bH)
    Else
        $idPic_ImageEditor = GUICtrlCreatePic("", 0, 0, $bW, $bH)
    EndIf

    _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_ImageEditor, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_ImageEditor))
    _WinAPI_DeleteObject($hHBitmap_ImageEditor)

    _GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar_IE, "", 0)
    _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE)

    Local $iVSscroll = _WinAPI_GetSystemMetrics(2)
    Local $iHSscroll = _WinAPI_GetSystemMetrics(3)
    Local $iYCaption = _WinAPI_GetSystemMetrics(4)
    Local $iYFixedFrame = _WinAPI_GetSystemMetrics(8)
    Local $iXFixedFrame = _WinAPI_GetSystemMetrics(7)

    Local $iMetricsSumX = ($bH > ($hGUI_ImageEditor_H - $height_delta)) * $iVSscroll + $iXFixedFrame * 2
    Local $iMetricsSumY = ($bW > $hGUI_ImageEditor_W) * $iHSscroll + $iYCaption + $iYFixedFrame

;~  For $a = 0 To 100
;~      ConsoleWrite($a & ": " & _WinAPI_GetSystemMetrics($a) & @LF)
;~  Next

    If @OSBuild < 6000 Then
        DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolbar_IE, "wstr", "", "wstr", "")
        $IE_TB_Style = BitOR($TBSTYLE_FLAT, $TBSTYLE_TRANSPARENT)
    EndIf

    If $bW > $hGUI_ImageEditor_W Or $bH > ($hGUI_ImageEditor_H - $height_delta) Then
;~      GUISetStyle($WS_POPUP + $WS_HSCROLL + $WS_VSCROLL, $WS_EX_MDICHILD, $hGUI_ImageEditor_Child)
        _GUIScrollBars_Init($hGUI_ImageEditor_Child)
        _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_HORZ, 0)
        _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_HORZ, $bW - $hGUI_ImageEditor_W + 61 + $iMetricsSumX)
        _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_VERT, 0)
        _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_VERT, $bH - $hGUI_ImageEditor_H + $iMetricsSumY + $height_delta - 1)
        GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL_IE")
        GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL_IE")
        GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL_IE")

        GUISetState(@SW_SHOW, $hGUI_ImageEditor)
        GUISetState(@SW_SHOW, $hGUI_ImageEditor_Child)

        If $bW > $hGUI_ImageEditor_W Then
            WM_HSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
            $IE_ScrollbarH = True
        EndIf
        If $bH > ($hGUI_ImageEditor_H - $height_delta) Then
            WM_VSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
            $IE_ScrollbarV = True
        EndIf
    Else
        GUISetState(@SW_SHOW, $hGUI_ImageEditor)
        GUISetState(@SW_SHOW, $hGUI_ImageEditor_Child)
    EndIf

    Local $hWnd_Title_Icon = Load_BMP_From_Mem(_WinTitle_Icon())
    Local $hIcon_New = _WinAPI_SetWindowTitleIcon($hWnd_Title_Icon, $hGUI_ImageEditor)

    $TB_Button_Chk = GUICtrlCreateDummy()

    Local $mx, $my, $mxo, $myo, $aCI, $cc, $hIE_Bmp_Txt, $hIE_Bmp_Ctx
    Local $aIETxtFont[8] = [7, 0, "Arial", 24, 400, 0, 0, 0xFF0000]
    Local $hBrush_IE = _GDIPlus_BrushCreateSolid($IE_Brush_Col)
        $hPen_IE = _GDIPlus_PenCreate($IE_Pen_Col, $IE_PenSize)
    $hPenArrow_IE = _GDIPlus_PenCreate($IE_Pen_Col, $IE_PenSize)
    Local $arrow_len = 7 ;Int($bW / 80)
    Local $hEndCap = _GDIPlus_ArrowCapCreate($arrow_len, Int($arrow_len * 0.66))
    _GDIPlus_PenSetCustomEndCap($hPenArrow_IE, $hEndCap)
    Local $hHL_IE = _GDIPlus_PenCreate($IE_HL_Col, $IE_HLSize)


    $hGfx_IE = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($idPic_ImageEditor))
    $hGfx_IE_BMP = _GDIPlus_BitmapCreateFromGraphics($bW, $bH, $hGfx_IE)
    $hCtx_IE = _GDIPlus_ImageGetGraphicsContext($hGfx_IE_BMP)
    $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)

    _GDIPlus_GraphicsSetSmoothingMode($hGfx_IE, 2)
    _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE, 2)

    Local $startX, $startY, $area, $hGUI_ImageEditor_EnterTxt, $idEdit_IE, $idButton_IE, $IE_Text, $aTxt_Size, $aResult, $aBuffer, $keyDLL, $hCursor_IE_tmp
    Local $iMax, $hIE_Bmp_Rot, $hIE_Bmp_Ctx_Rot, $hIE_Matrix, $r
    Local $IE_Child_Active = False, $ESC_IE = False

    $IE_Dummy_Blur = GUICtrlCreateDummy()
    $IE_Dummy_BW = GUICtrlCreateDummy()
    $IE_Dummy_Pix = GUICtrlCreateDummy()
    $IE_Dummy_Ras = GUICtrlCreateDummy()
    $IE_Dummy_Res = GUICtrlCreateDummy()

    Local $blur_go, $idLabel_IE_Blur, $idButton_IE_Blur, $blur_val
    Local $bw_go, $BW_val, $idLabel_IE_BW, $idButton_IE_BW
    Local $pix_go, $hGUI_IE_PixelizeConf, $idInput_IE_PC, $idLabel_Pixel, $idButton_IE_OK, $hBild
    Local $rast_go, $iColor_Rasterize, $hGUI_ImageEditor_Raster, $idLabel_IE_Raster, $idLabel_IE_Raster_Color, $idButton_IE_Color, $idButton_IE_Color_Start, $idGraphic_Color
    Local $hGUI_IE_Resize, $idGroup_IE_ISize, $idLabel_IE_Current, $idLabel_IE_New, $idLabel_IE_SizeC, $idGroup_IE_INSize, $idLabel_IE_W1, $idLabel_IE_x, $idLabel_IE_H1, $idLabel_IE_W2, $idLabel_IE_P1, _
            $idLabel_IE_P2, $idLabel_IE_H2, $idButton_IE_IHalf, $idButton_IE_IDouble, $idGroup_IE_IMethod, $idCombo_IE, $idButton_IE_Cancel

    $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap($IE_PenSize, $IE_PenSize, BitOR(BitShift(BitAND($IE_Pen_Col, 0x000000FF), -16), BitAND($IE_Pen_Col, 0x0000FF00), BitShift(BitAND($IE_Pen_Col, 0x00FF0000), 16)))
    $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
    If (Not @error) And $aCI[4] = $idPic_ImageEditor Then _WinAPI_SetCursor($hCursor_IE)

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND_IE")
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_IE")
    GUIRegisterMsg($WM_SETCURSOR, "WM_SETCURSOR")

    Local $m1 = False, $m2 = False
    Local $aCoord[0xFFFFF][2], $z
    Do
        If WinActive($hGUI_ImageEditor) Or WinActive($hGUI_ImageEditor_Child) Then
            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
            Switch $aCI[4]
                Case 0
                    If Not $m2 Then
                        WinActivate($hGUI_ImageEditor)
                        $m1 = False
                        $m2 = True
                    EndIf
                Case Else
                    If Not $m1 Then
                        ControlClick($hGUI_ImageEditor_Child, "", $idPic_ImageEditor)
                        WinActivate($hGUI_ImageEditor_Child)
                        $m1 = True
                        $m2 = False
                    EndIf
            EndSwitch

;~          ConsoleWrite(ControlGetFocus($hGUI_ImageEditor_Child) & @CRLF)
;~          If $aCI[4] = $idPic_ImageEditor And WinActive($hGUI_ImageEditor) Then
;~              ControlClick($hGUI_ImageEditor_Child, "", $idPic_ImageEditor)
;~              WinActivate($hGUI_ImageEditor_Child)
;~          EndIf
            If $aCI[2] And $aCI[4] = $idPic_ImageEditor And WinActive($hGUI_ImageEditor_Child) Then
                _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                        "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                $Undo_IE = True

                Switch $IE_Tool_Selected
                    Case 1 ;pen
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                        Dim $aCoord[0xFFFFF][2]
                        $z = 0
                        $aCoord[0][0] = $z
                        Do
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            $z += 1
                            $aCoord[0][0] = $z
                            $aCoord[$z][0] = ($aCI[0] + $IE_PenSize / 2) + $IE_offset_x
                            $aCoord[$z][1] = ($aCI[1] + $IE_PenSize / 2) + $IE_offset_y
                            _GDIPlus_GraphicsDrawCurve2($hGfx_IE, $aCoord, 0.01, $hPen_IE)
                        Until Not $aCI[2] * Sleep(10)
                        ReDim $aCoord[$z + 1][2]
                        _GDIPlus_GraphicsDrawCurve2($hCtx_IE, $aCoord, 0.01, $hPen_IE)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                        CopyImage2Control($idPic_ImageEditor)

                    Case 2 ;highlighter
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                        Dim $aCoord[0xFFFFF][2]
                        $z = 0
                        $aCoord[0][0] = $z
                        Local $hBrush_IE_HL = _GDIPlus_BrushCreateSolid($IE_HL_Col)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                        Do
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            _GDIPlus_GraphicsFillRect($hGfx_IE, $aCI[0] + $IE_offset_x, $aCI[1] + $IE_offset_y, $IE_HLSize, $IE_HLSize, $hBrush_IE_HL)
                            _GDIPlus_GraphicsFillRect($hCtx_IE, $aCI[0] + $IE_offset_x, $aCI[1] + $IE_offset_y, $IE_HLSize, $IE_HLSize, $hBrush_IE_HL)
                        Until Not $aCI[2] * Sleep(15)
                        _GDIPlus_BrushDispose($hBrush_IE_HL)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                        CopyImage2Control($idPic_ImageEditor)
;~                      _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
;~                      $mxo = MouseGetPos(0) + $IE_HLSize / 2
;~                      $myo = MouseGetPos(1) + $IE_HLSize / 2
;~                      Do
;~                          $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
;~                          _GDIPlus_GraphicsDrawLine($hGfx_IE, ($aCI[0] + $IE_HLSize / 2) + $IE_offset_x, ($aCI[1] + $IE_HLSize / 2) + $IE_offset_y, $mxo + $IE_offset_x, $myo + $IE_offset_y, $hHL_IE)
;~                          _GDIPlus_GraphicsDrawLine($hCtx_IE, ($aCI[0] + $IE_HLSize / 2) + $IE_offset_x, ($aCI[1] + $IE_HLSize / 2) + $IE_offset_y, $mxo + $IE_offset_x, $myo + $IE_offset_y, $hHL_IE)
;~                          $mxo = $aCI[0] + $IE_HLSize / 2
;~                          $myo = $aCI[1] + $IE_HLSize / 2
;~                      Until Not $aCI[2] * Sleep(1)
;~                      _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                    Case 3 ;rectangle
                        $startX = MouseGetPos(0) - $IE_offset_x * - 1 + $IE_PenSize / 2
                        $mxo = $startX
                        $startY = MouseGetPos(1) - $IE_offset_y * - 1 + $IE_PenSize / 2
                        $myo = $startY
                        Do
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            $mx = $aCI[0] - $IE_offset_x * - 1 + $IE_PenSize / 2
                            $my = $aCI[1] - $IE_offset_y * - 1 + $IE_PenSize / 2
                            If $mx <> $mxo Or $my <> $myo Then
                                _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                                If $startX < $mx And $startY < $my Then
                                    _GDIPlus_GraphicsDrawRect($hCtx_IE, $startX, $startY, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                ElseIf $startX > $mx And $startY < $my Then
                                    _GDIPlus_GraphicsDrawRect($hCtx_IE, $mx, $startY, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                ElseIf $startX < $mx And $startY > $my Then
                                    _GDIPlus_GraphicsDrawRect($hCtx_IE, $startX, $my, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                Else
                                    _GDIPlus_GraphicsDrawRect($hCtx_IE, $mx, $my, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                EndIf
                                _GDIPlus_GraphicsDrawImageRect($hGfx_IE, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                $mxo = $mx
                                $myo = $my
                            EndIf
                        Until Not $aCI[2] * Sleep(10)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                        CopyImage2Control($idPic_ImageEditor)
                    Case 4 ;ellipse
                        $startX = MouseGetPos(0) - $IE_offset_x * - 1 + $IE_PenSize / 2
                        $mxo = $startX
                        $startY = MouseGetPos(1) - $IE_offset_y * - 1 + $IE_PenSize / 2
                        $myo = $startY
                        Do
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            $mx = $aCI[0] - $IE_offset_x * - 1 + $IE_PenSize / 2
                            $my = $aCI[1] - $IE_offset_y * - 1 + $IE_PenSize / 2
                            If $mx <> $mxo Or $my <> $myo Then
                                _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                                If $startX < $mx And $startY < $my Then
                                    _GDIPlus_GraphicsDrawEllipse($hCtx_IE, $startX, $startY, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                ElseIf $startX > $mx And $startY < $my Then
                                    _GDIPlus_GraphicsDrawEllipse($hCtx_IE, $mx, $startY, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                ElseIf $startX < $mx And $startY > $my Then
                                    _GDIPlus_GraphicsDrawEllipse($hCtx_IE, $startX, $my, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                Else
                                    _GDIPlus_GraphicsDrawEllipse($hCtx_IE, $mx, $my, Abs($startX - $mx), Abs($startY - $my), $hPen_IE)
                                EndIf
                                _GDIPlus_GraphicsDrawImageRect($hGfx_IE, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                $mxo = $mx
                                $myo = $my
                            EndIf
                        Until Not $aCI[2] * Sleep(10)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                        CopyImage2Control($idPic_ImageEditor)
                    Case 5 ;arrow
                        $startX = MouseGetPos(0) - $IE_offset_x * - 1 + $IE_PenSize / 2
                        $mxo = $startX
                        $startY = MouseGetPos(1) - $IE_offset_y * - 1 + $IE_PenSize / 2
                        $myo = $startY
                        Do
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            $mx = $aCI[0] - $IE_offset_x * - 1 + $IE_PenSize / 2
                            $my = $aCI[1] - $IE_offset_y * - 1 + $IE_PenSize / 2
                            If $mx <> $mxo Or $my <> $myo Then
                                _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hBmp, 0, 0, $bW, $bH)
                                _GDIPlus_GraphicsDrawLine($hCtx_IE, $startX, $startY, $mx, $my, $hPenArrow_IE)
                                _GDIPlus_GraphicsDrawImageRect($hGfx_IE, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                $mxo = $mx
                                $myo = $my
                            EndIf
                        Until Not $aCI[2] * Sleep(10)
                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                        CopyImage2Control($idPic_ImageEditor)
                EndSwitch
            EndIf

            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    If $ESC_IE Then
                        $ESC_IE = False
                    Else
                        ExitLoop
                    EndIf
                Case $TB_Button_Chk
                    Switch GUICtrlRead($TB_Button_Chk)
                        Case $idSave_IE
                            Save_Bitmap()
                        Case $idUndo_IE
                            If $Undo_IE Then
                                $bW = _GDIPlus_ImageGetWidth($IE_Bmp_Undo)
                                $bH = _GDIPlus_ImageGetHeight($IE_Bmp_Undo)
                                _GDIPlus_BitmapDispose($hBmp)
                                $hBmp = $IE_Bmp_Undo
                                WinSetTitle($hGUI_ImageEditor, "", "AutoIt Windows Screenshooter Basic Image Editor / Image Info: " & $bW & "x" & $bH & " pixel")

                                If $bW < $hGUI_ImageEditor_W Or $bH < ($hGUI_ImageEditor_H - $height_delta) Then
                                    $IE_offset_x = -($hGUI_ImageEditor_W - $bW) / 2
                                    $IE_offset_y = -(($hGUI_ImageEditor_H - $height_delta) - $bH) / 2
                                    GUICtrlSetPos($idPic_ImageEditor, $IE_offset_x * - 1, ($hGUI_ImageEditor_H - $bH) / 2 - $height_delta / 2, $bW, $bH)
                                Else
                                    GUICtrlSetPos($idPic_ImageEditor, 0, 0, $bW, $bH)
                                EndIf
                                $iMetricsSumX = ($bH > ($hGUI_ImageEditor_H - $height_delta)) * $iVSscroll + $iXFixedFrame * 2
                                $iMetricsSumY = ($bW > $hGUI_ImageEditor_W) * $iHSscroll + $iYCaption + $iYFixedFrame

                                _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_ImageEditor, $STM_SETIMAGE, $IMAGE_BITMAP, 0))
                                _Functions_RemoveScrollBars($hGUI_ImageEditor_Child)
                                $IE_ScrollbarH = False
                                $IE_ScrollbarV = False
                                If $bW > $hGUI_ImageEditor_W Or $bH > ($hGUI_ImageEditor_H - $height_delta) Then
                                    _GUIScrollBars_Init($hGUI_ImageEditor_Child)
                                    _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_HORZ, 0)
                                    _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_HORZ, $bW - $hGUI_ImageEditor_W + 61 + $iMetricsSumX)
                                    _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_VERT, 0)
                                    _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_VERT, $bH - $hGUI_ImageEditor_H + $iMetricsSumY + $height_delta - 1)
                                    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL_IE")
                                    GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL_IE")
                                    GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL_IE")

                                    If $bW > $hGUI_ImageEditor_W Then
                                        WM_HSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
                                        $IE_ScrollbarH = True
                                    EndIf
                                    If $bH > ($hGUI_ImageEditor_H - $height_delta) Then
                                        WM_VSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
                                        $IE_ScrollbarV = True
                                    EndIf
                                EndIf

                                _GDIPlus_GraphicsDispose($hGfx_IE)
                                _GDIPlus_GraphicsDispose($hCtx_IE)
                                _GDIPlus_ImageDispose($hCtx_IE_BMP)
                                _GDIPlus_BitmapDispose($hGfx_IE_BMP)

                                $hGfx_IE = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($idPic_ImageEditor))
                                $hGfx_IE_BMP = _GDIPlus_BitmapCreateFromGraphics($bW, $bH, $hGfx_IE)
                                $hCtx_IE = _GDIPlus_ImageGetGraphicsContext($hGfx_IE_BMP)
                                $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                                _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                                _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE, 2)
                                _GDIPlus_GraphicsSetSmoothingMode($hGfx_IE, 2)
                                CopyImage2Control($idPic_ImageEditor)
;~                              _GDIPlus_GraphicsDrawImage($hCtx_IE, $IE_Bmp_Undo, 0, 0)
;~                              _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)

                                $Undo_IE = False
                            EndIf
                        Case $idPen_IE
                            $IE_Tool_Selected = 1
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idUndo_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idHighlighter_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idRectangle_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idEllipse_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idArrow_IE, False)
                            _WinAPI_DestroyCursor($hCursor_IE)
                            $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap($IE_PenSize, $IE_PenSize, BitOR(BitShift(BitAND($IE_Pen_Col, 0x000000FF), -16), BitAND($IE_Pen_Col, 0x0000FF00), BitShift(BitAND($IE_Pen_Col, 0x00FF0000), 16)))
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            If (Not @error) And $aCI[4] = $idPic_ImageEditor Then _WinAPI_SetCursor($hCursor_IE)
                        Case $idHighlighter_IE
                            $IE_Tool_Selected = 2
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idUndo_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idHighlighter_IE)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idRectangle_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idEllipse_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idArrow_IE, False)
                            _WinAPI_DestroyCursor($hCursor_IE)
                            $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap(16, $IE_HLSize, $IE_HL_Col_BGR)
                            $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                            If (Not @error) And $aCI[4] = $idPic_ImageEditor Then _WinAPI_SetCursor($hCursor_IE)
                        Case $idRectangle_IE
                            $IE_Tool_Selected = 3
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idUndo_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idHighlighter_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idRectangle_IE)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idEllipse_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idArrow_IE, False)
                        Case $idEllipse_IE
                            $IE_Tool_Selected = 4
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idUndo_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idHighlighter_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idRectangle_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idEllipse_IE)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idArrow_IE, False)
                        Case $idArrow_IE
                            $IE_Tool_Selected = 5
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idUndo_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idPen_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idHighlighter_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idRectangle_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idEllipse_IE, False)
                            _GUICtrlToolbar_CheckButton($hToolbar_IE, $idArrow_IE)
                        Case $idColor_IE
                            $cc = _ChooseColor(2, 0xFF0000, 2, $hGUI_ImageEditor)
                            If Not @error Then
                                $IE_Pen_Col = "0xFF" & Hex($cc, 6)
                                _GDIPlus_PenSetColor($hPen_IE, $IE_Pen_Col)
                                _GDIPlus_PenSetColor($hPenArrow_IE, $IE_Pen_Col)
                                $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap($IE_PenSize, $IE_PenSize, BitOR(BitShift(BitAND($IE_Pen_Col, 0x000000FF), -16), BitAND($IE_Pen_Col, 0x0000FF00), BitShift(BitAND($IE_Pen_Col, 0x00FF0000), 16)))
                                $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                                If (Not @error) And $aCI[4] = $idPic_ImageEditor Then _WinAPI_SetCursor($hCursor_IE)
                            EndIf
                        Case $idText_IE
                            $hGUI_ImageEditor_EnterTxt = GUICreate("Enter Text", 500, 370, -1, -1, $WS_SYSMENU, Default, $hGUI_ImageEditor)
                            $idEdit_IE = GUICtrlCreateEdit("", 2, 2, 490, 290)
                            GUICtrlSetFont(-1, $aIETxtFont[3], $aIETxtFont[4], $aIETxtFont[1], $aIETxtFont[2], 5)
                            GUICtrlSetColor(-1, $aIETxtFont[7])
                            $idButton_IE = GUICtrlCreateButton("Finish", 0, 295, 494, 48)
                            GUICtrlSetFont(-1, 20)
                            GUISetState(@SW_SHOW, $hGUI_ImageEditor_EnterTxt)
                            Do
                                Switch GUIGetMsg()
                                    Case $GUI_EVENT_CLOSE, $idButton_IE
                                        ExitLoop
                                EndSwitch
                            Until False
                            $IE_Text = GUICtrlRead($idEdit_IE)
                            GUIDelete($hGUI_ImageEditor_EnterTxt)
                            If $IE_Text <> "" Then
                                $aTxt_Size = GetStringSize($IE_Text, $aIETxtFont[2], $aIETxtFont[3], $aIETxtFont[1])
                                $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $aTxt_Size[0], "int", $aTxt_Size[1], "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
                                $hIE_Bmp_Txt = $aResult[6]
                                $hIE_Bmp_Ctx = _GDIPlus_ImageGetGraphicsContext($hIE_Bmp_Txt)
                                _GDIPlus_GraphicsSetSmoothingMode($hIE_Bmp_Ctx, 2)
                                DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hIE_Bmp_Ctx, "int", 4)
                                _GDIPlus_GraphicsDrawString2($hIE_Bmp_Ctx, $IE_Text, $aIETxtFont[2], $aIETxtFont[3], $aIETxtFont[1], 0xFF000000 + $aIETxtFont[7])

                                $hCursor_IE_tmp = _WinAPI_CopyImage($hCursor_IE, $IMAGE_CURSOR)
                                _WinAPI_DestroyCursor($hCursor_IE)

                                $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap(4, 4, BitOR(0x10000 * BitXOR(BitAND(BitShift($aIETxtFont[7], 16), 0xFF), 0xFF), 0x100 * BitXOR(BitAND(BitShift($aIETxtFont[7], 8), 0xFF), 0xFF), BitXOR(BitAND($aIETxtFont[7], 0xFF), 0xFF)))

                                _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                                $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                                If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                                        "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                                $Undo_IE = True
                                Do
                                    $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                                    $mx = $aCI[0] - $IE_offset_x * - 1 - $aTxt_Size[0] / 2
                                    $my = $aCI[1] - $IE_offset_y * - 1 - $aTxt_Size[1]
                                    If $mx <> $mxo Or $my <> $myo Then
                                        _GDIPlus_GraphicsDrawImage($hCtx_IE, $hBmp, 0, 0)
                                        _GDIPlus_GraphicsDrawImageRect($hCtx_IE, $hIE_Bmp_Txt, $mx, $my, $aTxt_Size[0], $aTxt_Size[1])
                                        _GDIPlus_GraphicsDrawImageRect($hGfx_IE, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                        $mxo = $mx
                                        $myo = $my
                                    EndIf
                                    If _IsPressed("1B", $dll) Then $ESC_IE = True
                                Until ($aCI[2] * Sleep(20)) Or $ESC_IE

                                If Not $ESC_IE Then
                                    $iMax = 2 * Max($aTxt_Size[0], $aTxt_Size[1])
                                    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iMax, "int", $iMax, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
                                    $hIE_Bmp_Rot = $aResult[6]
                                    $hIE_Bmp_Ctx_Rot = _GDIPlus_ImageGetGraphicsContext($hIE_Bmp_Rot)
                                    $hIE_Matrix = _GDIPlus_MatrixCreate()
                                    _GDIPlus_MatrixTranslate($hIE_Matrix, $iMax / 2, $iMax / 2)
                                    $mxo = MouseGetPos(0)
                                    $r = 0
                                    Do
                                        $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
                                        _GDIPlus_GraphicsDrawImage($hCtx_IE, $hBmp, 0, 0)
                                        _GDIPlus_GraphicsClear($hIE_Bmp_Ctx_Rot, 0x00000000)
                                        If $mxo < $aCI[0] Then
                                            $r = 2
                                            $mxo = $aCI[0]
                                        ElseIf $mxo > $aCI[0] Then
                                            $r = -2
                                            $mxo = $aCI[0]
                                        Else
                                            $r = 0
                                        EndIf

                                        _GDIPlus_MatrixRotate($hIE_Matrix, $r)
                                        _GDIPlus_GraphicsSetTransform($hIE_Bmp_Ctx_Rot, $hIE_Matrix)
                                        _GDIPlus_GraphicsDrawImage($hIE_Bmp_Ctx_Rot, $hIE_Bmp_Txt, -$aTxt_Size[0] / 2, -$aTxt_Size[1] / 2)
                                        _GDIPlus_GraphicsDrawImage($hCtx_IE, $hIE_Bmp_Rot, $mx - $iMax / 2 + $aTxt_Size[0] / 2, $my - $iMax / 2 + $aTxt_Size[1] / 2)
                                        _GDIPlus_GraphicsDrawImageRect($hGfx_IE, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                    Until (Not $aCI[2]) * Sleep(20)

                                    _GDIPlus_GraphicsDrawImageRect($hCtx_IE_BMP, $hGfx_IE_BMP, 0, 0, $bW, $bH)
                                    CopyImage2Control($idPic_ImageEditor)
                                    _GDIPlus_MatrixDispose($hIE_Matrix)
                                    _GDIPlus_BitmapDispose($hIE_Bmp_Rot)
                                    _GDIPlus_GraphicsDispose($hIE_Bmp_Ctx_Rot)
                                    _WinAPI_DestroyCursor($hCursor_IE)
                                    $hCursor_IE = $hCursor_IE_tmp
                                Else
                                    _GDIPlus_GraphicsDrawImage($hGfx_IE, $hBmp, 0, 0)
                                EndIf
                                _GDIPlus_BitmapDispose($hIE_Bmp_Txt)
                                _GDIPlus_GraphicsDispose($hIE_Bmp_Ctx)
                            EndIf
                        Case $idText_Conf_IE
                            $aBuffer = $aIETxtFont ;save array because when _ChooseFont() has been cancelled the array will be deleted!
                            $aIETxtFont = _ChooseFont("Arial", 24, 0x0000FF) ;BGR
                            If @error Then $aIETxtFont = $aBuffer
                    EndSwitch
                Case $IE_Dummy_Blur
                    $blur_go = True
                    $hGUI_ImageEditor_Blur = GUICreate("Blur Setting", 332, 118, -1, -1, BitOR($WS_SYSMENU, $WS_GROUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
                    $hSlider_IE_Blur = _GUICtrlSlider_Create($hGUI_ImageEditor_Blur, 10, 40, 310, 45, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_BOTH, $TBS_ENABLESELRANGE, $WS_TABSTOP))
                    _GUICtrlSlider_SetRangeMin($hSlider_IE_Blur, 1)
                    _GUICtrlSlider_SetRangeMax($hSlider_IE_Blur, 900)
                    _GUICtrlSlider_SetPos($hSlider_IE_Blur, 1000 - 333)
                    $idLabel_IE_Blur = GUICtrlCreateLabel("Blur Strength", 20, 12, 83, 23)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idInput_IE_Blur = GUICtrlCreateInput(1 - 0.333, 112, 8, 95, 27, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY))
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idButton_IE_Blur = GUICtrlCreateButton("Start", 224, 8, 80, 27)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    GUISetState(@SW_SHOW, $hGUI_ImageEditor_Blur)
                    ControlFocus($hGUI_ImageEditor_Blur, "", $idButton_IE_Blur)

                    While 1
                        Switch GUIGetMsg()
                            Case $GUI_EVENT_CLOSE
                                $blur_go = False
                                ExitLoop
                            Case $idButton_IE_Blur
                                $blur_val = (1000 - _GUICtrlSlider_GetPos($hSlider_IE_Blur)) / 1000
                                ExitLoop
                        EndSwitch
                        $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Blur)
                        If $aCI[2] Then GUICtrlSetData($idInput_IE_Blur, Round(($IE_tmp / 1000), 4))
                    WEnd
                    GUIDelete($hGUI_ImageEditor_Blur)

                    If $blur_go Then
                        Local $hBild
                        _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                        $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                        If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                                "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                        $Undo_IE = True
                        $hBild = _Blur($hBmp, $bW, $bH, 0, 0, 0, 0, $blur_val)
                        _GDIPlus_BitmapDispose($hBmp)
                        $hBmp = $hBild
                        CopyImage2Control($idPic_ImageEditor)
                        _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
                        $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                        _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                    EndIf
                    WinActivate($hGUI_ImageEditor_Child)
                Case $IE_Dummy_BW
                    $BW_val = 160
                    $bw_go = True
                    $hGUI_ImageEditor_BW = GUICreate("Black&White Setting", 332, 118, -1, -1, BitOR($WS_SYSMENU, $WS_GROUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
                    $hSlider_IE_BW = _GUICtrlSlider_Create($hGUI_ImageEditor_BW, 10, 40, 310, 45, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_BOTH, $TBS_ENABLESELRANGE, $WS_TABSTOP))
                    _GUICtrlSlider_SetRangeMin($hSlider_IE_BW, 1)
                    _GUICtrlSlider_SetRangeMax($hSlider_IE_BW, 255)
                    _GUICtrlSlider_SetPos($hSlider_IE_BW, $BW_val)
                    $idLabel_IE_BW = GUICtrlCreateLabel("Black/White Treshold", 20, 2, 83, 33)
                    GUICtrlSetFont(-1, 11, 400, 0, "Times New Roman")
                    $idInput_IE_BW = GUICtrlCreateInput($BW_val, 112, 8, 95, 27, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY))
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idButton_IE_BW = GUICtrlCreateButton("Start", 224, 8, 80, 27)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    GUISetState(@SW_SHOW, $hGUI_ImageEditor_BW)
                    ControlFocus($hGUI_ImageEditor_BW, "", $idButton_IE_BW)

                    While 1
                        Switch GUIGetMsg()
                            Case $GUI_EVENT_CLOSE
                                $bw_go = False
                                GUIDelete($hGUI_ImageEditor_BW)
                                ExitLoop
                            Case $idButton_IE_BW
                                $BW_val = _GUICtrlSlider_GetPos($hSlider_IE_BW)
                                GUIDelete($hGUI_ImageEditor_BW)
                                ExitLoop
                        EndSwitch
                        $aCI = GUIGetCursorInfo($hGUI_ImageEditor_BW)
                        If $aCI[2] Then GUICtrlSetData($idInput_IE_BW, $IE_tmp)
                    WEnd

                    If $bw_go Then
                        _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                        $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                        If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                                "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                        $Undo_IE = True
                        ASM_Bitmap_Grey_BnW($hBmp, 1, $BW_val, True)
                        CopyImage2Control($idPic_ImageEditor)
                        _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
                        $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                        _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                    EndIf
                    WinActivate($hGUI_ImageEditor_Child)
                Case $IE_Dummy_Pix
                    $pix_go = True
                    $hGUI_IE_PixelizeConf = GUICreate("Pixelize Settings", 194, 43, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
                    $idInput_IE_PC = GUICtrlCreateInput($IE_Pix_Size, 78, 10, 41, 21, BitOR($ES_CENTER, $ES_NUMBER))
                    $idLabel_Pixel = GUICtrlCreateLabel("Pixel Size", 16, 10, 62, 23)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idButton_IE_OK = GUICtrlCreateButton("OK", 144, 8, 43, 25)
                    GUISetState(@SW_SHOW, $hGUI_IE_PixelizeConf)
                    ControlFocus($hGUI_IE_PixelizeConf, "", $idButton_IE_OK)

                    While 1
                        Switch GUIGetMsg()
                            Case $GUI_EVENT_CLOSE
                                Local $pix_go = False
                                ExitLoop
                            Case $idButton_IE_OK
                                ExitLoop
                        EndSwitch
                    WEnd

                    If $pix_go Then
                        _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                        $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                        If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                                "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                        $Undo_IE = True
                        ASM_Bitmap_Pixelize($hBmp, Min(GUICtrlRead($idInput_IE_PC), Min($bW, $bH)))
                        CopyImage2Control($idPic_ImageEditor)
                        GUIDelete($hGUI_IE_PixelizeConf)
                        _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
                        $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                        _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                    Else
                        GUIDelete($hGUI_IE_PixelizeConf)
                    EndIf
                    WinActivate($hGUI_ImageEditor_Child)

                Case $IE_Dummy_Ras
                    $rast_go = True
                    $iColor_Rasterize = 0x000000
                    $hGUI_ImageEditor_Raster = GUICreate("Rasterize Setting", 278, 100, -1, -1, BitOR($WS_SYSMENU, $WS_GROUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
                    $idLabel_IE_Raster = GUICtrlCreateLabel("Current Color", 6, 10, 86, 56, $SS_CENTER)
                    GUICtrlSetFont(-1, 18, 400, 0, "Times New Roman")
                    $idButton_IE_Color = GUICtrlCreateButton("Change", 176, 8, 80, 28)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idButton_IE_Color_Start = GUICtrlCreateButton("Start", 176, 40, 80, 28)
                    GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
                    $idGraphic_Color = GUICtrlCreateGraphic(100, 8, 61, 61, $SS_ETCHEDFRAME)
                    $idLabel_IE_Raster_Color = GUICtrlCreateLabel("", 104, 12, 52, 52)
                    GUICtrlSetBkColor(-1, $iColor_Rasterize)
                    GUISetState(@SW_SHOW, $hGUI_ImageEditor_Raster)
                    ControlFocus($hGUI_ImageEditor_Raster, "", $idButton_IE_Color_Start)

                    While 1
                        Switch GUIGetMsg()
                            Case $GUI_EVENT_CLOSE
                                $rast_go = False
                                ExitLoop
                            Case $idButton_IE_Color, $idLabel_IE_Raster_Color
                                $iColor_Rasterize = _ChooseColor(2, $iColor_Rasterize, 2)
                                If Not @error Then GUICtrlSetBkColor(-1, $iColor_Rasterize)
                            Case $idButton_IE_Color_Start
                                ExitLoop
                        EndSwitch
                    WEnd

                    GUIDelete($hGUI_ImageEditor_Raster)
                    If $rast_go Then
                        _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                        $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                        If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                                "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                        $Undo_IE = True
                        ASM_Bitmap_Rasterize($hBmp, $iColor_Rasterize)
                        CopyImage2Control($idPic_ImageEditor)
                        _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
                        $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                        _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                    EndIf
                    WinActivate($hGUI_ImageEditor_Child)
                Case $IE_Dummy_Res
                    GUIRegisterMsg($WM_COMMAND, "")
                    _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                    $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                    If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                            "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                    $Undo_IE = True
                    $hGUI_IE_Resize = GUICreate("Resize Image", 306, 470, -1, -1, BitOR($WS_SYSMENU, $WS_GROUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
                    GUISetFont(8, 400, 0, "Arial")

                    $idGroup_IE_ISize = GUICtrlCreateGroup(" Image Size ", 16, 8, 273, 97)
                    $idLabel_IE_Current = GUICtrlCreateLabel("Current Size:", 32, 32, 94, 22)
                    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
                    $idLabel_IE_New = GUICtrlCreateLabel("New Size:", 32, 64, 74, 22)
                    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
                    $idLabel_IE_SizeC = GUICtrlCreateLabel($bW & " x " & $bH & " Pixel", 134, 32, 129, 22, $SS_RIGHT)
                    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
                    $idLabel_IE_SizeN = GUICtrlCreateLabel($bW & " x " & $bH & " Pixel", 134, 64, 129, 22, $SS_RIGHT)
                    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
                    GUICtrlCreateGroup("", -99, -99, 1, 1)

                    $idGroup_IE_INSize = GUICtrlCreateGroup(" Set New Size ", 16, 120, 273, 185)
                    $idLabel_IE_W1 = GUICtrlCreateLabel("Width:", 36, 146, 46, 21)
                    GUICtrlSetFont(-1, 11, 400, 0, "Arial")
                    $idInput_IE_W = GUICtrlCreateInput($bW, 80, 144, 49, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idLabel_IE_x = GUICtrlCreateLabel("x", 144, 146, 11, 20)
                    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
                    $idLabel_IE_H1 = GUICtrlCreateLabel(":Height", 221, 146, 49, 21)
                    GUICtrlSetFont(-1, 11, 400, 0, "Arial")
                    $idInput_IE_H = GUICtrlCreateInput($bH, 166, 144, 49, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idLabel_IE_W2 = GUICtrlCreateLabel("Width:", 36, 183, 46, 21)
                    GUICtrlSetFont(-1, 11, 400, 0, "Arial")
                    $idInput_IE_WP = GUICtrlCreateInput("100", 80, 181, 35, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idLabel_IE_P1 = GUICtrlCreateLabel("%", 116, 185, 15, 19)
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idInput_IE_HP = GUICtrlCreateInput("100", 166, 181, 35, 23, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idLabel_IE_P2 = GUICtrlCreateLabel("%", 202, 185, 15, 19)
                    GUICtrlSetFont(-1, 9, 400, 0, "Arial")
                    $idLabel_IE_H2 = GUICtrlCreateLabel(":Height", 221, 183, 49, 21)
                    GUICtrlSetFont(-1, 11, 400, 0, "Arial")
                    $idChkBox_IE_AR = GUICtrlCreateCheckbox("Preserve Aspect Ration", 80, 220)
                    $idButton_IE_IHalf = GUICtrlCreateButton("Half", 36, 264, 75, 25)
                    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
                    $idButton_IE_IDouble = GUICtrlCreateButton("Double", 193, 264, 75, 25)
                    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
                    GUICtrlCreateGroup("", -99, -99, 1, 1)

                    $idGroup_IE_IMethod = GUICtrlCreateGroup(" Resize Method ", 16, 320, 273, 73)
                    $idCombo_IE = GUICtrlCreateCombo("", 32, 354, 241, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
                    GUICtrlSetData(-1, "0 - Default interpolation mode|1 - Low-quality mode|2 - High-quality mode|3 - Bilinear interpolation|4 - Bicubic interpolation|5 - Nearest-neighbor interpolation|6 - High-quality, bilinear interpolation|7 - High-quality, bicubic interpolation", "7 - High-quality, bicubic interpolation")
                    GUICtrlCreateGroup("", -99, -99, 1, 1)

                    $idButton_IE_OK = GUICtrlCreateButton("OK", 72, 408, 75, 25)
                    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
                    $idButton_IE_Cancel = GUICtrlCreateButton("Cancel", 160, 408, 75, 25)
                    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
                    GUISetState(@SW_SHOW, $hGUI_IE_Resize)
                    ControlFocus($hGUI_IE_Resize, "", $idButton_IE_Cancel)
                    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND_IE")

                    Local $w, $h, $maxw, $maxh, $minw, $minh
                    While 1
                        Switch GUIGetMsg()
                            Case $GUI_EVENT_CLOSE, $idButton_IE_Cancel
                                GUIDelete($hGUI_IE_Resize)
                                Return 0
                            Case $idButton_IE_OK
                                ExitLoop
                            Case $idButton_IE_IHalf
                                $maxw = Round(GUICtrlRead($idInput_IE_W) / 2, 0)
                                $maxh = Round(GUICtrlRead($idInput_IE_H) / 2, 0)
                                If $maxw > 1 Or $maxh > 1 Then
                                    GUICtrlSetData($idInput_IE_W, $maxw)
                                    GUICtrlSetData($idInput_IE_H, $maxh)
                                    GUICtrlSetData($idInput_IE_WP, Round(GUICtrlRead($idInput_IE_W) / $bW * 100))
                                    GUICtrlSetData($idInput_IE_HP, Round(GUICtrlRead($idInput_IE_H) / $bH * 100))
                                    GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
                                EndIf
                            Case $idButton_IE_IDouble
                                $minw = Round(GUICtrlRead($idInput_IE_W) * 2, 0)
                                $minh = Round(GUICtrlRead($idInput_IE_H) * 2, 0)
                                If $minw < 16384 Or $minh < 16384 Then
                                    GUICtrlSetData($idInput_IE_W, $minw)
                                    GUICtrlSetData($idInput_IE_H, $minh)
                                    GUICtrlSetData($idInput_IE_WP, Round(GUICtrlRead($idInput_IE_W) / $bW * 100))
                                    GUICtrlSetData($idInput_IE_HP, Round(GUICtrlRead($idInput_IE_H) / $bH * 100))
                                    GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
                                EndIf
                        EndSwitch
                    WEnd

                    $bW = GUICtrlRead($idInput_IE_W)
                    $bH = GUICtrlRead($idInput_IE_H)
                    Local $hBmp_New = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $bW, "int", $bH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
                    $hBmp_New = $hBmp_New[6]
                    Local $hCtx_IE_New = _GDIPlus_ImageGetGraphicsContext($hBmp_New)
                    DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hCtx_IE_New, "int", _SendMessage(GUICtrlGetHandle($idCombo_IE), $CB_GETCURSEL))
                    _GDIPlus_GraphicsDrawImageRect($hCtx_IE_New, $hBmp, 0, 0, $bW, $bH)
                    _GDIPlus_BitmapDispose($hBmp)
                    _GDIPlus_GraphicsDispose($hCtx_IE_New)

                    GUIDelete($hGUI_IE_Resize)

                    $hBmp = $hBmp_New

                    $bW = _GDIPlus_ImageGetWidth($hBmp)
                    $bH = _GDIPlus_ImageGetHeight($hBmp)

                    If $bW < $hGUI_ImageEditor_W Or $bH < ($hGUI_ImageEditor_H - $height_delta) Then
                        $IE_offset_x = -($hGUI_ImageEditor_W - $bW) / 2
                        $IE_offset_y = -(($hGUI_ImageEditor_H - $height_delta) - $bH) / 2
                        GUICtrlSetPos($idPic_ImageEditor, $IE_offset_x * - 1, ($hGUI_ImageEditor_H - $bH) / 2 - $height_delta / 2, $bW, $bH)
                    Else
                        GUICtrlSetPos($idPic_ImageEditor, 0, 0, $bW, $bH)
                    EndIf
                    $iMetricsSumX = ($bH > ($hGUI_ImageEditor_H - $height_delta)) * $iVSscroll + $iXFixedFrame * 2
                    $iMetricsSumY = ($bW > $hGUI_ImageEditor_W) * $iHSscroll + $iYCaption + $iYFixedFrame

                    _Functions_RemoveScrollBars($hGUI_ImageEditor_Child)
                    $IE_ScrollbarH = False
                    $IE_ScrollbarV = False

                    If $bW > $hGUI_ImageEditor_W Or $bH > ($hGUI_ImageEditor_H - $height_delta) Then
                        _GUIScrollBars_Init($hGUI_ImageEditor_Child)
                        _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_HORZ, 0)
                        _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_HORZ, $bW - $hGUI_ImageEditor_W + 61 + $iMetricsSumX)
                        _GUIScrollBars_SetScrollInfoMin($hGUI_ImageEditor_Child, $SB_VERT, 0)
                        _GUIScrollBars_SetScrollInfoMax($hGUI_ImageEditor_Child, $SB_VERT, $bH - $hGUI_ImageEditor_H + $iMetricsSumY + $height_delta - 1)
                        GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL_IE")
                        GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL_IE")
                        GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL_IE")

                        If $bW > $hGUI_ImageEditor_W Then
                            WM_HSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
                            $IE_ScrollbarH = True
                        EndIf
                        If $bH > ($hGUI_ImageEditor_H - $height_delta) Then
                            WM_VSCROLL_IE($hGUI_ImageEditor_Child, 0, $SB_THUMBTRACK, 0)
                            $IE_ScrollbarV = True
                        EndIf
                    Else
                        GUIRegisterMsg($WM_HSCROLL, "")
                        GUIRegisterMsg($WM_VSCROLL, "")
                        GUIRegisterMsg($WM_MOUSEWHEEL, "")
                    EndIf

                    _GDIPlus_GraphicsDispose($hGfx_IE)
                    _GDIPlus_GraphicsDispose($hCtx_IE)
                    _GDIPlus_ImageDispose($hCtx_IE_BMP)
                    _GDIPlus_BitmapDispose($hGfx_IE_BMP)

                    _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_ImageEditor, $STM_SETIMAGE, $IMAGE_BITMAP, 0))
                    CopyImage2Control($idPic_ImageEditor)

                    $hGfx_IE = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($idPic_ImageEditor))
                    $hGfx_IE_BMP = _GDIPlus_BitmapCreateFromGraphics($bW, $bH, $hGfx_IE)
                    $hCtx_IE = _GDIPlus_ImageGetGraphicsContext($hGfx_IE_BMP)
                    $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                    _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
                    _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE, 2)
                    _GDIPlus_GraphicsSetSmoothingMode($hGfx_IE, 2)

                    WinSetTitle($hGUI_ImageEditor, "", "AutoIt Windows Screenshooter Basic Image Editor / Image Info: " & $bW & "x" & $bH & " pixel")

                    WinActivate($hGUI_ImageEditor_Child)
            EndSwitch
        EndIf
    Until False

    If @OSBuild < 6000 Then DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolbar_IE, "ptr", 0, "ptr", 0)

    _WinAPI_DeleteObject($hHBITMAP_IE_Icons)
    _WinAPI_DestroyIcon($hIcon_New)
    _GDIPlus_BrushDispose($hBrush_IE)
    _GDIPlus_PenDispose($hPen_IE)
    _GDIPlus_PenDispose($hPenArrow_IE)
    _GDIPlus_PenDispose($hHL_IE)
    _GDIPlus_ArrowCapDispose($hEndCap)
    _GDIPlus_BitmapDispose($IE_Bmp_Undo)
    _GDIPlus_BitmapDispose($hWnd_Title_Icon)
    _GDIPlus_BitmapDispose($hGfx_IE_BMP)
    _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
    _GDIPlus_GraphicsDispose($hCtx_IE)
    _GDIPlus_GraphicsDispose($hGfx_IE)

    GUIRegisterMsg($WM_SETCURSOR, "")
    GUIRegisterMsg($WM_MOUSEWHEEL, "")
    GUIRegisterMsg($WM_HSCROLL, "")
    GUIRegisterMsg($WM_VSCROLL, "")
    GUIRegisterMsg($WM_COMMAND, "")
    GUIRegisterMsg($WM_NOTIFY, "")
    GUIDelete($hGUI_ImageEditor_Child)
    GUIDelete($hGUI_ImageEditor)
EndFunc   ;==>ImageEditor

Func Array_Shorten(ByRef $aArray, $iDiv)
    Local $iNew = Round(UBound($aArray) / $iDiv, 0)
    Local $aTmp[$iNew][2], $i, $j = 1
    $aTmp[0][0] = $iNew - 1
    For $i = 1 To $aTmp[0][0]
        $aTmp[$i][0] = $aArray[$j][0]
        $aTmp[$i][1] = $aArray[$j][1]
        $j += $iDiv
    Next
    $aArray = $aTmp
EndFunc

Func _Functions_RemoveScrollBars($hWnd, $horz = True, $vert = True)
    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 0)
    DllStructSetData($tSCROLLINFO, "nPage", 0)
    If $horz Then _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    If $vert Then _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
EndFunc   ;==>_Functions_RemoveScrollBars

Func CopyImage2Control($idControl)
    Local Const $hHBitmap_ImageEditor = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
    Local Const $hB = GUICtrlSendMsg($idPic_ImageEditor, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_ImageEditor)
    If $hB Then _WinAPI_DeleteObject($hB)
    _WinAPI_DeleteObject($hHBitmap_ImageEditor)
EndFunc   ;==>CopyImage2Control

Func _GDIPlus_GraphicsDrawString2($hGraphics, $sString, $sFont = "Arial", $nSize = 24, $iFormat = 0, $iColor = 0xFFFF0000, $nX = 0, $nY = 0)
    Local $hBrush = _GDIPlus_BrushCreateSolid($iColor)
    Local $hFormat = _GDIPlus_StringFormatCreate($iFormat)
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $nSize)
    Local $tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
    Local $aResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    Local $iError = @error
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    Return SetError($iError, 0, $aResult)
EndFunc   ;==>_GDIPlus_GraphicsDrawString2

Func GetStringSize($string, $font, $fontsize, $fontstyle)
    Local $iWidth = StringLen($string) * $fontsize
    Local $iHeight = 2 * $fontsize
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
    Local $hBitmap = $aResult[6]
    Local $hGrphContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate($font)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $fontsize, $fontstyle)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGrphContext, $string, $hFont, $tLayout, $hFormat)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGrphContext)
    Local $aDim[2] = [Int(DllStructGetData($aInfo[0], "Width")), Int(DllStructGetData($aInfo[0], "Height"))]
    Return $aDim
EndFunc   ;==>GetStringSize
#endregion Image Editor

Func Save_Bitmap()
    Local $m, $save, $hBmp_tmp, $ok = True
    Local $filename = FileSaveDialog("Save Image", @ScriptDir, "Images (*.jpg;*.png;*.bmp;*.gif;*.tif)", 18, "", $hGUI_ImageEditor)
    If Not @error Then
        If StringMid($filename, StringLen($filename) - 3, 1) <> "." Then
            $filename &= ".png"
            If FileExists($filename) Then
                $m = MsgBox(4 + 48, "Confirm save", $filename & " already exists." & @CRLF & "Do you want t replace it?")
                If $m = 7 Then $ok = False
            EndIf
        EndIf
        If $ok Then
            Switch StringRight($filename, 4)
                Case ".jpg"
                    Local $sCLSID = _GDIPlus_EncodersGetCLSID("JPG")
                    Local $tParams = _GDIPlus_ParamInit(1)
                    Local $tData = DllStructCreate("int Quality")
                    DllStructSetData($tData, "Quality", 90)
                    Local $pData = DllStructGetPtr($tData)
                    _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
                    Local $pParams = DllStructGetPtr($tParams)
                    $save = _GDIPlus_ImageSaveToFileEx($hBmp, $filename, $sCLSID, $pParams)
                    $tData = ""
                    $tParams = ""
                Case Else
                    $save = _GDIPlus_ImageSaveToFile($hBmp, $filename)
            EndSwitch
        EndIf

        If $save Then
            Local $c = MsgBox(4 + 64 + 256, "Information", "Image saved properly to: " & @CRLF & @CRLF & $filename & @CRLF & @CRLF & @CRLF & _
                    "Display saved image with default app?", 20, $hGUI_ImageEditor)
            If $c = 6 Then ShellExecute($filename)
        Else
            MsgBox(16, "ERROR", "Image could not be saved!", 20)
        EndIf
    EndIf
EndFunc   ;==>Save_Bitmap

Func WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $wParam, $lParam
    Switch $hWnd
        Case $hGUI_ImageEditor_Child
            Local $aMPos_IE = GUIGetCursorInfo($hGUI_ImageEditor_Child)
            If (Not @error) And ($aMPos_IE[4] = $idPic_ImageEditor) Then
                _WinAPI_SetCursor($hCursor_IE)
                Return 1
            EndIf
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SETCURSOR

Func WM_NOTIFY_IE($hWnd, $MsgID, $wParam, $lParam)
    #forceref $hWnd, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    Local $tNMTOOLBAR, $tNMTBHOTITEM, $hSubmenu, $aRet, $iMenuID

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")

    Switch $hwndFrom
        Case $hToolbar_IE
            Switch $code
                Case $NM_LDOWN
                    Switch _GUICtrlToolbar_IsButtonEnabled($hToolbar_IE, $IE_iItem)
                        Case True
                            GUICtrlSendToDummy($TB_Button_Chk, $IE_iItem)
                    EndSwitch
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $IE_iItem = $i_idNew
                    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
                Case $TBN_DROPDOWN
                    Switch $IE_iItem
                        Case $idIEPen_Size
                            _GUICtrlMenu_TrackPopupMenu($hMenu_IE_PS, $hGUI_ImageEditor)
;~                          _GUICtrlMenu_DestroyMenu($hMenu_IE_PS)
                            Return 0
                        Case $idFX_IE
                            _GUICtrlMenu_TrackPopupMenu($hMenu_IE_FX, $hGUI_ImageEditor)
;~                          _GUICtrlMenu_DestroyMenu($hMenu_IE_FX)
                            Return 0
                    EndSwitch

            EndSwitch
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_NOTIFY_IE

Func WM_COMMAND_IE($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $ilParam
    Local $nMsg_IE, $ii
    Switch BitAND($iwParam, 0x0000FFFF)
        Case $idInput_IE_W
            $ii = GUICtrlRead($idInput_IE_W)
            Switch BitAND(GUICtrlRead($idChkBox_IE_AR), $GUI_CHECKED)
                Case 0
                    GUICtrlSetData($idInput_IE_W, Max(1, Min($ii, 16384)))
                Case 1
                    GUICtrlSetData($idInput_IE_W, Max(1, Min($ii, 16384)))
                    $ii = Round(GUICtrlRead($idInput_IE_W) * $bH / $bW, 0)
                    GUICtrlSetData($idInput_IE_H, $ii)
            EndSwitch
            GUICtrlSetData($idInput_IE_WP, Round(GUICtrlRead($idInput_IE_W) / $bW * 100))
            GUICtrlSetData($idInput_IE_HP, Round(GUICtrlRead($idInput_IE_H) / $bH * 100))
            GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
        Case $idInput_IE_H
            $ii = GUICtrlRead($idInput_IE_H)
            Switch BitAND(GUICtrlRead($idChkBox_IE_AR), $GUI_CHECKED)
                Case 0
                    GUICtrlSetData($idInput_IE_H, Max(1, Min($ii, 16384)))
                Case 1
                    GUICtrlSetData($idInput_IE_H, Max(1, Min($ii, 16384)))
                    $ii = Round(GUICtrlRead($idInput_IE_H) * $bW / $bH, 0)
                    GUICtrlSetData($idInput_IE_W, $ii)
            EndSwitch
            GUICtrlSetData($idInput_IE_WP, Round(GUICtrlRead($idInput_IE_W) / $bW * 100))
            GUICtrlSetData($idInput_IE_HP, Round(GUICtrlRead($idInput_IE_H) / $bH * 100))
            GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
        Case $idInput_IE_WP
            $ii = Round(GUICtrlRead($idInput_IE_WP) / 100 * $bW, 0)
            Switch BitAND(GUICtrlRead($idChkBox_IE_AR), $GUI_CHECKED)
                Case 0
                    GUICtrlSetData($idInput_IE_W, Max(1, Min($ii, 16384)))
                Case 1
                    GUICtrlSetData($idInput_IE_W, Max(1, Min($ii, 16384)))
                    $ii = Round(GUICtrlRead($idInput_IE_W) * $bH / $bW, 0)
                    GUICtrlSetData($idInput_IE_H, $ii)
            EndSwitch
            GUICtrlSetData($idInput_IE_HP, Round(GUICtrlRead($idInput_IE_H) / $bH * 100))
            GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
        Case $idInput_IE_HP
            $ii = Round(GUICtrlRead($idInput_IE_HP) / 100 * $bH, 0)
            Switch BitAND(GUICtrlRead($idChkBox_IE_AR), $GUI_CHECKED)
                Case 0
                    GUICtrlSetData($idInput_IE_H, Max(1, Min($ii, 16384)))
                Case 1
                    GUICtrlSetData($idInput_IE_H, Max(1, Min($ii, 16384)))
                    $ii = Round(GUICtrlRead($idInput_IE_H) * $bW / $bH, 0)
                    GUICtrlSetData($idInput_IE_W, $ii)
            EndSwitch
            GUICtrlSetData($idInput_IE_WP, Round(GUICtrlRead($idInput_IE_W) / $bW * 100))
            GUICtrlSetData($idLabel_IE_SizeN, GUICtrlRead($idInput_IE_W) & " x " & GUICtrlRead($idInput_IE_H) & " Pixel")
    EndSwitch
    Switch $iwParam
        Case $idFX_IE_GS
            Local $GS_val = 128, $aCI, $gs_go = True
;~          $hGUI_ImageEditor_GS = GUICreate("Greyscale Setting", 332, 118, -1, -1, BitOR($WS_SYSMENU, $WS_GROUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $hGUI_ImageEditor)
;~          $hSlider_IE_GS = _GUICtrlSlider_Create($hGUI_ImageEditor_GS, 10, 40, 310, 45, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_BOTH, $TBS_ENABLESELRANGE, $WS_TABSTOP))
;~          _GUICtrlSlider_SetRangeMin($hSlider_IE_GS, 1)
;~          _GUICtrlSlider_SetRangeMax($hSlider_IE_GS, 255)
;~          _GUICtrlSlider_SetPos($hSlider_IE_GS, $GS_val)
;~          Local Const $idLabel_IE_GS = GUICtrlCreateLabel("Greyscale Treshold", 20, 2, 83, 33)
;~          GUICtrlSetFont(-1, 11, 400, 0, "Times New Roman")
;~          $idInput_IE_GS = GUICtrlCreateInput($GS_val, 112, 8, 95, 27, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_READONLY))
;~          GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
;~          Local Const $idButton_IE_GS = GUICtrlCreateButton("Start", 224, 8, 80, 27)
;~          GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
;~          GUISetState(@SW_SHOW, $hGUI_ImageEditor_GS)

;~          While 1
;~              $nMsg_IE = GUIGetMsg()
;~              Switch $nMsg_IE
;~                  Case $GUI_EVENT_CLOSE
;~                      GUIDelete($hGUI_ImageEditor_GS)
;~                      $gs_go = False
;~                      ExitLoop
;~                  Case $idButton_IE_GS
;~                      $GS_val = _GUICtrlSlider_GetPos($hSlider_IE_GS)
;~                      GUIDelete($hGUI_ImageEditor_GS)
;~                      ExitLoop
;~              EndSwitch
;~              $aCI = GUIGetCursorInfo($hGUI_ImageEditor_GS)
;~              If $aCI [2] Then GUICtrlSetData($idInput_IE_GS, $IE_tmp)
;~          WEnd

            If $gs_go Then
                _GDIPlus_BitmapDispose($IE_Bmp_Undo)
                $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
                If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                        "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
                $Undo_IE = True
                ASM_Bitmap_Grey_BnW($hBmp, 0, $GS_val, True)
                CopyImage2Control($idPic_ImageEditor)
                WinActivate($hGUI_ImageEditor_Child)
                _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
                $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
                _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
            EndIf
            Return 1
        Case $idFX_IE_BW
            GUICtrlSendToDummy($IE_Dummy_BW)
        Case $idFX_IE_INV
            _GDIPlus_BitmapDispose($IE_Bmp_Undo)
            $IE_Bmp_Undo = _GDIPlus_BitmapCloneArea($hBmp, 0, 0, $bW, $bH)
            If Not $IE_Bmp_Undo Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone ie undo bitmap!" & @CRLF & @CRLF & _
                    "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
            $Undo_IE = True
            ASM_Bitmap_Invert($hBmp, True)
            CopyImage2Control($idPic_ImageEditor)
            WinActivate($hGUI_ImageEditor_Child)
            _GDIPlus_GraphicsDispose($hCtx_IE_BMP)
            $hCtx_IE_BMP = _GDIPlus_ImageGetGraphicsContext($hBmp)
            _GDIPlus_GraphicsSetSmoothingMode($hCtx_IE_BMP, 2)
            Return 1
        Case $idFX_IE_BLUR
            GUICtrlSendToDummy($IE_Dummy_Blur)
            Return 1
        Case $idFX_IE_Pix
            GUICtrlSendToDummy($IE_Dummy_Pix)
            Return 1
        Case $idFX_IE_Rast
            GUICtrlSendToDummy($IE_Dummy_Ras)
            Return 1
        Case $idFX_IE_Resize
            GUICtrlSendToDummy($IE_Dummy_Res)
            Return 1
        Case $idIEPen_Size_1px
            _GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 0)
            _GDIPlus_PenSetWidth($hPen_IE, 1)
            _GDIPlus_PenSetWidth($hPenArrow_IE, 1)
            $IE_PenSize = 1
        Case $idIEPen_Size_2px
            _GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 1)
            _GDIPlus_PenSetWidth($hPen_IE, 2)
            _GDIPlus_PenSetWidth($hPenArrow_IE, 2)
            $IE_PenSize = 2
        Case $idIEPen_Size_4px
            _GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 2)
            _GDIPlus_PenSetWidth($hPen_IE, 4)
            _GDIPlus_PenSetWidth($hPenArrow_IE, 4)
            $IE_PenSize = 4
        Case $idIEPen_Size_8px
            _GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 3)
            _GDIPlus_PenSetWidth($hPen_IE, 8)
            _GDIPlus_PenSetWidth($hPenArrow_IE, 8)
            $IE_PenSize = 8
        Case $idIEPen_Size_16px
            _GUICtrlMenu_CheckRadioItem($hMenu_IE_PS, 0, 5, 4)
            _GDIPlus_PenSetWidth($hPen_IE, 16)
            _GDIPlus_PenSetWidth($hPenArrow_IE, 16)
            $IE_PenSize = 16
    EndSwitch

    If _GUICtrlToolbar_IsButtonChecked($hToolbar_IE, $idPen_IE) Or _GUICtrlToolbar_IsButtonChecked($hToolbar_IE, $idRectangle_IE) Or _GUICtrlToolbar_IsButtonChecked($hToolbar_IE, $idEllipse_IE) Or _GUICtrlToolbar_IsButtonChecked($hToolbar_IE, $idArrow_IE) Then
        _WinAPI_DestroyCursor($hCursor_IE)
        $hCursor_IE = _WinAPI_CreateSolidCursorFromBitmap($IE_PenSize, $IE_PenSize, BitOR(BitShift(BitAND($IE_Pen_Col, 0x000000FF), -16), BitAND($IE_Pen_Col, 0x0000FF00), BitShift(BitAND($IE_Pen_Col, 0x00FF0000), 16)))
        Local $aCI = GUIGetCursorInfo($hGUI_ImageEditor_Child)
        If (Not @error) And $aCI[4] = $idPic_ImageEditor Then _WinAPI_SetCursor($hCursor_IE)
    EndIf
    _GUICtrlToolbar_CheckButton($hToolbar_IE, $idIEPen_Size, False)
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_COMMAND_IE

Func WM_HSCROLL_IE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $lParam
    Local $Min, $Max, $Page, $TrackPos

    ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO_X = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO_X, "nMin")
    $Max = DllStructGetData($tSCROLLINFO_X, "nMax")
    $Page = DllStructGetData($tSCROLLINFO_X, "nPage")

    ; Save the position for comparison later on
    $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos")
    $TrackPos = DllStructGetData($tSCROLLINFO_X, "nTrackPos")
    #forceref $Min, $Max
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Switch $nScrollCode

        Case $SB_LINELEFT ; user clicked left arrow
            DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - 1)

        Case $SB_LINERIGHT ; user clicked right arrow
            DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + 1)

        Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x - $Page)

        Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO_X, "nPos", $IE_offset_x + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO_X, "nPos", $TrackPos)
    EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO_X, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO_X)

    $IE_offset_x = DllStructGetData($tSCROLLINFO_X, "nPos")
    ControlMove("", "", $idPic_ImageEditor, -$IE_offset_x, -$IE_offset_y)

    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_HSCROLL_IE

Func WM_VSCROLL_IE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $iMsg, $lParam

    Local $Min, $Max, $Page, $TrackPos

;~  ; Get all the horizontal scroll bar information
    Local $tSCROLLINFO_Y = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO_Y, "nMin")
    $Max = DllStructGetData($tSCROLLINFO_Y, "nMax")
    $Page = DllStructGetData($tSCROLLINFO_Y, "nPage")
    ; Save the position for comparison later on
    $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos")
    $TrackPos = DllStructGetData($tSCROLLINFO_Y, "nTrackPos")
    #forceref $Min, $Max
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Switch $nScrollCode

        Case $SB_LINELEFT ; user clicked left arrow
            DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - 1)

        Case $SB_LINERIGHT ; user clicked right arrow
            DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + 1)

        Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y - $Page)

        Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO_Y, "nPos", $IE_offset_y + $Page)

        Case $SB_THUMBTRACK ; user dragged the scroll box
            DllStructSetData($tSCROLLINFO_Y, "nPos", $TrackPos)
    EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO_Y, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO_Y)

    $IE_offset_y = DllStructGetData($tSCROLLINFO_Y, "nPos")

    ControlMove("", "", $idPic_ImageEditor, -$IE_offset_x, -$IE_offset_y)
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_VSCROLL_IE

Func WM_MOUSEWHEEL_IE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam
    If $hWnd = $hGUI_ImageEditor_Child Then
        Local $wheel_Dir = _WinAPI_HiWord($wParam), $y, $steps_y = 8

        If _IsPressed("10", $hDll) Or _IsPressed("02", $hDll) Then
            If $wheel_Dir > 0 And $IE_ScrollbarH Then
                For $y = 1 To $steps_y
                    _SendMessage($hGUI_ImageEditor_Child, $WM_HSCROLL, $SB_LINEUP)
                Next
            Else
                If $IE_ScrollbarH Then
                    For $y = 1 To $steps_y
                        _SendMessage($hGUI_ImageEditor_Child, $WM_HSCROLL, $SB_LINEDOWN)
                    Next
                EndIf
            EndIf
        Else
            If $wheel_Dir > 0 And $IE_ScrollbarV Then

                For $y = 1 To $steps_y
                    _SendMessage($hGUI_ImageEditor_Child, $WM_VSCROLL, $SB_LINEUP)
                Next
            Else
                If $IE_ScrollbarV Then
                    For $y = 1 To $steps_y
                        _SendMessage($hGUI_ImageEditor_Child, $WM_VSCROLL, $SB_LINEDOWN)
                    Next
                EndIf
            EndIf
        EndIf
    EndIf
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_MOUSEWHEEL_IE

Func Min($a, $b)
    If $a < $b Then Return $a
    Return $b
EndFunc   ;==>Min

Func Max($a, $b)
    If $a > $b Then Return $a
    Return $b
EndFunc   ;==>Max

Func _CreateNewBmp32($iWidth, $iHeight, ByRef $ptr, ByRef $hBild) ;erstellt leere 32-bit-Bitmap; Rückgabe $HDC und $ptr und handle auf die Bitmapdaten
    Local Const $hcdc = _WinAPI_CreateCompatibleDC(0) ;Desktop-Kompatiblen DeviceContext erstellen lassen
    Local Const $tBMI = DllStructCreate($tagBITMAPINFO) ;Struktur der Bitmapinfo erstellen und Daten eintragen
    DllStructSetData($tBMI, "Size", DllStructGetSize($tBMI) - 4);Structgröße abzüglich der Daten für die Palette
    DllStructSetData($tBMI, "Width", $iWidth)
    DllStructSetData($tBMI, "Height", -$iHeight) ;minus =standard = bottomup
    DllStructSetData($tBMI, "Planes", 1)
    DllStructSetData($tBMI, "BitCount", 32) ;32 Bit = 4 Bytes => AABBGGRR
    Local Const $adib = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0)
    $hBild = $adib[0] ;hbitmap handle auf die Bitmap, auch per GDI+ zu verwenden
    $ptr = $adib[4] ;pointer auf den Anfang der Bitmapdaten, vom Assembler verwendet
    _WinAPI_SelectObject($hcdc, $hBild) ;objekt hbitmap in DC
    Return $hcdc ;DC der Bitmap zurückgeben
EndFunc   ;==>_CreateNewBmp32

Func _GDIPlus_GraphicsDrawCurve2($hGraphics, $aPoints, $nTension, $hPen = 0)
    Local $iI, $iCount, $iTmpErr, $iTmpExt, $pPoints, $tPoints, $aResult
    __GDIPlus_PenDefCreate($hPen)
    $iCount = $aPoints[0][0]
    $tPoints = DllStructCreate("float[" & $iCount * 2 & "]")
    $pPoints = DllStructGetPtr($tPoints)
    For $iI = 1 To $iCount
        DllStructSetData($tPoints, 1, $aPoints[$iI][0], (($iI - 1) * 2) + 1)
        DllStructSetData($tPoints, 1, $aPoints[$iI][1], (($iI - 1) * 2) + 2)
    Next
    $aResult = DllCall($ghGDIPDll, "uint", "GdipDrawCurve2", "handle", $hGraphics, "hwnd", $hPen, "ptr", $pPoints, "int", $iCount, "float", $nTension)
    $iTmpErr = @error
    $iTmpExt = @extended
    __GDIPlus_PenDefDispose()
    If $iTmpErr Then Return SetError($iTmpErr, $iTmpExt, False)
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsDrawCurve2

#region functions from WinAPIEx.au3
Func _WinAPI_CreateSolidCursorFromBitmap($iW, $iH, $iColor) ;iColor in BGR format
    Local $hDC = _WinAPI_GetWindowDC(0)
    Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
    Local $hXOR = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
    Local $hSv = _WinAPI_SelectObject($hMemDC, $hXOR)
    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
    _WinAPI_SelectObject($hMemDC, $hBrush)
    Local $tRect = DllStructCreate($tagRECT)
    DllStructSetData($tRect, "Left", 0)
    DllStructSetData($tRect, "Top", 0)
    DllStructSetData($tRect, "Right", $iW)
    DllStructSetData($tRect, "Bottom", $iH)
    _WinAPI_FillRect($hMemDC, DllStructGetPtr($tRect), $hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_SelectObject($hMemDC, $hSv)
    _WinAPI_DeleteDC($hMemDC)
    _WinAPI_DeleteObject($hBrush)

    $hDC = _WinAPI_GetWindowDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
    Local Const $hAND = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
    $hSv = _WinAPI_SelectObject($hMemDC, $hAND)
    $hBrush = _WinAPI_CreateSolidBrush(0x0)
    _WinAPI_SelectObject($hMemDC, $hBrush)

    _WinAPI_FillRect($hMemDC, DllStructGetPtr($tRect), $hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_SelectObject($hMemDC, $hSv)
    _WinAPI_DeleteDC($hMemDC)
    _WinAPI_DeleteObject($hBrush)

    Local Const $hCursor = _WinAPI_CreateIconIndirect($hXOR, $hAND, 0, 0, 0)
    _WinAPI_DeleteObject($hXOR)
    _WinAPI_DeleteObject($hAND)
    Return $hCursor
EndFunc   ;==>_WinAPI_CreateSolidCursorFromBitmap

Func _WinAPI_CopyImage($hImage, $iType = 0, $xDesired = 0, $yDesired = 0, $iFlags = 0); from _WinAPIEx by Yashied
    Local $ret = DllCall('user32.dll', 'ptr', 'CopyImage', 'ptr', $hImage, 'int', $iType, 'int', $xDesired, 'int', $yDesired, 'int', $iFlags)
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return $ret[0]
EndFunc   ;==>_WinAPI_CopyImage

Func _WinAPI_LoadCursor($hInstance, $sName)
    Local $TypeOfName = 'int'
    If IsString($sName) Then $TypeOfName = 'wstr'
    Local $ret = DllCall('user32.dll', 'ptr', 'LoadCursorW', 'ptr', $hInstance, $TypeOfName, $sName)
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return $ret[0]
EndFunc   ;==>_WinAPI_LoadCursor

Func _WinAPI_SetSystemCursor($hCursor, $ID, $fCopy = 0)
    If $fCopy Then $hCursor = _WinAPI_CopyIcon($hCursor)
    Local $ret = DllCall('user32.dll', 'int', 'SetSystemCursor', 'ptr', $hCursor, 'dword', $ID)
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return 1
EndFunc   ;==>_WinAPI_SetSystemCursor

Func _WinAPI_CreateIconIndirect($hBitmap, $hMask, $XHotspot = 0, $YHotspot = 0, $fIcon = 1)
    Local $tICONINFO = DllStructCreate($tagICONINFO)
    DllStructSetData($tICONINFO, 1, $fIcon)
    DllStructSetData($tICONINFO, 2, $XHotspot)
    DllStructSetData($tICONINFO, 3, $YHotspot)
    DllStructSetData($tICONINFO, 4, $hMask)
    DllStructSetData($tICONINFO, 5, $hBitmap)
    Local $ret = DllCall('user32.dll', 'ptr', 'CreateIconIndirect', 'ptr', DllStructGetPtr($tICONINFO))
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return $ret[0]
EndFunc   ;==>_WinAPI_CreateIconIndirect

Func _WinAPI_DestroyCursor($hCursor)
    Local $ret = DllCall('user32.dll', 'int', 'DestroyCursor', 'ptr', $hCursor)
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return 1
EndFunc   ;==>_WinAPI_DestroyCursor

Func _WinAPI_SetWindowTitleIcon($sFile, $hWnd, $iW = 32, $iH = 32)
    If $sFile = "" Then Return SetError(1, 0, 0)
    If Not IsHWnd($hWnd) Then Return SetError(2, 0, 0)
    Local Const $GCL_HICON = -14, $GCL_HICONSM = -34
    Local $hImage
    If Not FileExists($sFile) Then
        If _GDIPlus_ImageGetType($sFile) = -1 Then Return SetError(3, @error, 0)
        $hImage = $sFile ;interpret $sFile as a bitmap handle
    Else
        $hImage = _GDIPlus_ImageLoadFromFile($sFile)
        If @error Then Return SetError(4, @error, 0)
    EndIf
    Local $aRes = DllCall($ghGDIPDll, "uint", "GdipGetImageThumbnail", "handle", $hImage, "uint", $iW, "uint", $iH, "int*", 0, "ptr", 0, "ptr", 0)
    If @error Then Return SetError(5, @error, 0)
    Local $hImageScaled = $aRes[4]
    $aRes = DllCall($ghGDIPDll, "uint", "GdipCreateHICONFromBitmap", "handle", $hImageScaled, "int*", 0)
    If @error Then Return SetError(6, @error, 0)
    Local $hIconNew = $aRes[2]
    Local Const $hIcon = _WinAPI_GetClassLongEx($hWnd, $GCL_HICON)
    If @error Then Return SetError(7, @error, 0)
    _WinAPI_DestroyIcon($hIcon)
    _WinAPI_SetClassLongEx($hWnd, $GCL_HICON, $hIconNew)
    If @error Then Return SetError(8, @error, 0)
    _WinAPI_SetClassLongEx($hWnd, $GCL_HICONSM, $hIconNew)
    If @error Then Return SetError(9, @error, 0)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_ImageDispose($hImageScaled)
    Return $hIconNew
EndFunc   ;==>_WinAPI_SetWindowTitleIcon

Func _WinAPI_GetClassLongEx($hWnd, $iIndex)
    Local $ret
    If @AutoItX64 Then
        $ret = DllCall('user32.dll', 'ulong_ptr', 'GetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex)
    Else
        $ret = DllCall('user32.dll', 'ulong', 'GetClassLongW', 'hwnd', $hWnd, 'int', $iIndex)
    EndIf
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return $ret[0]
EndFunc   ;==>_WinAPI_GetClassLongEx

Func _WinAPI_SetClassLongEx($hWnd, $iIndex, $iNewLong)
    Local $ret
    If @AutoItX64 Then
        $ret = DllCall('user32.dll', 'ulong_ptr', 'SetClassLongPtrW', 'hwnd', $hWnd, 'int', $iIndex, 'long_ptr', $iNewLong)
    Else
        $ret = DllCall('user32.dll', 'ulong', 'SetClassLongW', 'hwnd', $hWnd, 'int', $iIndex, 'long', $iNewLong)
    EndIf
    If (@error) Or (Not $ret[0]) Then Return SetError(1, 0, 0)
    Return $ret[0]
EndFunc   ;==>_WinAPI_SetClassLongEx
#endregion functions from WinAPIEx.au3

Func _ImageEditor_ToolbarIcons()
    Local $ImageEditor_Icons
    $ImageEditor_Icons &= 'iVBORw0KGgoAAAANSUhEUgAAAYAAAAAYCAYAAADzhSolAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEgAACxIB0t1+/AAAAAd0SU1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TEOmIwROhUxCiez72PT4+jlgsRp/Ety8uLub/AhIKBb23x+IGAAAAAElFTkSuQmCC'
    Return Binary(_Base64Decode($ImageEditor_Icons))
EndFunc   ;==>_ImageEditor_ToolbarIcons

Func _WinTitle_Icon()
    Local $WinTitle_Icon
    $WinTitle_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsSAAALEgHS3X78AAAbmElEQVR42u17aZBc13Xed+59a+89PVvPYAY7ARAARUIEKBIktVGbKZPWQqUYS0pFSio/nFS8yGUnFdvlJLYr5SWVilKWS0pcFUllRRVHtnaJ4iKR4AYSBAFimQEGg9nQs/f0dPdb75If73XPDERLIE3Ticqv6lXXvJ5+fc93zvnOd867DfzD8Q/Hz9TBGDF6Df/Pf5aML2d57nc/tuO/1urx2uJ6NH1DgP0sAfDAkeJ7joyan3RM6r/hiPlZMT5jMesf3dX76dlVsXZ1KXj+Rj9nvJmLJAKZBjMdy8jkXSvLCNmevO0anDEAWG2FQSyU54ei5YWiHcYyUkqrG7n3sd2Zgzv7nXsfP7fyo3pb1P6fAMAymNlbdPp2DOQP7KoWj+wcLN7SV87tLubcgVzGzjNuuKZhcGhJMg4RhqHUWodhLFvtQCwtrnlXri40z0zMNU5erjXOLjX8xVgo8WNhTKCH7+57uNGOc2em/e9IpcUNO+WNNto2ubWrmt9zdF/ve9+yq+/924d6bsnnC72mnTW56YBxC8Q4QLTl65USiNrraNfnoZXcck+tIbwwXppebJ588mztS0+eq3276UXtzvujFbPv0d8+9MzpK82+X/3SzF0zK+G5NzUCiICevF05frDvA++6dejje0b735Yt9BRMJ0/MsEHEoHVqzBbMNaAJGgBjBpx8D5SS8Orz19/fyDpm9cBozwP7R3o+cN+RkUf/29fP/uuJWmMcAB64vXyfa+gdl2rR84uNeOK1rN342xpe7XEH7r9j6BPvvHXo04MDA3vtXIVzywWIoDWw2vCw5nNYTgY69lDMmCjmM9AAoBWUVBuQaILlZOETQXcQ+/HvNHdV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AAAASUVORK5CYII='
    Return Binary(_Base64Decode($WinTitle_Icon))
EndFunc   ;==>_WinTitle_Icon

Func Load_BMP_From_Mem($bImage, $hHBITMAP = False)
    If Not IsBinary($bImage) Then Return SetError(1, 0, 0)
    Local $aResult
    Local Const $memBitmap = Binary($bImage) ;load image  saved in variable (memory) and convert it to binary
    Local Const $len = BinaryLen($memBitmap) ;get length of image
    Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory  ($GMEM_MOVEABLE = 0x0002)
    Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer
    Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct
    DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data
    _MemGlobalUnlock($hData) ;decrements the lock count  associated with a memory object that was allocated with GMEM_MOVEABLE
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents
    If @error Then Return SetError(2, 0, 0)
    Local Const $hStream = $aResult[3]
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface
    If @error Then Return SetError(3, 0, 0)
    Local Const $hBitmap = $aResult[2]
    Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
    DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
            "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) ;release memory from $hStream to avoid memory leak
    $tMem = 0
    $tVARIANT = 0
    If $hHBITMAP Then
        Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
        _GDIPlus_BitmapDispose($hBitmap)
        Return $hHBmp
    EndIf
    Return $hBitmap
EndFunc   ;==>Load_BMP_From_Mem

Func _Blur($hBitmap, $iW, $iH, $dx1 = -5, $dx2 = -3, $dy1 = 12, $dy2 = 9, $fScale = 0.175, $qual = 6); by eukalyptus
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
    Local $hBmpSmall = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall)
    DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "handle", $hGfxSmall, "int", 2)
    Local $hBmpBig = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
    Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig)
    DllCall($ghGDIPDll, "uint", "GdipSetPixelOffsetMode", "handle", $hGfxBig, "int", 2)
    _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale)
    _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual)

    _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale)
    _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual)

    _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy2)
    _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2)

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBmpSmall)
    _GDIPlus_GraphicsDispose($hGfxSmall)
    _GDIPlus_GraphicsDispose($hGfxBig)
    Return $hBmpBig
EndFunc   ;==>_Blur

Func ASM_Bitmap_Pixelize($bmp, $iSize = 8) ;ASM code by TheShadowAE
    Local $w = _GDIPlus_ImageGetWidth($bmp), $h = _GDIPlus_ImageGetHeight($bmp)
    $w -= Mod($w, $iSize)
    $h -= Mod($h, $iSize)
    Local Const $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bmp)
    Local $yBmp, $ptr
    Local Const $dc = _CreateNewBmp32($w, $h, $ptr, $yBmp)
    Local Const $xdc = _WinAPI_CreateCompatibleDC(0)
    Local Const $dc_obj = _WinAPI_SelectObject($xdc, $hHBmp)
    _WinAPI_BitBlt($dc, 0, 0, $w, $h, $xdc, 0, 0, $SRCCOPY)
    Local Const $bASM_Pix = "0x8B5C240C8B7C24106BFF048B7424046BF6048B5424088B4C24048B035351528B54241C8B4C241C890383C3044975F801F329FB4A75ED5A595B01FB2B4C241075D98B442410480FAFC601C32B54241075C5C3"
    Local $tCodeBuffer = DllStructCreate("byte[" & BinaryLen($bASM_Pix) & "]") ;reserve Memory for opcodes
    DllStructSetData($tCodeBuffer, 1, $bASM_Pix) ;write opcodes into memory
    DllCall("kernel32.dll", "int", "VirtualProtect", "ptr", DllStructGetPtr($tCodeBuffer), "ulong", BinaryLen($bASM_Pix), "dword", $PAGE_EXECUTE_READWRITE, "dword*", 0) ;avoid crash when DEP is activates for all programs and services! Thanks to progandy
    DllCall("user32.dll", "none", "CallWindowProcW", "ptr", DllStructGetPtr($tCodeBuffer), "int", $w, "int", $h, "ptr", $ptr, "int", $iSize)
    _GDIPlus_BitmapDispose($hBmp)
    $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($yBmp)
    _WinAPI_DeleteObject($yBmp)
    _WinAPI_DeleteObject($hHBmp)
    _WinAPI_SelectObject($xdc, $dc_obj)
    _WinAPI_DeleteDC($xdc)
    _WinAPI_ReleaseDC(0, $dc)
    $ptr = 0
    $tCodeBuffer = 0
EndFunc   ;==>ASM_Bitmap_Pixelize

Func ASM_Bitmap_Rasterize($vBmp, $iColor = 0x000000) ;ASM code by AndyG
    $vBitmap = _GDIPlus_BitmapCloneArea($vBmp, 0, 0, $bW, $bH)
    If Not $vBitmap Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone bitmap!" & @CRLF & @CRLF & _
            "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
    Local Const $hBitmapData = _GDIPlus_BitmapLockBits($vBitmap, 0, 0, $bW, $bH, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32RGB)
    Local Const $Scan = DllStructGetData($hBitmapData, "Scan0")
    Local Const $Stride = DllStructGetData($hBitmapData, "Stride")
    Local $tPixelData = DllStructCreate("dword[" & (Abs($Stride * $bH)) & "]", $Scan)
    Local Const $bASM_Rasterize = "0x8B7424048B4C24088B7C240C8B4424100FBAE0007238BB0100000039C3730E893E83C60883C30283E90277EFC30FBAE300730EBB0000000083C60483E90177DBC3BB0100000083EE0483C101EBCD893E83C60883E90277F6C3"

    Local Const $iSize = BinaryLen($bASM_Rasterize)
    Local Const $pCodeBuffer = _MemVirtualAlloc(0, $iSize, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    Local $tCodeBuffer = DllStructCreate("byte[" & $iSize & "]", $pCodeBuffer)
    DllStructSetData($tCodeBuffer, 1, $bASM_Rasterize)
    DllCallAddress("int:cdecl", $pCodeBuffer, "ptr", DllStructGetPtr($tPixelData), "int", $bW * $bH, "int", $iColor, "int", $bW)
    _MemVirtualFree($pCodeBuffer, $iSize, $MEM_DECOMMIT)

    _GDIPlus_BitmapUnlockBits($vBitmap, $hBitmapData)
    _GDIPlus_BitmapDispose($vBmp)
    $hBmp = $vBitmap
    $tCodeBuffer = 0
    $tPixelData = 0
EndFunc   ;==>ASM_Bitmap_Rasterize

Func ASM_Bitmap_Grey_BnW($vBmp, $iBlackAndWhite = 0, $iLight = 160, $skip = False) ;ASM code by AndyG
;~  $undo = _GDIPlus_BitmapCloneArea($vBmp, 0, 0, $bW, $bH)
;~  $undo_chk = True
    $vBitmap = _GDIPlus_BitmapCloneArea($vBmp, 0, 0, $bW, $bH)
    If Not $vBitmap Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone bitmap!" & @CRLF & @CRLF & _
            "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
    Local Const $hBitmapData = _GDIPlus_BitmapLockBits($vBitmap, 0, 0, $bW, $bH, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32RGB)
    Local Const $Scan = DllStructGetData($hBitmapData, "Scan0")
    Local Const $Stride = DllStructGetData($hBitmapData, "Stride")
    Local $tPixelData = DllStructCreate("dword[" & (Abs($Stride * $bH)) & "]", $Scan)
    Local Const $bASM_GBW = "0x8B7C24048B5424088B5C240CB900000000C1E202575352518B040FBA00000000BB00000000B90000000088C2C1E80888C3C1E80888C18B44240883F800772FB85555000001CB01D3F7E3C1E810BB00000000B3FFC1E30888C3C1E30888C3C1E30888C389D8595A5B5F89040FEB3B89C839C3720289D839C2720289D05089F839C3770289D839C2770289D05B01D8BBDC780000F7E3C1E810595A5B5F3B4424107213C7040FFFFFFF0083C10439D1730EE95FFFFFFFC7040F00000000EBEBC3"

    Local Const $iSize = BinaryLen($bASM_GBW)
    Local Const $pCodeBuffer = _MemVirtualAlloc(0, $iSize, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    Local $tCodeBuffer = DllStructCreate("byte[" & $iSize & "]", $pCodeBuffer)
    DllStructSetData($tCodeBuffer, 1, $bASM_GBW)
    DllCallAddress("int:cdecl", $pCodeBuffer, "ptr", DllStructGetPtr($tPixelData), "int", $bH * $bW, "int", $iBlackAndWhite, "int", $iLight)
    _MemVirtualFree($pCodeBuffer, $iSize, $MEM_DECOMMIT)
    _GDIPlus_BitmapUnlockBits($vBitmap, $hBitmapData)
    _GDIPlus_BitmapDispose($hBmp)
    $hBmp = $vBitmap
;~  If Not $skip Then
;~      $hClipboard_Bitmap = _WinAPI_CopyImage(_GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp), 0, 0, 0, $LR_COPYDELETEORG + $LR_COPYRETURNORG)
;~      Draw2Graphic($hBmp)
;~  EndIf
    $tPixelData = 0
    $tCodeBuffer = 0
EndFunc   ;==>ASM_Bitmap_Grey_BnW

Func ASM_Bitmap_Invert($vvvBmp, $skip = False) ;ASM code by AndyG
;~  $undo = _GDIPlus_BitmapCloneArea($vvvBmp, 0, 0, $bW, $bH)
;~  $undo_chk = True
    $vBitmap = _GDIPlus_BitmapCloneArea($vvvBmp, 0, 0, $bW, $bH)
    If Not $vBitmap Or @error Then Return MsgBox(16 + 262144, "ERROR", "Whoops an internal error has occured: unable to clone bitmap!" & @CRLF & @CRLF & _
            "Sorry for inconvenience! :-(", 20, WinGetHandle(AutoItWinGetTitle()))
    Local Const $hBitmapData = _GDIPlus_BitmapLockBits($vBitmap, 0, 0, $bW, $bH, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32RGB)
    Local Const $Scan = DllStructGetData($hBitmapData, "Scan0")
    Local Const $Stride = DllStructGetData($hBitmapData, "Stride")
    Local $tPixelData = DllStructCreate("dword[" & (Abs($Stride * $bW)) & "]", $Scan)
    Local Const $bASM_Inv = "0x8B7424048B4C24088136FFFFFF0083C60483E90177F2C3"

    Local Const $iSize = BinaryLen($bASM_Inv)
    Local Const $pCodeBuffer = _MemVirtualAlloc(0, $iSize, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    Local $tCodeBuffer = DllStructCreate("byte[" & $iSize & "]", $pCodeBuffer)
    DllStructSetData($tCodeBuffer, 1, $bASM_Inv)
    DllCallAddress("int:cdecl", $pCodeBuffer, "ptr", DllStructGetPtr($tPixelData), "int", $bW * $bH)
    _MemVirtualFree($pCodeBuffer, $iSize, $MEM_DECOMMIT)
    _GDIPlus_BitmapUnlockBits($vBitmap, $hBitmapData)
    _GDIPlus_BitmapDispose($vvvBmp)
    $hBmp = $vBitmap
;~  If Not $skip Then
;~      $hClipboard_Bitmap = _WinAPI_CopyImage(_GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp), 0, 0, 0, $LR_COPYDELETEORG + $LR_COPYRETURNORG)
;~      Draw2Graphic($hBmp)
;~  EndIf
    $tCodeBuffer = 0
EndFunc   ;==>ASM_Bitmap_Invert

Func _GDIPlus_GraphicsScaleTransform($hGraphics, $nScaleX, $nScaleY, $iOrder = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipScaleWorldTransform", "handle", $hGraphics, "float", $nScaleX, "float", $nScaleY, "int", $iOrder)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsScaleTransform

Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hGraphics, "int", $iInterpolationMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsSetInterpolationMode

Func _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap)
    Local $tBIHDR, $ret, $tData, $pBits, $hResult = 0
    $ret = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0)
    If (@error) Or ($ret[0]) Then Return 0
    $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $ret[2], $ret[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    $pBits = DllStructGetData($tData, 'Scan0')
    If Not $pBits Then Return 0
    $tBIHDR = DllStructCreate('dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword')
    DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR))
    DllStructSetData($tBIHDR, 2, $ret[2])
    DllStructSetData($tBIHDR, 3, $ret[3])
    DllStructSetData($tBIHDR, 4, 1)
    DllStructSetData($tBIHDR, 5, 32)
    DllStructSetData($tBIHDR, 6, 0)
    $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0)
    If (Not @error) And ($hResult[0]) Then
        DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $ret[2] * $ret[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0'))
        $hResult = $hResult[0]
    Else
        $hResult = 0
    EndIf
    _GDIPlus_BitmapUnlockBits($hBitmap, $tData)
    Return $hResult
EndFunc   ;==>_GDIPlus_BitmapCreateDIBFromBitmap

Func _Base64Decode($input_string)
    Local $struct = DllStructCreate("int")
    Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", 0, "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(1, 0, "")
    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
    $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", "str", $input_string, "int", 0, "int", 1, "ptr", DllStructGetPtr($a), "ptr", DllStructGetPtr($struct, 1), "ptr", 0, "ptr", 0)
    If @error Or Not $a_Call[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($a, 1)
EndFunc   ;==>_Base64Decode
This version is buggy and only a proof of concept!!!

If I find time I will write a seperate basic image editor from scratch.

Br,

UEZ

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Good script UEZ.

GdipDrawCurve2 was what I was missing.

Added that to the script

LeftClick : Draw simple Black Lines.

RightClick : Erase whats drawn.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <SendMessage.au3>

Opt("TrayIconDebug", 1)

$Paint = GUICreate("Paint", 350, 350, -1, -1, -1, -1)
_GDIPlus_Startup()

$hGraphic_GUI = _GDIPlus_GraphicsCreateFromHWND($Paint)

$hBuffer_Bmp = _GDIPlus_BitmapCreateFromGraphics(350, 350, $hGraphic_GUI)
$hGraphic_Buffer_Bmp = _GDIPlus_ImageGetGraphicsContext($hBuffer_Bmp)

Global $af_Points[1][2] = [[0]]

GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUISetState()

While 1

    Switch GUIGetMsg()

        Case $GUI_EVENT_CLOSE

            ;release the resources
            _GDIPlus_GraphicsDispose($hGraphic_Buffer_Bmp)
            _GDIPlus_ImageDispose($hBuffer_Bmp)

            _GDIPlus_GraphicsDispose($hGraphic_GUI)
            _GDIPlus_Shutdown()

            Exit

        Case $GUI_EVENT_PRIMARYDOWN

            ;paint the Buffer-Img
            Paint_Buffer()

    Case $GUI_EVENT_SECONDARYDOWN

        ;erase the stuff
        _GDIPlus_GraphicsClear($hGraphic_Buffer_Bmp, 0xFFF0F0F0)

        ;don't wait for the processing of the GUI
        _WinAPI_PostMessage($Paint, $WM_PAINT, 0, 0)

    EndSwitch
WEnd

Func Paint_Buffer()

    Do

        $cPos = GUIGetCursorInfo()
        If IsArray($cPos) = 0 Then ExitLoop

        $af_Points[0][0] += 1

        ;search for _ArrayAddEx to speed up at this point, written by Guinness.
        If UBound($af_Points) - 1 < $af_Points[0][0] + 1 Then ReDim $af_Points[$af_Points[0][0] + 1000][2]  ;this takes a lot of time.

        $af_Points[$af_Points[0][0]][0] = $cPos[0] + 1 / 2
        $af_Points[$af_Points[0][0]][1] = $cPos[1] + 1 / 2

        _GDIPlus_GraphicsDrawCurve2($hGraphic_Buffer_Bmp, $af_Points)

        ;don't wait for the processing of the GUI
        _WinAPI_PostMessage($Paint, $WM_PAINT, 0, 0)

        ;pause
        Sleep(18)   ;to reduce the CPU usage by little.

    Until $cPos[2] = 0

    ;reset the variable.
    ReDim $af_Points[1][2]
    $af_Points[0][0] = 0

EndFunc   ;==>Paint_Buffer

Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam)

    ;paint the buffer image on the GUI.
    _GDIPlus_GraphicsDrawImage($hGraphic_GUI, $hBuffer_Bmp, 0, 0)

EndFunc   ;==>WM_PAINT

;borrowed from UEZ's post http://www.autoitscript.com/forum/topic/151664-drawing-on-a-window/#entry1086282
Func _GDIPlus_GraphicsDrawCurve2($hGraphics, $aPoints, $nTension = 0.01, $hPen = 0)

    Local $iI, $iCount, $iTmpErr, $iTmpExt, $pPoints, $tPoints, $aResult
    __GDIPlus_PenDefCreate($hPen)

    $iCount = $aPoints[0][0]
    $tPoints = DllStructCreate("float[" & $iCount * 2 & "]")
    $pPoints = DllStructGetPtr($tPoints)

    For $iI = 1 To $iCount
        DllStructSetData($tPoints, 1, $aPoints[$iI][0], (($iI - 1) * 2) + 1)
        DllStructSetData($tPoints, 1, $aPoints[$iI][1], (($iI - 1) * 2) + 2)
    Next

    $aResult = DllCall($ghGDIPDll, "uint", "GdipDrawCurve2", "handle", $hGraphics, "hwnd", $hPen, "ptr", $pPoints, "int", $iCount, "float", $nTension)
    $iTmpErr = @error
    $iTmpExt = @extended

    __GDIPlus_PenDefDispose()

    If $iTmpErr Then Return SetError($iTmpErr, $iTmpExt, False)

    Return $aResult[0] = 0

EndFunc   ;==>_GDIPlus_GraphicsDrawCurve2 

Still a newbie in GDIPlus. A lot to learn. Thanks for the new learning UEZ  :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

This ended up being my solution

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <GDIPlus.au3>
;#include "ColorPicker.au3"
#include <array.au3>
#include <misc.au3>
#include <WinAPI.au3>
#include <GuiStatusBar.au3>
#region colourpicker.au3
#Region Header
#cs
    Title:          Color Picker Control UDF Library for AutoIt3
    Filename:       ColorPicker.au3
    Description:    Creates and manages a Color Picker control for the GUI
    Author:         Yashied
    Version:        1.5
    Requirements:   AutoIt v3.3 +, Developed/Tested on WindowsXP Pro Service Pack 2
    Uses:           GUIConstantsEx.au3, GUIButton.au3, GUIImageList.au3, SendMessage.au3, StaticConstants.au3, WinAPI.au3, WindowsConstants.au3
    Notes:          The library registers (permanently) the following window message:
                    WM_ACTIVATE
                    WM_COMMAND
                    WM_MOUSEWHEEL
                    WM_SETCURSOR
    Available functions:
    _GUIColorPicker_Create
    _GUIColorPicker_Delete
    _GUIColorPicker_Release
    _GUIColorPicker_GetColor
    _GUIColorPicker_SetColor
    _GUIColorPicker_GetPalette
    _GUIColorPicker_SetPalette
    Example1:
        #Include <ColorPicker.au3>
        #Include <WinAPI.au3>
        Opt('MustDeclareVars', 1)
        Global $hForm, $Msg, $Label, $Picker1, $Picker2, $Picker3, $Data, $hInstance, $hCursor
        $hForm = GUICreate('Color Picker', 300, 200)
        ; Load cursor
        $hInstance = _WinAPI_LoadLibrary(@SystemDir & '\mspaint.exe')
        $hCursor = DllCall('user32.dll', 'ptr', 'LoadCursor', 'ptr', $hInstance, 'dword', 1204)
        $hCursor = $hCursor[0]
        _WinAPI_FreeLibrary($hInstance)
        ; Create Picker1 with custom cursor
        $Picker1 = _GUIColorPicker_Create('', 100, 50, 44, 44, 0xFF6600, BitOR($CP_FLAG_DEFAULT, $CP_FLAG_CHOOSERBUTTON), 0, -1, -1, $hCursor, 'Simple Text')
        ; Free cursor
        DllCall('user32.dll', 'int', 'DestroyCursor', 'ptr', $hCursor)
        ; Create custom (4 x 5) color palette
        Dim $aPalette[20] = _
            [0xFFFFFF, 0x000000, 0xC0C0C0, 0x808080, _
             0xFF0000, 0x800000, 0xFFFF00, 0x808000, _
             0x00FF00, 0x008000, 0x00FFFF, 0x008080, _
             0x0000FF, 0x000080, 0xFF00FF, 0x800080, _
             0xC0DCC0, 0xA6CAF0, 0xFFFBF0, 0xA0A0A4]
        ; Create Picker2 with custom color palette
        $Picker2 = _GUIColorPicker_Create('', 7, 170, 50, 23, 0xFF00FF, BitOR($CP_FLAG_CHOOSERBUTTON, $CP_FLAG_ARROWSTYLE, $CP_FLAG_MOUSEWHEEL), $aPalette, 4, 5, 0, '', 'More...')
        ; Create custom (8 x 8) color palette
        Dim $aPalette[64]
        For $i = 0 To UBound($aPalette) - 1
            $aPalette[$i] = BitOR($i, BitShift($i * 4, -8), BitShift($i, -16))
        Next
        ; Create Picker3 with custom color palette
        $Picker3 = _GUIColorPicker_Create('Color...', 223, 170, 70, 23, 0x2DB42D, BitOR($CP_FLAG_TIP, $CP_FLAG_MAGNIFICATION), $aPalette, 8, 8)
        $Label = GUICtrlCreateLabel('', 194, 171, 22, 22, $SS_SUNKEN)
        GUICtrlSetBkColor(-1, 0x2DB42D)
        GUICtrlSetTip(-1, '2DB42D')
        GUISetState()
        While 1
            $Msg = GUIGetMsg()
            Switch $Msg ; Color Picker sends the message that the color is selected
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $Picker1
                    $Data = _GUIColorPicker_GetColor($Picker1, 1)
                    If $Data[1] = '' Then
                        $Data[1] = 'Custom'
                    EndIf
                    ConsoleWrite('Picker1: 0x' & Hex($Data[0], 6) & ' (' & $Data[1] &')' & @CR)
                Case $Picker2
                    ConsoleWrite('Picker2: 0x' & Hex(_GUIColorPicker_GetColor($Picker2), 6) & @CR)
                Case $Picker3
                    $Data = _GUIColorPicker_GetColor($Picker3)
                    ConsoleWrite('Picker3: 0x' & Hex($Data, 6) & @CR)
                    GUICtrlSetBkColor($Label, $Data)
                    GUICtrlSetTip($Label, Hex($Data, 6))
            EndSwitch
        WEnd
    Example2 (required ColorChooser.au3):
        #Include <ColorChooser.au3>
        #Include <ColorPicker.au3>
        Opt('MustDeclareVars', 1)
        Global $hForm, $Msg, $Label, $Picker
        $hForm = GUICreate('MyGUI', 170, 200)
        $Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN)
        GUICtrlSetBkColor(-1, 0x50CA1B)
        $Picker = _GUIColorPicker_Create('', 55, 166, 60, 23, 0x50CA1B, BitOR($CP_FLAG_CHOOSERBUTTON, $CP_FLAG_MAGNIFICATION, $CP_FLAG_ARROWSTYLE), 0, -1, -1, 0, 'Simple Text', 'Custom...', '_ColorChooserDialog')
        GUISetState()
        While 1
            $Msg = GUIGetMsg()
            Switch $Msg
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $Picker
                    GUICtrlSetBkColor($Label, _GUIColorPicker_GetColor($Picker))
            EndSwitch
        WEnd
#ce
#Include-once
#Include <GUIConstantsEx.au3>
#Include <GUIButton.au3>
#Include <GUIImageList.au3>
#Include <SendMessage.au3>
#Include <StaticConstants.au3>
#Include <WinAPI.au3>
#Include <WindowsConstants.au3>
#EndRegion Header
#Region Global Variables and Constants
Global Const $CP_FLAG_CHOOSERBUTTON = 0x01
Global Const $CP_FLAG_TIP = 0x02
Global Const $CP_FLAG_MAGNIFICATION = 0x04
Global Const $CP_FLAG_ARROWSTYLE = 0x08
;Global Const $CP_FLAG_HANDCURSOR = 0x10
Global Const $CP_FLAG_MOUSEWHEEL = 0x20
Global Const $CP_FLAG_DEFAULT = BitOR($CP_FLAG_MAGNIFICATION, $CP_FLAG_MOUSEWHEEL)
#EndRegion Global Variables and Constants
#Region Local Variables and Constants
Global Const $CP_WM_ACTIVATE = 0x0006
Global Const $CP_WM_COMMAND = 0x0111
Global Const $CP_WM_MOUSEWHEEL = 0x020A
Global Const $CP_WM_SETCURSOR = 0x0020
Global Const $cpWidth = 8
Global Const $cpHeight = 5
Dim $cpPalette[$cpWidth * $cpHeight][2] = _
   [[0x000000, 'Black'   ], [0x993300, 'Brown'       ], [0x333300, 'Olive Green' ], [0x003300, 'Dark Green'  ], [0x003366, 'Dark Teal'      ], [0x000080, 'Dark Blue' ], [0x333399, 'Indigo'   ], [0x333333, 'Gray-80%'], _
 [0x800000, 'Dark Red'], [0xFF6600, 'Orange'      ], [0x808000, 'Dark Yellow' ], [0x008000, 'Green'       ], [0x008080, 'Teal'           ], [0x0000FF, 'Blue'      ], [0x666699, 'Blue-Gray'], [0x808080, 'Gray-50%'], _
 [0xFF0000, 'Red'     ], [0xFF9900, 'Light Orange'], [0x99CC00, 'Lime'        ], [0x339966, 'Sea Green'   ], [0x33CCCC, 'Aqua'           ], [0x3366FF, 'Light Blue'], [0x800080, 'Violet'   ], [0x999999, 'Gray-40%'], _
 [0xFF00FF, 'Pink'    ], [0xFFCC00, 'Gold'        ], [0xFFFF00, 'Yellow'      ], [0x00FF00, 'Bright Green'], [0x00FFFF, 'Turquoise'      ], [0x00CCFF, 'Sky Blue'  ], [0x993366, 'Plum'     ], [0xC0C0C0, 'Gray-25%'], _
 [0xFF99CC, 'Rose'    ], [0xFFCC99, 'Tan'         ], [0xFFFF99, 'Light Yellow'], [0xCCFFCC, 'Light Green' ], [0xCCFFFF, 'Light Turquoise'], [0x99CCFF, 'Pale Blue' ], [0xCC99FF, 'Lavender' ], [0xFFFFFF, 'White'   ]]
Dim $cpId[1][17] = [[0, 0, 0, 0, 0, 0]]
#cs
DO NOT USE THIS ARRAY IN THE SCRIPT, INTERNAL USE ONLY!
$cpId[0][0 ]   - Count item of array
     [0][1 ]   - Reserved
     [0][2 ]   - Handle to the "Color Picker" window
     [0][3 ]   - Dummy control (controlID)
     [0][4 ]   - Handle to the cursor (current)
     [0][5 ]   - WM_ACTIVATE control flag
     [0][6-16] - Don`t used
$cpId[i][0 ]   - The control identifier (controlID) as returned by GUICtrlCreateButton()
     [i][1 ]   - Handle to the control (GUICtrlGetHandle($cpId[i][0]))
     [i][2 ]   - Handle to the ImageList for further release
     [i][3 ]   - Last selected color (in RGB)
     [i][4 ]   - Custom palette
     [i][5 ]   - Text of the button control
     [i][6 ]   - Title of the "Color Picker" window
     [i][7 ]   - Flags
     [i][8 ]   - Text of the button for the "Color Chooser" dialog box
     [i][9 ]   - Width of the palette (in color items)
     [i][10]   - Height of the palette (in color items)
     [i][11]   - Width of the control
     [i][12]   - Height of the control
     [i][13]   - Handle to the parnet window for a control
     [i][14]   - Handle to the cursor (0 if not defined)
     [i][15]   - User "Color Chooser" function
     [i][16]   - Reserved
#ce
Global $__CP_WM0111 = 0
Global $__CP_WM0020 = 0
#EndRegion Local Variables and Constants
#Region Initialization
; IMPORTANT! If you register the following window messages in your code, you should call handlers from this library until
; you return from your handlers, otherwise the Clor Picker controls will not work properly. For example:
;
; Func MY_WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
;     Local $Result = CP_WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
;     If Not $Result Then
;         Return 0
;     EndIf
;     ...
;     Return $GUI_RUNDEFMSG
; EndFunc   ;==>MY_WM_SETCURSOR
GUIRegisterMsg($CP_WM_ACTIVATE, 'CP_WM_ACTIVATE')
GUIRegisterMsg($CP_WM_COMMAND, 'CP_WM_COMMAND')
GUIRegisterMsg($CP_WM_MOUSEWHEEL, 'CP_WM_MOUSEWHEEL')
GUIRegisterMsg($CP_WM_SETCURSOR, 'CP_WM_SETCURSOR')
#EndRegion Initialization
#Region Public Functions
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_Create
; Description....: Creates a Color Picker control for the GUI.
; Syntax.........: _GUIColorPicker_Create ( $sText, $iLeft, $iTop, $iWidth, $iHeight [, $iRGB [, $iFlags [, $aPalette [, $iWidthPalette [, $iHeightPalette [, $hCursor [, $sTitle [, $sButton [, $sColorFunc]]]]]]]]] )
; Parameters.....: $sText          - The text of the button control. If the value of this parameter is "" then the button will
;                                    display the rectangle with filled of current ($iRGB) color.
;                  $iLeft          - The left side of the control.
;                  $iTop           - The top of the control.
;                  $iWidth         - The width of the control.
;                  $iHeight        - The height of the control.
;                  $iRGB           - Default selected color (in RGB). Default is 0 (Black).
;                  $iFlags         - Defines a style of the "Color Picker" window. This parameter can be a combination of the following values.
;
;                                    $CP_FLAG_CHOOSERBUTTON
;                                    $CP_FLAG_TIP
;                                    $CP_FLAG_MAGNIFICATION
;                                    $CP_FLAG_ARROWSTYLE
;                                    $CP_FLAG_HANDCURSOR (don't used)
;                                    $CP_FLAG_MOUSEWHEEL
;
;                                    (See constants section in this library)
;
;                  $aPalette       - Custom color palette. This parameter should be an array of Width x Height (see more) items containing the
;                                    values of colors for each label (in RGB). Default is 0 - uses a default palette.
;                  $iWidthPalette  - Width of the palette (in color items). Minimum value of - 4. Default is (-1) - uses a default width.
;                  $iHeightPalette - Height of the palette (in color items). Minimum value of - 4. Default is (-1) - uses a default height.
;                  $hCursor        - Handle to the user defined cursor. To use one of the predefined cursors set this parameter to
;                                    one of the $IDC_... constants. Default is 0 - does not use cursor.
;                  $sTitle         - Title of the "Color Picker" window. If the value of this parameter is "" then the title
;                                    will not be displayed. Default is "".
;                  $sButton        - The text of the button for the "Color Chooser" dialog box. Default is "Custom...".
;                  $sColorFunc     - User "Color Chooser" dialog box function. To make the user function workable you have to define it
;                                    with 2 function parameters otherwise the function won't be called.
;
;                                    Func _MyColorChooserDialog($iColorRef, $hParent)
;
;                                    A custom function must return a color value, in RGB, or (-1) if the user does not choose a color.
;                                    If this parameter is empty string or not used, will be used Windows default "Color Chooser" function,
;                                    like _ChooseColor() from Misc.au3 UDF library. This parameter is valid only if the
;                                    $CP_FLAG_CHOOSERBUTTON flag is set.
; Return values..: Success         - 1
;                  Failure         - 0
; Author.........: Yashied
; Modified.......:
; Remarks........: The function copies the cursor ($hCursor) for internal use, and if the bitmap is no longer needed, it is necessary to
;                  release the resources associated with the bitmap by using the _WinAPI_DestroyCursor() function. $CP_FLAG_TIP flag is
;                  not valid if $hCursor parameter is used.
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_Create($sText, $iLeft, $iTop, $iWidth, $iHeight, $iRGB = 0, $iFlags = -1, $aPalette = 0, $iWidthPalette = -1, $iHeightPalette = -1, $hCursor = 0, $sTitle = '', $sButton = 'Custom...', $sColorFunc = '')
 If $iFlags < 0 Then
  $iFlags = $CP_FLAG_DEFAULT
 EndIf
 $sText = StringStripWS($sText, 3)
 $sTitle = StringStripWS($sTitle, 3)
 $sButton = StringStripWS($sButton, 3)
 $sColorFunc = StringStripWS($sColorFunc, 3)
 $iFlags = BitOR($iFlags, 0x0080 * (StringLen($sText) = 0), 0x0100 * (StringLen($sTitle) > 0))
 Local $ID = GUICtrlCreateButton($sText, $iLeft, $iTop, $iWidth, $iHeight)
 If $ID = 0 Then
  Return 0
 EndIf
 Local $aData, $hPrev, $hImageList, $hID = GUICtrlGetHandle($ID)
 If BitAND($iFlags, 0x0080) Then
  If BitAND($iFlags, $CP_FLAG_ARROWSTYLE) Then
   $aData = CP_CreateArrowBitmap($iRGB, $iWidth - 10, $iHeight - 10)
  Else
   $aData = CP_CreateSolidBitmap($iRGB, $iWidth - 10, $iHeight - 10)
  EndIf
  $hImageList = _GUIImageList_Create($iWidth - 10, $iHeight - 10, 5, 1)
  _GUIImageList_Add($hImageList, $aData[0], $aData[1])
  _GUICtrlButton_SetImageList($hID, $hImageList, 4)
  For $i = 0 To 1
   _WinAPI_DeleteObject($aData[$i])
  Next
 EndIf
 If $iWidthPalette < 4 Then
  $iWidthPalette = $cpWidth
 EndIf
 If $iHeightPalette < 4 Then
  $iHeightPalette = $cpHeight
 EndIf
 If $hCursor Then
  Switch $hCursor
   Case 32512 To 32516, 32640 To 32650
    $hCursor = DllCall('user32.dll', 'ptr', 'LoadCursor', 'ptr', 0, 'dword', $hCursor)
   Case Else
    $hCursor = DllCall('user32.dll', 'ptr', 'CopyIcon', 'ptr', $hCursor)
  EndSwitch
  If (Not @error) And ($hCursor[0]) Then
   $hCursor = $hCursor[0]
  Else
   $hCursor = 0
  EndIf
 EndIf
 ReDim $cpId[$cpId[0][0] + 2][UBound($cpId, 2)]
 $cpId[0][0] += 1
 $cpId[$cpId[0][0]][0 ] = $ID
 $cpId[$cpId[0][0]][1 ] = $hID
 $cpId[$cpId[0][0]][2 ] = $hImageList
 $cpId[$cpId[0][0]][3 ] = $iRGB
 $cpId[$cpId[0][0]][4 ] = CP_ValidatePalette($aPalette, $iWidthPalette * $iHeightPalette, 0xFFFFFF)
 $cpId[$cpId[0][0]][5 ] = $sText
 $cpId[$cpId[0][0]][6 ] = $sTitle
 $cpId[$cpId[0][0]][7 ] = $iFlags
 $cpId[$cpId[0][0]][8 ] = $sButton
 $cpId[$cpId[0][0]][9 ] = $iWidthPalette
 $cpId[$cpId[0][0]][10] = $iHeightPalette
 $cpId[$cpId[0][0]][11] = $iWidth
 $cpId[$cpId[0][0]][12] = $iHeight
 $cpId[$cpId[0][0]][13] = _WinAPI_GetParent($hID)
 $cpId[$cpId[0][0]][14] = $hCursor
 $cpId[$cpId[0][0]][15] = $sColorFunc
 $cpId[$cpId[0][0]][16] = 0
 Return $ID
EndFunc   ;==>_GUIColorPicker_Create
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_Delete
; Description....: Deletes a Color Picker control.
; Syntax.........: _GUIColorPicker_Delete ( $controlID )
; Parameters.....: $controlID - The control identifier (controlID) as returned by a _GUIColorPicker_Create() function.
; Return values..: Success    - 1
;                  Failure    - 0
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_Delete($controlID)
 For $i = 1 To $cpId[0][0]
  If $cpId[$i][0] = $controlID Then
   If Not GUICtrlDelete($cpId[$i][0]) Then
    Return 0
   EndIf
   If BitAND($cpId[$i][7], 0x0080) Then
    $cpId[$i][3] = -1
    CP_SetColor($i)
   EndIf
   If $cpId[$i][14] Then
    DllCall('user32.dll', 'int', 'DestroyCursor', 'ptr', $cpId[$i][14])
   EndIf
   For $j = $i To $cpId[0][0] - 1
    For $k = 0 To UBound($cpId, 2) - 1
     $cpId[$j][$k] = $cpId[$j + 1][$k]
    Next
   Next
   $cpId[0][0] -= 1
   ReDim $cpId[$cpId[0][0] + 1][UBound($cpId, 2)]
   Return 1
  EndIf
 Next
 Return 0
EndFunc   ;==>_GUIColorPicker_Delete
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_Release
; Description....: Deletes all Color Picker controls for a window (GUI).
; Syntax.........: _GUIColorPicker_Release ( $hWnd )
; Parameters.....: $hWnd   - Handle to the window to be released.
; Return values..: Success - 1
;                  Failure - 0
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_Release($hWnd)
 If Not WinExists($hWnd) Then
  Return SetError(1, 0, 0)
 EndIf
 Local $Count = 1, $Result = 0
 While $Count <= $cpId[0][0]
  If $cpId[$Count][13] = $hWnd Then
   If Not _GUIColorPicker_Delete($cpId[$Count][0]) Then
    Return 0
   EndIf
   $Result = 1
  Else
   $Count += 1
  EndIf
 WEnd
 Return $Result
EndFunc   ;==>_GUIColorPicker_Release
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_GetColor
; Description....: Retrieves the selected color of the Color Picker control.
; Syntax.........: _GUIColorPicker_GetColor ( $controlID )
; Parameters.....: $controlID - The control identifier (controlID) as returned by a _GUIColorPicker_Create() function.
;                  $iFlag     - Determines return type, valid values:
;                  |0 - Returns value (in RGB) of the selected color (Default)
;                  |1 - Returns array of two elements ([0] - RGB color, [1] - name of color)
; Return values..: Success    - Value depending on the $iFlag flag.
;                  Failure    - (-1)
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_GetColor($controlID, $iFlag = 0)
 Local $Data, $Palette, $Name = ''
 For $i = 1 To $cpId[0][0]
  If $cpId[$i][0] = $controlID Then
   If $iFlag Then
    $Palette = $cpId[$i][4]
    For $j = 0 To UBound($Palette) - 1
     If $cpId[$i][3] = $Palette[$j][0] Then
      $Name = $Palette[$j][1]
      ExitLoop
     EndIf
    Next
    Dim $Data[2] = [$cpId[$i][3], $Name]
    Return $Data
   Else
    Return $cpId[$i][3]
   EndIf
  EndIf
 Next
 Return -1
EndFunc   ;==>_GUIColorPicker_GetColor
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_SetColor
; Description....: Sets the color for the Color Picker control.
; Syntax.........: _GUIColorPicker_SetColor ( $controlID, $iRGB )
; Parameters.....: $controlID - The control identifier (controlID) as returned by a _GUIColorPicker_Create() function.
;                  $iRGB      - The RGB color to use.
; Return values..: Success    - 1
;                  Failure    - 0
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_SetColor($controlID, $iRGB)
 For $i = 1 To $cpId[0][0]
  If $cpId[$i][0] = $controlID Then
   $cpId[$i][3] = $iRGB
   If BitAND($cpId[$i][7], 0x0080) Then
    CP_SetColor($i)
   EndIf
   Return 1
  EndIf
 Next
 Return 0
EndFunc   ;==>_GUIColorPicker_SetColor
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_GetPalette
; Description....: Retrieves the current palette of the Color Picker control.
; Syntax.........: _GUIColorPicker_GetPalette ( $controlID [, $iFlag])
; Parameters.....: $controlID - The control identifier (controlID) as returned by a _GUIColorPicker_Create() function.
;                  $iFlag     - Determines return type, valid values:
;                  |0 - Returns 1D array consisting of the values of color only (Default)
;                  |1 - Returns 2D array consisting of the values of color and its name
; Return values..: Success    - Array of RGB colors for the current palette.
;                  Failure    - 0
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_GetPalette($controlID, $iFlag = 0)
 Local $Data, $Palette
 For $i = 1 To $cpId[0][0]
  If $cpId[$i][0] = $controlID Then
   If $iFlag Then
    Return $cpId[$i][4]
   Else
    $Palette = $cpId[$i][4]
    Dim $Data[UBound($Palette)]
    For $i = 0 To UBound($Palette) - 1
     $Data[$i] = $Palette[$i][0]
    Next
    Return $Data
   EndIf
  EndIf
 Next
 Return 0
EndFunc   ;==>_GUIColorPicker_GetPalette
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIColorPicker_SetPalette
; Description....: Sets the palette for the Color Picker control.
; Syntax.........: _GUIColorPicker_SetPalette ( $controlID, $aPalette )
; Parameters.....: $controlID - The control identifier (controlID) as returned by a _GUIColorPicker_Create() function.
;                  $aPalette  - Array of RGB colors for the palette to use. Dimension of the array should be Width x Height (See _GUIColorPicker_Create()).
; Return values..: Success    - 1
;                  Failure    - 0
; Author.........: Yashied
; Modified.......:
; Remarks........:
; Related........:
; Link...........:
; Example........: Yes
; ===============================================================================================================================
Func _GUIColorPicker_SetPalette($controlID, $aPalette)
 For $i = 1 To $cpId[0][0]
  If $cpId[$i][0] = $controlID Then
   $cpId[$i][4] = CP_ValidatePalette($aPalette, $cpId[$i][9] * $cpId[$i][10], 0xFFFFFF)
   Return 1
  EndIf
 Next
 Return 0
EndFunc   ;==>_GUIColorPicker_SetPalette
#EndRegion Public Functions
#Region Internal Functions
Func CP_Assign(ByRef $iVariable, $iValue)
 $iVariable = $iValue
EndFunc   ;==>CP_Assign
Func CP_CreateArrowBitmap($iRGB, $iWidth, $iHeight)
 Local $hDC, $hBackDC, $hFrontDC, $hFront, $hBack, $hPen
 Local $aData[2]
 $hDC = _WinAPI_GetDC(0)
 $hBackDC = _WinAPI_CreateCompatibleDC($hDC)
 $hBack = _WinAPI_CreateSolidBitmap(0, 0, $iWidth, $iHeight)
 _WinAPI_SelectObject($hBackDC, $hBack)
 $hFrontDC = _WinAPI_CreateCompatibleDC($hDC)
 $hFront = _WinAPI_CreateSolidBitmap(0, 0xFFFFFF, $iWidth - 11, $iHeight)
 _WinAPI_SelectObject($hFrontDC, $hFront)
 _WinAPI_BitBlt($hBackDC, 0, 0, $iWidth - 11, $iHeight, $hFrontDC, 0, 0, $SRCCOPY)
 _WinAPI_DeleteObject($hFront)
 $hFront = _WinAPI_CreateSolidBitmap(0, $iRGB, $iWidth - 11 - 2, $iHeight - 2)
 _WinAPI_SelectObject($hFrontDC, $hFront)
 _WinAPI_BitBlt($hBackDC, 1, 1, $iWidth - 11 - 2, $iHeight - 2, $hFrontDC, 0, 0, $SRCCOPY)
 $aData[0] = $hBack
 _WinAPI_DeleteObject($hFront)
 $hBack = _WinAPI_CreateSolidBitmap(0, 0xFFFFFF, $iWidth, $iHeight)
 _WinAPI_SelectObject($hBackDC, $hBack)
 $hFront = _WinAPI_CreateSolidBitmap(0, 0, $iWidth - 11, $iHeight)
 _WinAPI_SelectObject($hFrontDC, $hFront)
 _WinAPI_BitBlt($hBackDC, 0, 0, $iWidth - 11, $iHeight, $hFrontDC, 0, 0, $SRCCOPY)
 _WinAPI_DeleteObject($hFront)
 $hPen = _WinAPI_CreatePen($PS_SOLID, 1, 0)
 _WinAPI_SelectObject($hBackDC, $hPen)
 For $i = 1 To 4
  _WinAPI_DrawLine($hBackDC, $iWidth - $i - 4, Int($iHeight / 2) + Mod($iHeight, 2) - $i + 2, $iWidth + $i - 5, Int($iHeight / 2) + Mod($iHeight, 2) - $i + 2)
 Next
 $aData[1] = $hBack
 _WinAPI_DeleteObject($hPen)
 _WinAPI_ReleaseDC(0, $hDC)
 _WinAPI_DeleteDC($hFrontDC)
 _WinAPI_DeleteDC($hBackDC)
 Return $aData
EndFunc   ;==>CP_CreateArrowBitmap
Func CP_CreateSolidBitmap($iRGB, $iWidth, $iHeight)
 Local $hDC, $hBackDC, $hFrontDC, $hFront, $hBack
 Local $aData[2]
 $hDC = _WinAPI_GetDC(0)
 $hBackDC = _WinAPI_CreateCompatibleDC($hDC)
 $hBack = _WinAPI_CreateSolidBitmap(0, 0xFFFFFF, $iWidth, $iHeight)
 _WinAPI_SelectObject($hBackDC, $hBack)
 $hFrontDC = _WinAPI_CreateCompatibleDC($hDC)
 $hFront = _WinAPI_CreateSolidBitmap(0, $iRGB, $iWidth - 2, $iHeight - 2)
 _WinAPI_SelectObject($hFrontDC, $hFront)
 _WinAPI_BitBlt($hBackDC, 1, 1, $iWidth - 2, $iHeight - 2, $hFrontDC, 0, 0, $SRCCOPY)
 $aData[0] = $hBack
 $aData[1] = 0
 _WinAPI_DeleteObject($hFront)
 _WinAPI_ReleaseDC(0, $hDC)
 _WinAPI_DeleteDC($hFrontDC)
 _WinAPI_DeleteDC($hBackDC)
 Return $aData
EndFunc   ;==>CP_CreateSolidBitmap
Func CP_ColorChooserDlg($iRGB, $hWnd)
 Local $tCHOOSECOLOR = DllStructCreate('dword;hwnd;hwnd;dword;ptr;dword;lparam;ptr;ptr')
 Local $tCC = DllStructCreate('int[16]')
 DllStructSetData($tCHOOSECOLOR, 1, DllStructGetSize($tCHOOSECOLOR))
 DllStructSetData($tCHOOSECOLOR, 2, $hWnd)
 DllStructSetData($tCHOOSECOLOR, 4, CP_SwitchColor($iRGB))
 DllStructSetData($tCHOOSECOLOR, 5, DllStructGetPtr($tCC))
 DllStructSetData($tCHOOSECOLOR, 6, 0x103)
 Local $Ret = DllCall('comdlg32.dll', 'long', 'ChooseColor', 'ptr', DllStructGetPtr($tCHOOSECOLOR))
 If $Ret[0] = 0 Then
  Return -1
 EndIf
 Return CP_SwitchColor(DllStructGetData($tCHOOSECOLOR, 4))
EndFunc   ;==>CP_ColorChooserDlg
Func CP_Index($controlID, ByRef $aData)
 For $i = 0 To UBound($aData) - 1
  If $aData[$i] = $controlID Then
   Return $i
  EndIf
 Next
 Return -1
EndFunc   ;==>CP_Index
Func CP_PickerDlg($ID)
 Local $Msg, $X, $Y, $Cursor, $Index, $Prev, $Rgb, $Size, $Active = 0, $Custom = -1, $Result = 0, $Pressed = False
 Local $Label[$cpId[$ID][9] * $cpId[$ID][10]]
 Local $Accel[2][2] = [['{ENTER}', 0], ['{ESC}', 0]]
 Local $Width = 25 * $cpId[$ID][9] + 3, $Height = 25 * $cpId[$ID][10] + 3
 Local $dH = 28 * (BitAND($cpId[$ID][7], 0x0100) = 0x0100)
 Local $tRECT = _WinAPI_GetWindowRect($cpId[$ID][1])
 Local $GUIOnEventMode = Opt('GUIOnEventMode', 0)
 Local $Taskbar = CP_TaskbarHeight()
 Local $Palette = $cpId[$ID][4]
 $X = DllStructGetData($tRECT, 1)
 $Y = DllStructGetData($tRECT, 4)
 If $X < 0 Then
  $X = 0
 EndIf
 If $X > @DesktopWidth - ($Width + 6) Then
  $X = @DesktopWidth - ($Width + 6)
 EndIf
 If $Y < 0 Then
  $Y = 0
 EndIf
 If $Y > @DesktopHeight - $Taskbar - $dH - 28 * BitAND($cpId[$ID][7], $CP_FLAG_CHOOSERBUTTON) - ($Height + 6) Then
  $Y = @DesktopHeight - $Taskbar - $dH - 28 * BitAND($cpId[$ID][7], $CP_FLAG_CHOOSERBUTTON) - ($Height + 6)
 EndIf
 $cpId[0][2] = GUICreate('', $Width, $Height + $dH + 28 * BitAND($cpId[$ID][7], $CP_FLAG_CHOOSERBUTTON), $X, $Y, $WS_POPUP, $WS_EX_DLGMODALFRAME, $cpId[$ID][13])
; GUISetBkColor(0xFCFCFC, $cpId[0][2])
 If BitAND($cpId[$ID][7], 0x0100) Then
  GUICtrlCreateLabel('', 4, 4, $Width - 8, 23, $SS_GRAYFRAME)
  GUICtrlCreateLabel($cpId[$ID][6], 6, 9, $Width - 12, 14, $SS_CENTER)
  GUICtrlSetFont(-1, 8.5, 400, 0, 'MS Shell Dlg')
 EndIf
 For $i = 1 To $cpId[$ID][10]
  For $j = 1 To $cpId[$ID][9]
   $Index = ($i - 1) * $cpId[$ID][9] + $j - 1
   If ($Active = 0) And ($cpId[$ID][3] = $Palette[$Index][0]) And (BitAND($cpId[$ID][7], $CP_FLAG_MAGNIFICATION)) Then
    $Label[$Index] = GUICtrlCreateLabel('', 2 + 25 * ($j - 1), 2 + $dH + 25 * ($i - 1), 24, 24, $SS_SUNKEN)
    $Active = $Label[$Index]
   Else
    $Label[$Index] = GUICtrlCreateLabel('', 4 + 25 * ($j - 1), 4 + $dH + 25 * ($i - 1), 20, 20, $SS_SUNKEN)
   EndIf
   GUICtrlSetBkColor(-1, $Palette[$Index][0])
   If BitAND($cpId[$ID][7], $CP_FLAG_TIP) Then
    GUICtrlSetTip(-1, $Palette[$Index][1])
   EndIf
   If $cpId[$ID][14] Then
    GUICtrlSetState(-1, $GUI_DISABLE)
   EndIf
  Next
 Next
 $cpId[0][3] = GUICtrlCreateDummy()
 For $i = 0 To 1
  $Accel[$i][1] = $cpId[0][3]
 Next
 If BitAND($cpId[$ID][7], $CP_FLAG_CHOOSERBUTTON) Then
  $Custom = GUICtrlCreateButton('', 0, 0)
  $Size = CP_StringSize($Custom, $cpId[$ID][8]) + 24
  If $Size > $Width - 6 Then
   $Size = $Width - 6
  EndIf
  GUICtrlSetPos(-1, Int(($Width - $Size) / 2), $Height + 2 + $dH, $Size + Mod($Width - $Size, 2), 21)
  GUICtrlSetFont(-1, 8.5, 400, 0, 'MS Shell Dlg')
  GUICtrlSetData(-1, $cpId[$ID][8])
 EndIf
 GUISetAccelerators($Accel, $cpId[0][2])
 GUISetState(@SW_SHOW, $cpId[0][2])
 While 1
  $Cursor = GUIGetCursorInfo($cpId[0][2])
  If Not @error Then
   If CP_PtInRect($Cursor[0], $Cursor[1], 2, 2 + $dH, 25 * $cpId[$ID][9], $dH + 25 * $cpId[$ID][10]) Then
    $cpId[0][4] = $cpId[$ID][14]
   Else
    $cpId[0][4] = 0
   EndIf
   If BitXOR($Active, $Cursor[4]) Then
    If Not $Cursor[2] Then
     For $i = 0 To UBound($Label) - 1
      If $Cursor[4] = $Label[$i] Then
       If BitAND($cpId[$ID][7], $CP_FLAG_MAGNIFICATION) Then
        $Index = CP_Index($Active, $Label)
        GUICtrlSetPos($Active, 4 + 25 * Mod($Index, $cpId[$ID][9]), 4 + $dH + 25 * ($Index - Mod($Index, $cpId[$ID][9])) / $cpId[$ID][9], 20, 20)
        GUICtrlSetPos($Label[$i], 2 + 25 * Mod($i, $cpId[$ID][9]), 2 + $dH + 25 * ($i - Mod($i, $cpId[$ID][9])) / $cpId[$ID][9], 24, 24)
       EndIf
       $Active = $Label[$i]
       ExitLoop
      EndIf
     Next
    EndIf
   Else
    If ($Cursor[2]) And (Not $Pressed) Then
     $Index = CP_Index($Cursor[4], $Label)
     If $Index > -1 Then
      $cpId[$ID][3] = $Palette[$Index][0]
      $Result = 2
      ExitLoop
     EndIf
    EndIf
   EndIf
   $Pressed = $Cursor[2]
  EndIf
  $Msg = GUIGetMsg()
  Switch $Msg
   Case $GUI_EVENT_CLOSE, $cpId[0][3]
    ExitLoop
   Case $Custom
    $Result = 1
    ExitLoop
  EndSwitch
 WEnd
 $cpId[0][5] = 1
 GUIDelete($cpId[0][2])
 $cpId[0][2] = 0
 $cpId[0][3] = 0
 $cpId[0][4] = 0
 $cpId[0][5] = 0
 Opt('GUIOnEventMode', $GUIOnEventMode)
 Switch $Result
  Case 0
   Return 0
  Case 1
   If $cpId[$ID][15] = '' Then
    $Rgb = CP_ColorChooserDlg($cpId[$ID][3], $cpId[$ID][13])
   Else
    If (IsDeclared('ccData')) And ($cpId[$ID][15] = '_ColorChooserDialog') Then
     Execute('CP_Assign($Prev, $ccData[9])')
     Execute('CP_Assign($ccData[9], $cpId[$ID][14])')
     $Cursor = 1
    Else
     $Cursor = 0
    EndIf
    $Rgb = Call($cpId[$ID][15], $cpId[$ID][3], $cpId[$ID][13])
    If (@error = 0xDEAD) And (@extended = 0xBEEF) Then
     $Rgb = -1
    EndIf
    If $Cursor Then
     Execute('CP_Assign($ccData[9], $Prev)')
    EndIf
   EndIf
   If $Rgb < 0 Then
    _WinAPI_SetFocus($cpId[$ID][1])
    Return 0
   EndIf
   $cpId[$ID][3] = $Rgb
   ContinueCase
  Case 2
   If BitAND($cpId[$ID][7], 0x0080) Then
    CP_SetColor($ID)
   EndIf
 EndSwitch
 _WinAPI_SetFocus($cpId[$ID][1])
 Return 1
EndFunc   ;==>CP_PickerDlg
Func CP_PtInRect($iXn, $iYn, $iX1, $iY1, $iX2, $iY2)
 If ($iXn >= $iX1) And ($iXn <= $iX2) And ($iYn >= $iY1) And ($iYn <= $iY2) Then
  Return 1
 Else
  Return 0
 EndIf
EndFunc   ;==>CP_PtInRect
Func CP_SetColor($ID)
 Local $aData
 If $cpId[$ID][3] < 0 Then
  _GUIImageList_Destroy($cpId[$ID][2])
 Else
  If BitAND($cpId[$ID][7], $CP_FLAG_ARROWSTYLE) Then
   $aData = CP_CreateArrowBitmap($cpId[$ID][3], $cpId[$ID][11] - 10, $cpId[$ID][12] - 10)
  Else
   $aData = CP_CreateSolidBitmap($cpId[$ID][3], $cpId[$ID][11] - 10, $cpId[$ID][12] - 10)
  EndIf
  _GUIImageList_Remove($cpId[$ID][2])
  _GUIImageList_Add($cpId[$ID][2], $aData[0], $aData[1])
  _GUICtrlButton_SetImageList($cpId[$ID][1], $cpId[$ID][2], 4)
  For $i = 0 To 1
   _WinAPI_DeleteObject($aData[$i])