Jump to content

Recommended Posts

Posted (edited)

Hi there.

Im kinda new to Autoit writing scripts. What I am trying to achieve is a back ground picture and a rotating png. I load the picture from xbmc.

This my script:

Opt("GuiOnEventMode", 1)
$hwnd = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT))
GUICtrlCreatePic('ps2.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUISetState()
GUISetOnEvent(-3, "close")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
$pen = _GDIPlus_PenCreate(0xFF00FF00, 2)

InetGet('D:\HTPC\Games\PS2\Roms\cartridge\' & $CmdLine[2] & '.png')

$image=_GDIPlus_ImageLoadFromFile ('D:\HTPC\Games\PS2\Roms\cartridge\' & $CmdLine[2] & '.png')
$matrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($matrix, 150, 150)

$inc = 0
$rx = 400
$ry = 400
$x = 500
$y = 250

Do


_GDIPlus_MatrixRotate($matrix,1)
_GDIPlus_GraphicsSetTransform($backbuffer,$matrix)

_GDIPlus_GraphicsDrawImageRect($backbuffer,$image,-150,-150,300,300)


_GDIPlus_GraphicsDrawImageRect($graphics,$bitmap,$x,$y,$rx,$ry)

$x = $x + 1
$y = $y + 1
$rx = $rx - 1
$ry = $ry - 1
$inc = $inc + 1

Until $inc = 225

The Issue:

https://skydrive.live.com/embed?cid=F6554FE8FA489447&resid=F6554FE8FA489447%21184&authkey=AKCL7awCLgFIxQs

The png is not transparent and I believe the code is not optional.

What am I doing wrong?

Cheers.

Edited by lokipoki
Posted

You would require a Layered window,

Check out

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.

Posted

I created the script with the image edited by UEZ

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

$hGUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState()


_GDIPlus_Startup()
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics(300, 300, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hBmp_CD = _GDIPlus_ImageLoadFromFile('CD-PS2.png')
$hMatrix = _GDIPlus_MatrixCreate()

$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)

Do

_GDIPlus_MatrixRotate($hMatrix, 1)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, @DesktopWidth / 2 -$iWidth, @DesktopHeight / 2 -$iHeight)

_GDIPlus_GraphicsClear($hBmp_Gfx, 0xFFF0F0F0) ;Make the Background equal to the background of the GUI
Sleep(10)

Until GUIGetMsg() = $GUI_EVENT_CLOSE
Assuming the Pic to be in the ScriptDir named CD-PS2.png

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.

Posted

Your picture is a JPG and mine a PNG. PNG supports transparency and JPG not.

I converted your JPG into a PNG.

Br,

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

Posted (edited)

Your picture is a JPG and mine a PNG. PNG supports transparency and JPG not.

That shouldn't make a difference when we draw in a non-layered window. That is we have to set the background color of the Graphics anyway, to that of the GUI. Correct me if I'm wrong. 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.

Posted

Your picture is a JPG and mine a PNG. PNG supports transparency and JPG not.

I converted your JPG into a PNG.

Br,

UEZ

But mine is in png format with a flat background colour...

Posted

I tried to script from PhoenixXL and your picture. But all I get is:

https://skydrive.live.com/embed?cid=F6554FE8FA489447&resid=F6554FE8FA489447%21185&authkey=APxwoBpldhBriuE

Posted (edited)

That's easy to fix:

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$hGUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState()


_GDIPlus_Startup()
$hBmp_CD = _GDIPlus_ImageLoadFromFile('Super Bust-A-Move 2.png')
$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hMatrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)

GUISetOnEvent(-3, "_Exit")

Do

_GDIPlus_MatrixRotate($hMatrix, 1)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, @DesktopWidth / 2 -$iWidth, @DesktopHeight / 2 -$iHeight)

_GDIPlus_GraphicsClear($hBmp_Gfx, 0xFFF0F0F0) ;Make the Background equal to the background of the GUI

Until Not Sleep(10)

Func _Exit()
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($hBmp_CD)
    _GDIPlus_GraphicsDispose($hGUI_Gfx)
    _GDIPlus_GraphicsDispose($hBmp_Gfx)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_Shutdown()
    GUIDelete()
    Exit
EndFunc

Btw, I forgot to resize the image that the ratio is 1:1! Please use new image from post#3.

Br,

UEZ

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

Posted

That's easy to fix:

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$hGUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetState()


_GDIPlus_Startup()
$hBmp_CD = _GDIPlus_ImageLoadFromFile('Super Bust-A-Move 2.png')
$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hMatrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)

GUISetOnEvent(-3, "_Exit")

Do

_GDIPlus_MatrixRotate($hMatrix, 1)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, @DesktopWidth / 2 -$iWidth, @DesktopHeight / 2 -$iHeight)

_GDIPlus_GraphicsClear($hBmp_Gfx, 0xFFF0F0F0) ;Make the Background equal to the background of the GUI

Until Not Sleep(10)

