Jump to content
Sign in to follow this  
Burgs

Unwanted drawing artifacts over background image...?

Recommended Posts

Burgs

Hello and greetings,

  I'm trying to modify some of the sample code in the manual to use as a 'placement' tool for images and text over a background image.  The code is posted below.  I first load the 'background' image into the GUI...and then bring in the 'AutoIT' logo and text elements that I wish to position/rotate/scale above the background image.  I figure I could probably just save the position and rotation location variables for later placement usage over a 'finalized' picture. 

  My problem is that I need to remove the ''_GDIPlus_GraphicsClear" command...because if I leave it in then it will 'clear out' my background image.  However the issue is that when I manipulate the logo image and text elements with the mouse (moving, mousewheel) it leaves drawing 'artifacts' on my background sample image.  You will clearly see this when running my provided code.

  Is there a way to 'mask' or prevent the logo/text elements 'above' the background image from affecting it with unwanted artifacts?  I have played around with various GDI commands to attempt to accomplish this without any luck.  Any suggestions appreciated.  I thank you in advance.

I have attached the 'background' image that I load into the GUI.

 

#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <TabConstants.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>

#include <ScreenCapture.au3>
#include <WinAPI.au3>


 Global Const $STM_SETIMAGE = 0x0172
 Global $_CTRL_GUI

 AutoItSetOption("GUIOnEventMode", 1)


CONTROL_GUI()

Func CONTROL_GUI()

 Local $_Play_Back, $aPlaySize, $_strip_X, $_strip_Y
 Local $_External_Width, $_External_Height


    ; X64 running support
    Local $sWow64 = ""
    If @AutoItX64 Then $sWow64 = "\Wow6432Node"

    ;get AutoIt install dir
    Local $sRegPath = "HKLM\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt"

    Local $sFile = RegRead($sRegPath, "InstallDir") & "\Examples\GUI\logo4.gif"
    If Not FileExists($sFile) Then
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", $sFile & " not found!", 30)
        Exit
    EndIf



    ; Initialize GDI+ library
    _GDIPlus_Startup()


 $_CTRL_GUI = GUICreate("Positioning", 600, 350)
 GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
 GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_ResetGraphicsTransform")

 GUISetState(@SW_SHOW, $_CTRL_GUI)


 $aPlaySize = WinGetClientSize($_CTRL_GUI)  ;get the X, Y size of the 'PLAY' GUI Window...

      ;**BACKGROUND IMAGE FOR "window"...

 $hImage = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\back_reference3.jpg")
   ;create the image to be watermarked...

 $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)

           $_External_Height = _GDIPlus_ImageGetHeight($hImage)
           $_External_Width = _GDIPlus_ImageGetWidth($hImage)

       $_strip_X = ($aPlaySize[0] / 2) - ($_External_Width / 2)
       $_strip_Y = ($aPlaySize[1] / 2) - ($_External_Height / 2)

       $_Play_Back = GUICtrlCreatePic("", $_strip_X, $_strip_Y, $_External_Width, $_External_Height, $SS_NOTIFY)


        if $_Play_Back == 0 Then MsgBox(64, "Image Error:", "Problem creating desired image in 'CONTROL GUI'...error:" & @error)
        if $_Play_Back <> 0 Then
        _WinAPI_DeleteObject(GUICtrlSendMsg($_Play_Back, $STM_SETIMAGE, 0, $hHBITMAP))

        _GDIPlus_ImageDispose($hImage)
        GuiCtrlSetState($_Play_Back, $GUI_DISABLE)
        GuiCtrlSetState($_Play_Back, $GUI_SHOW)


        EndIf  ;'$_Play_Back' NOT "0" (image should have been created successfuly)...

      ;**

   ;****
   ;****



    Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)
    Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($_External_Width, $_External_Height, $_adjusts)
    Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

    Global $hImage3 = _GDIPlus_ImageLoadFromFile($sFile)

    Global $iMouseX, $iMouseY

    GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN")
    GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
    GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
    GUISetState(@SW_SHOW)

    _Draw()

    While Sleep(10)
    WEnd

   ;****
   ;****

EndFunc  ;"CONTROL_GUI()" updates the various controls used for image positioning as necessary...


Func _ResetGraphicsTransform()
    _GDIPlus_GraphicsResetTransform($hGfx_Buffer)
    _Draw()
EndFunc   ;==>_ResetGraphicsTransform

