Bild drehen

  • Ich hab mal eine Fage, und zwar wollte ich ein Bild drehen.
    Also ich möchte nit das BIld selbs drehen, sondern es gedreht in einer Gui Darstellen. Hat da jemand eine Idee wie das gehen könnte?

    Ich hab mal was vorbereitet

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 447, 193, 125)
    $Pic1 = GUICtrlCreatePic(@WindowsDir & "\Angler.bmp", 240, 172, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    $Button1 = GUICtrlCreateButton("^", 602, 388, 27, 27, 0)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial")
    $Button2 = GUICtrlCreateButton("v", 602, 417, 27, 27, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]


    Ich will nur das wenn man auf die Button klickt, das sich das Bild dann dreht, ohne das an der Datei was verändert wird.

    mfg. Jam00

  • Na so ;) :

    [autoit]

    #include <GDIPlus.au3>

    [/autoit][autoit][/autoit][autoit]

    _GDIPlus_Startup()

    [/autoit][autoit][/autoit][autoit]

    $hGui = GUICreate("Test Rotate", 800, 600)
    GUISetState()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)

    [/autoit][autoit][/autoit][autoit]

    $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test.bmp")
    $iWidth = _GDIPlus_ImageGetWidth($hImage) * 96 / _GDIPlus_ImageGetVerticalResolution($hImage)
    $iHeight = _GDIPlus_ImageGetHeight($hImage) * 96 / _GDIPlus_ImageGetHorizontalResolution($hImage)

    [/autoit][autoit][/autoit][autoit]

    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, 400, 300)

    [/autoit][autoit][/autoit][autoit]

    For $i = 1 To 360
    _GDIPlus_MatrixRotate($hMatrix, 1, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)
    Sleep(1)
    Next

    [/autoit][autoit][/autoit][autoit]

    While GUIGetMsg() <> -3
    Sleep(10)
    WEnd

    [/autoit][autoit][/autoit][autoit]

    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

    [/autoit]

    lgE

  • Okay, THX
    hab es hinbekommen:-)

    Spoiler anzeigen
    [autoit]

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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Test Rotate", 800, 600)
    GUISetBkColor (0x000000)
    GUISetState()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage = _GDIPlus_ImageLoadFromFile(@WindowsDir & "\Angler.bmp")
    $iWidth = _GDIPlus_ImageGetWidth($hImage) * 96 / _GDIPlus_ImageGetVerticalResolution($hImage)
    $iHeight = _GDIPlus_ImageGetHeight($hImage) * 96 / _GDIPlus_ImageGetHorizontalResolution($hImage)
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, 400, 300)
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    _GDIPlus_MatrixRotate($hMatrix, 0, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
    _GDIPlus_GraphicsClear($hGraphic)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)
    While GUIGetMsg() <> -3
    If _IsPressed ("27") Then
    _GDIPlus_MatrixRotate($hMatrix, 5, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
    _GDIPlus_GraphicsClear($hGraphic)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)
    ElseIf _IsPressed ("25") Then
    _GDIPlus_MatrixRotate($hMatrix, -5, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
    _GDIPlus_GraphicsClear($hGraphic)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)
    EndIf
    Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _GDIPlus_MatrixRotate($hMatrix, 0, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
    _GDIPlus_GraphicsClear($hGraphic)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, -$iWidth / 2, -$iHeight / 2)
    EndFunc ;==>WM_PAINT

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

    [/autoit]

    mfg. Jam00

  • hy @ all

    wollt mir das ganze hier mal anschaun, jetzt gibt's bei mir nirgend's die funktionen

    _GDIPlus_MatrixTranslate ; _GDIPlus_ImageGetVerticalResolution($hImage) ; _GDIPlus_ImageGetHorizontalResolution($hImage)

    alle anderen werden erkannt .. und auch somit nicht von auto it bemängelt ..

    kann mit bitte einer die funktionen aus der GDIPlus.au3 posten ?!

    hab in nem anderen beitrag gelesen, dass die bei der aktuellen auto it version halt fehlt.. ??

    danke BYE !!

  • neuste version war drauf ...

    Scite4Autoit hab ich jetzt dazu installiert .. jetzt geht's ?! ABER WARUM ?!

    wozu brauch ich denn Scite4Autoit ?? hör ich jetzt das erste mal ...

    THX !!

  • Ich denke mal, bei SciteLite (bei der Autoitinstall dabei) sind nicht alle Funktionen integriert.
    Deshalb werden manche nicht blau angezeigt; Und beim drücken auf F1 öffnet sich auch nicht die richtige Seite der Hilfe.

    Das Script ansich hätte sicher funktioniert, denn der Interpreter ist unabhängig vom Editor...

    lgE

  • du weist nicht rein zufällig, wie ich ein VIDEO drehen kann .. ( welches von einer WEBCAM aufgenommen wird ) ???

    ... hab da so kleine umsetzungsprobleme...

    thx !! bye