Func _Exit()
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($hBmp_CD)
    _GDIPlus_GraphicsDispose($hGUI_Gfx)
    _GDIPlus_GraphicsDispose($hBmp_Gfx)
    _GDIPlus_BitmapDispose($hBmp)
    _GDIPlus_Shutdown()
    GUIDelete()
    Exit
EndFunc

Btw, I forgot to resize the image that the ratio is 1:1! Please use new image from post#3.

Br,

UEZ

The white part around the disc stays white not transparent. Why?
Posted

Because this is not the way to do. Search the forum for a transparent version. E.g. post#2.

Br,

UEZ

Ok I fixed my script:

#include 
#include 
#include 

$hGUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUICtrlCreatePic('ps2.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUISetState()


_GDIPlus_Startup()
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics(300, 300, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hBmp_CD = _GDIPlus_ImageLoadFromFile('CD-PS2.png')
$hMatrix = _GDIPlus_MatrixCreate()

$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)


Do

_GDIPlus_MatrixRotate($hMatrix, 1)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, @DesktopWidth / 2 -$iWidth, @DesktopHeight / 2 -$iHeight)


_GDIPlus_GraphicsClear($hBmp_Gfx, 0x0000000) ;Make the Background equal to the background of the GUI
Sleep(10)

Until GUIGetMsg() = $GUI_EVENT_CLOSE

This is the result:

Posted Image

As you can see the cd is cut off. How do I fix it? And how do I move the cd making it smaller just like my very first script:

_GDIPlus_MatrixTranslate($matrix, 150, 150)

$inc = 0
$rx = 400
$ry = 400
$x = 500
$y = 250

Do


    _GDIPlus_MatrixRotate($matrix,1)
    _GDIPlus_GraphicsSetTransform($backbuffer,$matrix)

    _GDIPlus_GraphicsDrawImageRect($backbuffer,$image,-150,-150,300,300)


    _GDIPlus_GraphicsDrawImageRect($graphics,$bitmap,$x,$y,$rx,$ry)

      $x = $x + 1
      $y = $y + 1
      $rx = $rx - 1
      $ry = $ry - 1
      $inc = $inc + 1

Until $inc = 225

Cheers.

Posted (edited)

As you have seen in post#11 I didn't used fixed values for the image dimension

$hBmp_CD = _GDIPlus_ImageLoadFromFile('Super Bust-A-Move 2.png')
$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

The image size is not 300x300 and that's the reason why it is cut off!

Thus, use $iWidth / $iHeight instead of 300 / 300!

Br,

UEZ

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

  • 2 months later...
Posted

Hi there again.

Sorry to bother you but I went back to my script to test with various pictures. Here the script again:

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

Run("D:\HTPC\Programs\nomousy\nomousy.exe /hide", "", @SW_HIDE)
Run("D:\HTPC\Programs\autotaskbarhider\TaskBarHider.exe -hide -exit")

$hGUI = GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUICtrlCreatePic('ps2.jpg', 0, 0, @DesktopWidth, @DesktopHeight)
GUISetState()

_GDIPlus_Startup()
$hBmp_CD = _GDIPlus_ImageLoadFromFile('D:\HTPC\Games\PS2\Roms\cartridge\' & $CmdLine[2] & '.png')
$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGUI_Gfx)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hMatrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)

$inc = 0
$x = 1900
$y = 1250

Do

_GDIPlus_MatrixRotate($hMatrix, 1)
_GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

;The CD is not at the Center perfectily, therefore some cliping would occur
_GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
_GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, @DesktopWidth / 2 -$iWidth, @DesktopHeight / 2 -$iHeight)


_GDIPlus_GraphicsClear($hBmp_Gfx, 0x0000000) ;Make the Background equal to the background of the GUI
Sleep(5)

$inc = $inc + 1
Until $inc = 225

HotKeySet("{ESC}", "Terminate")

If $CmdLine[0] == 2 Then
    GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST))
    GUISetState()
    Run ( '"D:\HTPC\Games\PS2\Emulator\pcsx2-5569-windows-x86\pcsx2-r5569.exe" --nogui --fullscreen "' & $CmdLine[1] & '" --cfgpath="D:\HTPC\Games\PS2\Inis\' & $CmdLine[2] & '"', "D:\HTPC\Games\PS2\Emulator\pcsx2-5569-windows-x86\" )
    Run("pssuspend XBMC.exe", "", @SW_HIDE)
    While 1
            Sleep(100)
    WEnd
EndIf

Terminate 
 
Func Terminate()
    ProcessClose ( "pcsx2-r5569.exe" )
    Run ( 'pssuspend -r XBMC.exe')
    WinSetState("XBMC","", @SW_MAXIMIZE)
    Run("D:\HTPC\Programs\nomousy\nomousy.exe", "", @SW_HIDE)
    Run("D:\HTPC\Programs\autotaskbarhider\TaskBarHider.exe -show -exit")
    Exit 0
 EndFunc

Here the picture I use:

https://ncdnlw.bay.livefilestore.com/y2pvaDeNOjWvA1k9SHMAclvtFo8XjoKCibn4nMGkyzpqAZdBe_sJ_V8-QPvjNE-o0lXryZtThMKYGmAlvVzk6KW2L32-9A8mxYO0ovza9w3DlI/Jak%203.png?psid=1

Here the result:

https://ncdnlw.bay.livefilestore.com/y2pYBInmdV-mVgF9UDnrK-9_YrV1kbAZyHfL7q5p453qy6Cyasy0LlNSb623H74MijJifHZZWlqozM9bJEchha-19nPJRwfZr5ZzzKj8ufzKNg/cd.jpg?psid=1

I tried several pictures with the same values such as *.png and 1:1 dimension. What could be the issue?!

I really don't know what to do that's why I write here to seek for help. Thanks for help already gave me and would appreciate to help me on more time :)