Func WM_LBUTTONDOWN($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam

    $iMouseX = BitAND($lParam, 0x0000FFFF)
    $iMouseY = BitShift($lParam, 16)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_LBUTTONDOWN

Func WM_MOUSEMOVE($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iX = BitAND($lParam, 0x0000FFFF)
            Local $iY = BitShift($lParam, 16)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $iX - $iMouseX, $iY - $iMouseY, True)

            $iMouseX = $iX
            $iMouseY = $iY

            _Draw()
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEMOVE

Func WM_MOUSEWHEEL($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $lParam

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iAngle = -3
            If BitShift($wParam, 16) < 0 Then $iAngle = 3

            Local $aMousePos[2][2] = [[1]]
            $aMousePos[1][0] = $iMouseX
            $aMousePos[1][1] = $iMouseY
            _GDIPlus_GraphicsTransformPoints($hGfx_Buffer, $aMousePos)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aMousePos[1][0], $aMousePos[1][1])
            _GDIPlus_GraphicsRotateTransform($hGfx_Buffer, $iAngle)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aMousePos[1][0], -$aMousePos[1][1])

        Case Else
            Local $aInfo = GUIGetCursorInfo($_CTRL_GUI)
            Local $iScale = 1.1
            If BitShift($wParam, 16) < 0 Then $iScale = 0.9

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aInfo[0], -$aInfo[1], True)
            _GDIPlus_GraphicsScaleTransform($hGfx_Buffer, $iScale, $iScale, True)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aInfo[0], $aInfo[1], True)
    EndSwitch

    _Draw()
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEWHEEL

Func _Draw()
    ;_GDIPlus_GraphicsClear($hGfx_Buffer, 0xFFFFFFFF)
;****PROBLEM IS CAUSED BY REMOVING THIS 'GraphicsClear' STATEMENT...BUT HOW TO COMPENSATE THE LOSS OF THE
;    BACKGROUND IMAGE...???

    _GDIPlus_GraphicsDrawImage($hGfx_Buffer, $hImage3, 216, 166)

    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF)
    _GDIPlus_GraphicsDrawRect($hGfx_Buffer, 10, 10, 200, 100, $hPen)
    _GDIPlus_PenDispose($hPen)

    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF00007F)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFont = _GDIPlus_FontCreate($hFamily, 24, 2)
    Local $tLayout = _GDIPlus_RectFCreate(0, 260, 400)
    _GDIPlus_GraphicsDrawStringEx($hGfx_Buffer, "AutoIt rulez!", $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_GraphicsDrawImage($_adjusts, $hBmp_Buffer, 0, 0)

    _GDIPlus_FontDispose($hFont)
    $hFont = _GDIPlus_FontCreate($hFamily, 10)
    _GDIPlus_StringFormatSetAlign($hFormat, 0)

    DllStructSetData($tLayout, "X", 10)
    DllStructSetData($tLayout, "Y", 10)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "left mousebutton = move graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 30)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "mousewheel = zoom graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 50)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "mousewheel + left mousebutton = rotate graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 70)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "right mousebutton = reset", $hFont, $tLayout, $hFormat, $hBrush)

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_GraphicsGetTransform($hGfx_Buffer, $hMatrix)
    Local $aMatrix_Values = _GDIPlus_MatrixGetElements($hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

    DllStructSetData($tLayout, "Y", 110)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "Matrix:", $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "X", 20)
    DllStructSetData($tLayout, "Y", 130)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[0], $aMatrix_Values[1]), $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "Y", 150)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[2], $aMatrix_Values[3]), $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "Y", 170)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[4], $aMatrix_Values[5]), $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
EndFunc   ;==>_Draw

Func _Exit()
    _GDIPlus_ImageDispose($hImage3)
    _GDIPlus_GraphicsDispose($hGfx_Buffer)
    _GDIPlus_BitmapDispose($hBmp_Buffer)
    _GDIPlus_GraphicsDispose($_adjusts)
    _GDIPlus_Shutdown()
    GUIDelete($_CTRL_GUI)
    Exit
EndFunc   ;==>_Exit

 

back_reference3.jpg

Share this post


Link to post
Share on other sites
UEZ

You have separate the gfx handle with the rotation / zoom and the background.

#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <TabConstants.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>

#include <ScreenCapture.au3>
#include <WinAPI.au3>


