Jump to content

GDI + Rotate Image - Need Help


Recommended Posts

Got some script that I included in this post (in archive)

almost done but don't know how to rotate it in other direction and how to make it transporent...

So i can so backgraound image...

Download the archive and my script and you will understend what i need :D

Please help, maybe someone know how to do this. I think i'ts not so hard...

P.S: sorry for my English...

The_Thing.rar

[RU] Zone
Link to comment
Share on other sites

Got some script that I included in this post (in archive)

almost done but don't know how to rotate it in other direction and how to make it transporent...

So i can so backgraound image...

Download the archive and my script and you will understend what i need :)

Please help, maybe someone know how to do this. I think i'ts not so hard...

P.S: sorry for my English...

Try this.

;
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>
    #include <WinAPI.au3>
    
    Opt("GUIOnEventMode", 1)
    
    $Form1 = GUICreate("The-THING", 174, 367, 504, 266, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
  ;$Pic1 = GUICtrlCreatePic("obj01.bmp", 2, 34, 170, 168, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUICtrlSetCursor(-1, 2)
    GUISetState(@SW_SHOW)
    GUISetOnEvent(-3, "close")
    
  ; ===========================================
    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(170, 168, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    $bitmap1 = _GDIPlus_BitmapCreateFromGraphics(170, 168, $graphics)
    $backbuffer1 = _GDIPlus_ImageGetGraphicsContext($bitmap1)
    $pen = _GDIPlus_PenCreate(0xFFFFFFFF, 2)
    $image = _GDIPlus_ImageLoadFromFile("obj.png")
    $matrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($matrix, 85, 84)
  ; ==========================================
    $image1 = _GDIPlus_ImageLoadFromFile("obj01.bmp")
    
    $inc = 0
    Do
        _GDIPlus_GraphicsClear($backbuffer, 0x00FFFFFF)
        _GDIPlus_MatrixRotate($matrix, 2)
        _GDIPlus_GraphicsSetTransform($backbuffer, $matrix)
        _GDIPlus_GraphicsDrawImageRect($backbuffer1, $image1, 0, 0, 170, 168)
        _GDIPlus_GraphicsDrawImageRect($backbuffer, $image, -85, -84, 170, 168)
        _GDIPlus_GraphicsDrawImageRect($backbuffer1, $bitmap, 0, 0, 170, 168)
        _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap1, 2, 34, 170, 168)
        Sleep(10)
    Until 0
    
    
    Func close()
        _GDIPlus_PenDispose($pen)
        _GDIPlus_MatrixDispose($matrix)
        _GDIPlus_GraphicsDispose($graphics)
        _WinAPI_DeleteObject($bitmap)
        _GDIPlus_GraphicsDispose($backbuffer)
        _GDIPlus_GraphicsDispose($backbuffer1)
        _WinAPI_DeleteObject($bitmap1)
        _GDIPlus_Shutdown()
        Exit
    EndFunc ;==>close
  ;

Edit: To make it rotate in the other direction, change:-

_GDIPlus_MatrixRotate($matrix, 2) to _GDIPlus_MatrixRotate($matrix, -2).

Edited by Malkey
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

  • Recently Browsing   0 members

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