Jump to content

GDIPlus PNG Manipulation - not sure how to...


Kovacic
 Share

Recommended Posts

Hi all.. I am not all that good with GDIPlus, but it seems that is what I need to use to do what I need to do. 

This application will be a simple wizard type application with panels. There will be 6 panels total, and I have included a generic image for each to show the example. I am using GDIPLus to put PNGs on top of PNGs. I am stuck at 2 things

I would like to be able to create a mouse over effect for each button. I don't care much what it is, only I would like something to happen, like a 1.2 zoom, or a color shift of the button.
I would like to show, and hide panels / buttons depending on what step the user is on which will be defined by a variable, or by a simple function.
I cant get either one to work and have over 8 hours invested in designing and testing, and I can't do this for the life of me. If anyone can throw me a hint or a line of code, or even breadcrumbs to the right direction, it would make my December.

Most of the influence for the code is here: https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsResetTransform.htm

Here is the attached code and sample images... The backgrounds contain the places where the buttons should be..

 

[ The company logos have been removed for obvious reasons ]

app.au3

BeginBackup.png

BeginRestore.png

CloseUtil.png

GoBack.png

NewComp.png

OldComp.png

OpenSD.png

RedCloseUtil.png

Slide1.PNG

Slide2.PNG

Slide3.PNG

Slide4.PNG

Slide5.PNG

Slide6.PNG

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to comment
Share on other sites

To get your script run properly I would suggest to put the images with its original names into one zip archive and uplaod the zip archive here.

Edited by UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Update to the code... I can now selectively switch panels, and show images as needed.. I just need to be able to create a button for an imaged called int he following example:

 

This control somehow needs to act like a button..

Global $ddd = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $GoBack)
            Global $ddd2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicGoBack = _GDIPlus_GraphicsDrawImage($ddd2, $ddd, 7.68, 391.68)

(ignore the globals, I will clean them up later)

 

All code so far:

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
GUISetOnEvent($GUI_EVENT_CLOSE, "Cleanup")
Global $hGUI, $hImage, $hGraphic, $TransTest, $TransTestCreate, $Hover = 0, $swap = True
Global $Test = 1
If $Test = 0 Then
    $Panel1 = "panels\Slide1.PNG"
    $Panel2 = "panels\Slide2.PNG"
    $Panel3 = "panels\Slide3.PNG"
    $Panel4 = "panels\Slide4.PNG"
    $Panel5 = "panels\Slide5.PNG"
    $Panel6 = "panels\Slide6.PNG"
    $BeginBackup = "Buttons\BeginBackup.png"
    $BeginRestore = "Buttons\BeginRestore.png"
    $CloseUtil = "Buttons\CloseUtil.png"
    $GoBack = "Buttons\GoBack.png"
    $NewComp = "Buttons\NewComp.png"
    $OldComp = "Buttons\OldComp.png"
    $OpenSD = "Buttons\OpenSD.png"
    $RedCloseUtil = "Buttons\RedCloseUtil.png"
Else
    $Panel1 = "test\Slide1.PNG"
    $Panel2 = "test\Slide2.PNG"
    $Panel3 = "test\Slide3.PNG"
    $Panel4 = "test\Slide4.PNG"
    $Panel5 = "test\Slide5.PNG"
    $Panel6 = "test\Slide6.PNG"
    $BeginBackup = "test\BeginBackup.png"
    $BeginRestore = "test\BeginRestore.png"
    $CloseUtil = "test\CloseUtil.png"
    $GoBack = "test\GoBack.png"
    $NewComp = "test\NewComp.png"
    $OldComp = "test\OldComp.png"
    $OpenSD = "test\OpenSD.png"
    $RedCloseUtil = "test\RedCloseUtil.png"
EndIf
#EndRegion Buttons
Global Const $STM_SETIMAGE = 0x0172
$hGUI = GUICreate("Backup / Restore Utility Version .5", 768, 480, -1, -1)
GUISetState()
_GDIPlus_Startup()
; TEST SWITCH PANELS
For $i = 1 To 6
    Panel($i)
    Sleep(3000)