;~  Global Const $STM_SETIMAGE = 0x0172
 Global $_CTRL_GUI, $hImage, $_External_Width, $_External_Height

 AutoItSetOption("GUIOnEventMode", 1)


CONTROL_GUI()

Func CONTROL_GUI()

 Local $_Play_Back, $aPlaySize, $_strip_X, $_strip_Y


    ; X64 running support
    Local $sWow64 = ""
    If @AutoItX64 Then $sWow64 = "\Wow6432Node"

    ;get AutoIt install dir
    Local $sRegPath = "HKLM\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt"

    Local $sFile = RegRead($sRegPath, "InstallDir") & "\Examples\GUI\logo4.gif"
    If Not FileExists($sFile) Then
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", $sFile & " not found!", 30)
        Exit
    EndIf



    ; Initialize GDI+ library
    _GDIPlus_Startup()


 $_CTRL_GUI = GUICreate("Positioning", 600, 350)
 GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
 GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_ResetGraphicsTransform")

 GUISetState(@SW_SHOW, $_CTRL_GUI)


 $aPlaySize = WinGetClientSize($_CTRL_GUI)  ;get the X, Y size of the 'PLAY' GUI Window...

      ;**BACKGROUND IMAGE FOR "window"...

 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\back_reference3.jpg")
   ;create the image to be watermarked...

;~  $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)

           $_External_Height = _GDIPlus_ImageGetHeight($hImage)
           $_External_Width = _GDIPlus_ImageGetWidth($hImage)

       $_strip_X = ($aPlaySize[0] / 2) - ($_External_Width / 2)
       $_strip_Y = ($aPlaySize[1] / 2) - ($_External_Height / 2)

       $_Play_Back = GUICtrlCreatePic("", $_strip_X, $_strip_Y, $_External_Width, $_External_Height, $SS_NOTIFY)


        if $_Play_Back == 0 Then MsgBox(64, "Image Error:", "Problem creating desired image in 'CONTROL GUI'...error:" & @error)
        if $_Play_Back <> 0 Then
;~         _WinAPI_DeleteObject(GUICtrlSendMsg($_Play_Back, $STM_SETIMAGE, 0, $hHBITMAP))

;~         _GDIPlus_ImageDispose($hImage)
        GuiCtrlSetState($_Play_Back, $GUI_DISABLE)
        GuiCtrlSetState($_Play_Back, $GUI_SHOW)


        EndIf  ;'$_Play_Back' NOT "0" (image should have been created successfuly)...

      ;**

   ;****
   ;****



    Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)

    Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromScan0($_External_Width, $_External_Height)
    Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

    Global $hImage3 = _GDIPlus_ImageLoadFromFile($sFile)

    Global $iMouseX, $iMouseY

    GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN")
    GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
    GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
    GUISetState(@SW_SHOW)

    _Draw()

    While Sleep(10)
    WEnd

   ;****
   ;****

EndFunc  ;"CONTROL_GUI()" updates the various controls used for image positioning as necessary...


Func _ResetGraphicsTransform()
    _GDIPlus_GraphicsResetTransform($hGfx_Buffer)
    _Draw()
EndFunc   ;==>_ResetGraphicsTransform

Func WM_LBUTTONDOWN($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam

    $iMouseX = BitAND($lParam, 0x0000FFFF)
    $iMouseY = BitShift($lParam, 16)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_LBUTTONDOWN

Func WM_MOUSEMOVE($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iX = BitAND($lParam, 0x0000FFFF)
            Local $iY = BitShift($lParam, 16)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $iX - $iMouseX, $iY - $iMouseY, True)

            $iMouseX = $iX
            $iMouseY = $iY

            _Draw()
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEMOVE

Func WM_MOUSEWHEEL($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $lParam

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iAngle = -3
            If BitShift($wParam, 16) < 0 Then $iAngle = 3

            Local $aMousePos[2][2] = [[1]]
            $aMousePos[1][0] = $iMouseX
            $aMousePos[1][1] = $iMouseY
            _GDIPlus_GraphicsTransformPoints($hGfx_Buffer, $aMousePos)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aMousePos[1][0], $aMousePos[1][1])
            _GDIPlus_GraphicsRotateTransform($hGfx_Buffer, $iAngle)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aMousePos[1][0], -$aMousePos[1][1])

        Case Else
            Local $aInfo = GUIGetCursorInfo($_CTRL_GUI)
            Local $iScale = 1.1
            If BitShift($wParam, 16) < 0 Then $iScale = 0.9

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aInfo[0], -$aInfo[1], True)
            _GDIPlus_GraphicsScaleTransform($hGfx_Buffer, $iScale, $iScale, True)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aInfo[0], $aInfo[1], True)
    EndSwitch

    _Draw()
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEWHEEL

Func _Draw()
    _GDIPlus_GraphicsClear($hGfx_Buffer, 0x00000000)
;****PROBLEM IS CAUSED BY REMOVING THIS 'GraphicsClear' STATEMENT...BUT HOW TO COMPENSATE THE LOSS OF THE
;    BACKGROUND IMAGE...???

    _GDIPlus_GraphicsDrawImage($hGfx_Buffer, $hImage3, 216, 166)

    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    _GDIPlus_GraphicsDrawRect($hGfx_Buffer, 10, 10, 200, 100, $hPen)
    _GDIPlus_PenDispose($hPen)

    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFont = _GDIPlus_FontCreate($hFamily, 24, 2)
    Local $tLayout = _GDIPlus_RectFCreate(0, 260, 400)
    _GDIPlus_GraphicsDrawStringEx($hGfx_Buffer, "AutoIt rulez!", $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_GraphicsDrawImageRect($_adjusts, $hImage, 0, 0, $_External_Width, $_External_Height)
    _GDIPlus_GraphicsDrawImage($_adjusts, $hBmp_Buffer, 0, 0)

    _GDIPlus_FontDispose($hFont)
    $hFont = _GDIPlus_FontCreate($hFamily, 10)
    _GDIPlus_StringFormatSetAlign($hFormat, 0)

    DllStructSetData($tLayout, "X", 10)
    DllStructSetData($tLayout, "Y", 10)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "left mousebutton = move graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 30)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "mousewheel = zoom graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 50)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "mousewheel + left mousebutton = rotate graphic", $hFont, $tLayout, $hFormat, $hBrush)

    DllStructSetData($tLayout, "Y", 70)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "right mousebutton = reset", $hFont, $tLayout, $hFormat, $hBrush)

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_GraphicsGetTransform($hGfx_Buffer, $hMatrix)
    Local $aMatrix_Values = _GDIPlus_MatrixGetElements($hMatrix)
    _GDIPlus_MatrixDispose($hMatrix)

    DllStructSetData($tLayout, "Y", 110)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, "Matrix:", $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "X", 20)
    DllStructSetData($tLayout, "Y", 130)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[0], $aMatrix_Values[1]), $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "Y", 150)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[2], $aMatrix_Values[3]), $hFont, $tLayout, $hFormat, $hBrush)
    DllStructSetData($tLayout, "Y", 170)
    _GDIPlus_GraphicsDrawStringEx($_adjusts, StringFormat("%.2f  %.2f", $aMatrix_Values[4], $aMatrix_Values[5]), $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
EndFunc   ;==>_Draw

Func _Exit()
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_ImageDispose($hImage3)
    _GDIPlus_GraphicsDispose($hGfx_Buffer)
    _GDIPlus_BitmapDispose($hBmp_Buffer)
    _GDIPlus_GraphicsDispose($_adjusts)
    _GDIPlus_Shutdown()
    GUIDelete($_CTRL_GUI)
    Exit
EndFunc   ;==>_Exit

 

  • Like 2

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
Burgs

Thank you UEZ...I shall give this a try shortly.  I appreciate the response. 

Regards

Share this post


Link to post
Share on other sites
Burgs

Thanks for that post UEZ...that seems to be working properly.

May I ask 'why' my original code does not work...I mean can you explain " You have separate the gfx handle with the rotation / zoom and the background " that you wrote

...I'm just trying to understand what I did wrong and why the code needs to be as you made it...thanks in advance...regards

 

Share this post


Link to post
Share on other sites
UEZ

In this example you have two separate graphic canvas

  1. $_adjusts
  2. $hGfx_Buffer

1. is the main visible canvas which is shown in the GUI whereas 2. is the hidden graphic canvas. The canvas is used to zoom and rotate. After any operation it will be copied to the 1. canvas otherwise any modification will applied to the 1. canvas, too.

To clean the 2. canvas you have to use 0x00000000  (ARGB) otherwise the transparency will be lost.


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
Burgs

Thanks for that explanation UEZ...I believe I understand...it helps to realize the difference between the main and 'copied' canvas...

Regards

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.