Cheers.

Posted

Have a look

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

_GDIPlus_Startup()

$GUI_Width = @DesktopWidth  ;only with these macros other values will result in misplacement of the CD.
$GUI_Height = @DesktopHeight


$hGUI = GUICreate('MyGUI', $GUI_Width, $GUI_Height, -1, -1, $WS_POPUP)
GUICtrlCreatePic('ps2.jpg', 0, 0, $GUI_Width, $GUI_Height)
GUISetState()

$hBmp_CD = _GDIPlus_ImageLoadFromFile('jak 3.png')
$hBmp_Gfx_CD = _GDIPlus_ImageGetGraphicsContext($hBmp_CD)

$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hBmp_Gfx_CD)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hMatrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)


Do

    _GDIPlus_MatrixRotate($hMatrix, 3)
    _GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

    ;The CD is not at the Center perfectily, therefore some cliping would occur
    _GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
    _GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, ($GUI_Width / 2) - ($iWidth / 2), ($GUI_Height / 2) - ($iHeight / 2))


    _GDIPlus_GraphicsClear($hBmp_Gfx, 0x0000000) ;Make the Background equal to the background of the GUI
    Sleep(10)

Until GUIGetMsg() = $GUI_EVENT_CLOSE

;memory release
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_GraphicsDispose($hBmp_Gfx)
_GDIPlus_GraphicsDispose($hGUI_Gfx)
_GDIPlus_GraphicsDispose($hBmp_Gfx_CD)
_GDIPlus_ImageDispose($hBmp)
_GDIPlus_ImageDispose($hBmp_CD)
_GDIPlus_Shutdown()

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.

Posted (edited)

 

Have a look

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

_GDIPlus_Startup()

$GUI_Width = @DesktopWidth  ;only with these macros other values will result in misplacement of the CD.
$GUI_Height = @DesktopHeight


$hGUI = GUICreate('MyGUI', $GUI_Width, $GUI_Height, -1, -1, $WS_POPUP)
GUICtrlCreatePic('ps2.jpg', 0, 0, $GUI_Width, $GUI_Height)
GUISetState()

$hBmp_CD = _GDIPlus_ImageLoadFromFile('jak 3.png')
$hBmp_Gfx_CD = _GDIPlus_ImageGetGraphicsContext($hBmp_CD)

$iWidth = _GDIPlus_ImageGetWidth($hBmp_CD)
$iHeight = _GDIPlus_ImageGetHeight($hBmp_CD)
$hGUI_Gfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hBmp = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hBmp_Gfx_CD)
$hBmp_Gfx = _GDIPlus_ImageGetGraphicsContext($hBmp)

$hMatrix = _GDIPlus_MatrixCreate()

_GDIPlus_MatrixTranslate($hMatrix, $iWidth / 2, $iHeight / 2)


Do

    _GDIPlus_MatrixRotate($hMatrix, 3)
    _GDIPlus_GraphicsSetTransform($hBmp_Gfx, $hMatrix)

    ;The CD is not at the Center perfectily, therefore some cliping would occur
    _GDIPlus_GraphicsDrawImage($hBmp_Gfx, $hBmp_CD, -$iWidth / 2, -$iHeight / 2)
    _GDIPlus_GraphicsDrawImage($hGUI_Gfx, $hBmp, ($GUI_Width / 2) - ($iWidth / 2), ($GUI_Height / 2) - ($iHeight / 2))


    _GDIPlus_GraphicsClear($hBmp_Gfx, 0x0000000) ;Make the Background equal to the background of the GUI
    Sleep(10)

Until GUIGetMsg() = $GUI_EVENT_CLOSE

;memory release
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_GraphicsDispose($hBmp_Gfx)
_GDIPlus_GraphicsDispose($hGUI_Gfx)
_GDIPlus_GraphicsDispose($hBmp_Gfx_CD)
_GDIPlus_ImageDispose($hBmp)
_GDIPlus_ImageDispose($hBmp_CD)
_GDIPlus_Shutdown()

 

Its working now. But the cd (rotating image) is too small. How do I change the size and position?!

Cheers mate.

Edited by lokipoki

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...