Next
; TEST SWITCH PANELS
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit
        Case $aaa2
            Panel(2)
            ;Case $ThePicBeginBackup
            ;   PerformBackup()
            ;   Panel(3)
            ;Case $ThePicBeginRestore
            ;   PerformRestore()
            ;   Panel(5)
            ;Case $ThePicCloseUtil
            ;   Exit
            ;Case $ThePicGoBack
            ;   Panel(1)
            ;Case $ThePicNewComp
            ;   Panel(4)
            ;Case $ThePicOldComp
            ;   Panel(2)
            ;Case $ThePicOpenSD
            ;   OpenSD()
            ;Case $ThePicRedCloseUtil
            ;   Exit
    EndSwitch
WEnd
Func Panel($Num)
    Switch $Num
        Case 1
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel1)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $aaa = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $OldComp)
            Global $aaa2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicBeginBackup = _GDIPlus_GraphicsDrawImage($aaa2, $aaa, 114, 218)
            Global $bbb = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $NewComp)
            Global $bbb2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicBeginRestore = _GDIPlus_GraphicsDrawImage($bbb2, $bbb, 381.12, 218.88)
        Case 2
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel2)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $ddd = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $GoBack)
            Global $ddd2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicGoBack = _GDIPlus_GraphicsDrawImage($ddd2, $ddd, 7.68, 391.68)
            Global $aaa = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $BeginBackup)
            Global $aaa2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicBeginBackup = _GDIPlus_GraphicsDrawImage($aaa2, $aaa, 238.08, 391.68)
        Case 3
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel3)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $ddd = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $GoBack)
            Global $ddd2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicGoBack = _GDIPlus_GraphicsDrawImage($ddd2, $ddd, 7.68, 391.68)
            Global $ccc = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $CloseUtil)
            Global $ccc2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicCloseUtil = _GDIPlus_GraphicsDrawImage($ccc2, $ccc, 238.08, 391.68)
        Case 4
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel4)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $ddd = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $GoBack)
            Global $ddd2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicGoBack = _GDIPlus_GraphicsDrawImage($ddd2, $ddd, 7.68, 391.68)
            Global $bbb = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $BeginRestore)
            Global $bbb2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicBeginRestore = _GDIPlus_GraphicsDrawImage($bbb2, $bbb, 238.08, 391.68)
        Case 5
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel5)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $ddd = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $GoBack)
            Global $ddd2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicGoBack = _GDIPlus_GraphicsDrawImage($ddd2, $ddd, 7.68, 391.68)
            Global $ccc = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $CloseUtil)
            Global $ccc2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicCloseUtil = _GDIPlus_GraphicsDrawImage($ccc2, $ccc, 238.08, 391.68)
        Case 6
            $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $Panel6)
            $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)
            Global $ggg = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $OpenSD)
            Global $ggg2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicOpenSD = _GDIPlus_GraphicsDrawImage($ggg2, $ggg, 117.12, 286.08)
            Global $hhh = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $RedCloseUtil)
            Global $hhh2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
            Global $ThePicRedCloseUtil = _GDIPlus_GraphicsDrawImage($hhh2, $hhh, 398.4, 287.04)
    EndSwitch
EndFunc   ;==>Panel
Func Cleanup()
 ; Soon will cleanup all resources
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;       _GDIPlus_GraphicsDispose($hGraphic)
    ;       _GDIPlus_ImageDispose($hImage)
    ;
    _GDIPlus_Shutdown()
EndFunc   ;==>Cleanup
Func HideAll()
    ; TBD
EndFunc   ;==>HideAll
Func PerformRestore()
    ; TBD
EndFunc   ;==>PerformRestore
Func PerformBackup()
    ; TBD
EndFunc   ;==>PerformBackup
Func OpenSD()
    ; TBD
EndFunc   ;==>OpenSD

 

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to comment
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
 Share

×
×
  • Create New...