1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • Tutorial AutoIt und Assembler UPDATE 24. Oktober 2010 Verwendung von Autoitvariablen im Assemblercode

    • UEZ
    • 24. August 2010 um 14:53
    Zitat von Andy

    Optimierung von Code am Beispiel des Tunnelfluges

    Wer das Beispiel im vorherigen Post durchgegangen ist, der hat wahrscheinlich den Kopf geschüttelt ob so viel Unfähigkeit des Programmierers^^
    Warum?
    Nun, wir (ich) haben ein AutoItScript nach Assembler portiert, aber dieses gemacht, OHNE NACHZUDENKEN!
    Allein das AutoItScript hat reichlich Kürzungs- und Optimierungsbedarf!
    Selbst mit geringen mathematischen Kenntnissen, kommt man auf folgendes Script:

    Spoiler anzeigen
    [autoit]

    ;Idea taken from http://js1k.com/demo/462
    ;Ported to AutoIt by UEZ Build 2010-08-20
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "Star Burst_Obfuscated.au3"
    #AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
    ;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
    #include
    #include
    ;Opt("MustDeclareVars", 1)
    Opt("GUIOnEventMode", 1)

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

    Local $hGUI, $hGraphics, $hBackbuffer, $hBitmap
    Local $H = 332, $W = 332
    ; Initialize GDI+
    _GDIPlus_Startup()

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

    $hGUI = GUICreate("GDI+ Test", $W, $H)
    GUISetState()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($W, $H, $hGraphics)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    ; Using antialiasing
    ;~ _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 0)
    ; Create a Brush object
    Local $hBrush = _GDIPlus_BrushCreateSolid()

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

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

    adlibregister("_fps",1000)

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

    global $pi = ACos(-1), $pi2 = 2 * $pi, $pi05 = ACos(-1) * 0.5, $fps
    Local $HW = $H * 0.5, $HH = $W * 0.5
    Local $A0 = 0, $A1 = 0, $A2 = 0, $A3 = 0
    Local $ox = 0, $oy = 0, $0z = 0
    Local $tu = 0, $tv = 0
    Local $speed = 2
    Local $i, $j, $x, $y, $o
    Local $cc, $ss, $z, $col
    Local $dx, $dy, $dz, $rd, $A, $B, $C, $R, $t1, $tu, $tv, $q, $g, $l
    Local $d[$W + 1]

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

    $zwonulldrei=203.718330632686
    $nulldrei=0.390625
    ;$a1=0.07

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

    While 1;Sleep(10)
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000)

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

    For $i = 0 To $H Step $speed
    For $j = 0 To $W Step $speed
    $dx=($j/$W)-0.5;
    $dy=($i/$H)-0.5;
    $tu=int($zwonulldrei*ATan2($dy,$dx))
    $tv=($nulldrei/sqrt($dx*$dx+$dy*$dy))+$A1
    $tv=int($tv*256)
    $g = Hex(bitand(Bitxor($tu , $tv), 0xFF), 2)
    $col = "0xFF" & $g & $g & $g
    _GDIPlus_BrushSetSolidColor($hBrush, $col)
    _GDIPlus_GraphicsFillRect($hBackbuffer, $j, $i, $speed, $speed, $hBrush)

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

    Next
    Next
    $A1 += 0.07

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

    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $W, $H)
    $fps+=1
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $A1 = ' & $A1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    WEnd

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

    func _FPS()
    winsettitle($hgui,"",$FPS)
    $FPS=0
    endfunc

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

    Func Rotate($t)
    $cc = Cos($t)
    $ss = Sin($t)
    $z = $x * $cc - $y * $ss
    $y = $x * $ss + $y * $cc
    $x = $z
    EndFunc

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

    func atan2($y,$x)
    return (2*atan($y/($x+sqrt($x*$x+$y*$y))))
    endfunc

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

    Func ATan2_UEZ($y,$x)
    Switch $x
    Case ($x > 0)
    Return ATan($y / $x)
    Case ($x < 0 And $y >= 0)
    Return ATan($y / $x + $pi)
    Case ($x < 0 And $y < 0)
    Return ATan($y / $x - $pi)
    Case ($x = 0 And $y > 0)
    Return $pi05
    Case ($x = 0 And $y < 0)
    Return -$pi05
    Case ($x = 0 And $y = 0)
    Return 0
    EndSwitch
    EndFunc

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

    Func _Exit()
    ; Clean up
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

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

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]

    Das sieht schon anders aus!
    Viele Variablen sind verschwunden und jede Menge Rechnerei auch!

    Alles anzeigen

    Dafür fehlt jetzt aber die Rotation ;)

    Gruß,
    UEZ

  • Selbst aktuellisierende Uhr

    • UEZ
    • 24. August 2010 um 00:03

    Hier eine recht simple Uhr in GDI+!

    Ich hoffe, dass du damit was anfangen kannst!

    [ offen ] Gdi plus

    Gruß,
    UEZ

  • Listview Registry

    • UEZ
    • 22. August 2010 um 14:07

    Probieres es mal damit:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Include <GuiListView.au3>
    #include <Array.au3>

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

    Opt('MustDeclareVars', 1)

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

    Example()

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

    Func Example()
    Local $listview, $button1, $button2, $item1, $item2, $item3, $input1, $msg
    Local $aSel, $dat1, $dat2, $dat3, $val1, $val2, $val3, $aWert

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

    GUICreate("listview items", 640, 250, 100, 200, -1)
    GUISetBkColor(0x00E0FFFF) ; will change background color

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

    $listview = GUICtrlCreateListView("Name |Pfad", 10, 10, 600, 150, -1, $LVS_REPORT + $LVS_EX_FULLROWSELECT);,$LVS_SORTDESCENDING)
    $button1 = GUICtrlCreateButton("Value?", 40, 170, 70, 20)
    $button2 = GUICtrlCreateButton("Delete", 110, 170, 70, 20)

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

    $val1 = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 1)
    $dat1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $val1)
    $val2 = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 2)
    $dat2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $val2)
    $val3 = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 3)
    $dat3 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $val3)

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

    $item1 = GUICtrlCreateListViewItem($val1 & "|" & $dat1, $listview)
    $item2 = GUICtrlCreateListViewItem($val2 & "|" & $dat2, $listview)
    $item3 = GUICtrlCreateListViewItem($val3 & "|" & $dat3, $listview)
    GUISetState()
    _GUICtrlListView_SetColumnWidth($listview, 0, 175)
    _GUICtrlListView_SetColumnWidth($listview, 1, 350)

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

    Do
    $msg = GUIGetMsg()

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

    Select
    Case $msg = $button1
    MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
    Case $msg = $listview
    MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
    Case $msg = $button2
    $aSel = _GUICtrlListView_GetSelectedIndices($listview, 1)
    If $aSel[0] > 0 Then
    $aWert = StringSplit(GUICtrlRead(GUICtrlRead($listview), 2), "|", 2)
    If Not @error Then
    ;~ _ArrayDisplay($aWert)
    ;RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", $aWert[0])
    _GUICtrlListView_DeleteItem($listview, $aSel[1])
    EndIf
    EndIf
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>Example

    [/autoit]

    Habe es mit RegDelete nicht Live getestet, sollte aber so gehen!

    Schaue mal in CSV-Editor rein. Dort sind viele Techniken zu deinem Problem bereits implementiert!
    Gruß,
    UEZ

  • Sin, Cos & Tan Problem(e)

    • UEZ
    • 18. August 2010 um 19:50

    Du musst die Werte von Radiant nach Grad umwandeln -> http://de.wikipedia.org/wiki/Radiant_(Einheit) / http://de.wikipedia.org/wiki/Grad_(Winkel)

    Spoiler anzeigen
    [autoit]


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

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

    $AuslesevariableCosinus = ""
    $AuslesevariableSinus = ""
    $AuslesevariableTangens = ""
    $deg = ACos(-1) / 180

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

    #Region ### START Koda GUI section ### Form=C:\Users\Tobias-Admin\Documents\Form1SinusCosinusTest.kxf
    $Form1SinusundCosinusTest = GUICreate("Sinus und Cosinus Test", 403, 214, -1, -1)
    $Input1Sinus = GUICtrlCreateInput("Zahl", 144, 16, 121, 21, $SS_CENTER)
    $Input2Cosinus = GUICtrlCreateInput("Zahl", 144, 64, 121, 21, $SS_CENTER)
    $Button1BerechnenSinusundCosinusTest = GUICtrlCreateButton("Berechnen", 24, 152, 107, 49)
    $Button2BeendenSinusundCosinusTest = GUICtrlCreateButton("Beenden", 272, 152, 107, 49)
    $Label1Sin = GUICtrlCreateLabel("Sin", 16, 16, 52, 17)
    $Label2gleich = GUICtrlCreateLabel("=", 88, 16, 36, 17)
    $Label3Cos = GUICtrlCreateLabel("Cos", 16, 64, 52, 17)
    $Label4gleich = GUICtrlCreateLabel("=", 88, 64, 36, 17)
    $Input3Tangens = GUICtrlCreateInput("Zahl", 144, 104, 121, 21, $SS_CENTER)
    $Label5Tan = GUICtrlCreateLabel("Tan", 16, 104, 36, 17)
    $Label6gleich = GUICtrlCreateLabel("=", 88, 104, 36, 17)
    GUISetState(@SW_SHOW, $Form1SinusundCosinusTest)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsgSinusundCosinusTest = GUIGetMsg()
    Switch $nMsgSinusundCosinusTest
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1BerechnenSinusundCosinusTest
    _FunktionTest ()
    Case $Button2BeendenSinusundCosinusTest
    Exit
    EndSwitch
    WEnd

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

    Func _FunktionTest ()
    $AuslesevariableSinus = GUICtrlRead($Input1Sinus)
    $AuslesevariableCosinus = GUICtrlRead($Input2Cosinus)
    $AuslesevariableTangens = GUICtrlRead($Input3Tangens)
    $cos = Cos($AuslesevariableCosinus * $deg)
    $sin = Sin($AuslesevariableSinus * $deg)
    $tan = Tan($AuslesevariableTangens * $deg)
    If $AuslesevariableSinus <> 0 And $AuslesevariableCosinus <> 0 And $AuslesevariableTangens <> 0 Then
    MsgBox(0, "Ergebnis Sinus, Cosinus und Tangens", "Sinus von "&$AuslesevariableSinus&" = "&$sin&@CR&"Cosinus von "&$AuslesevariableCosinus&" = "&$cos&@CR&"Tangens von "&$AuslesevariableTangens&" = "&$tan)
    ElseIf $AuslesevariableSinus <> 0 Then
    MsgBox(0, "Ergebnis Sinus", "Sinus von "&$AuslesevariableSinus&" = "&$sin)
    ElseIf $AuslesevariableCosinus <> 0 Then
    MsgBox(0, "Ergebnis Cosinus", "Cosinus von "&$AuslesevariableCosinus&" = "&$cos)
    ElseIf $AuslesevariableTangens <> 0 Then
    MsgBox(0, "Ergebnis Tangens", "Tangens von "&$AuslesevariableTangens&" = "&$tan)
    ElseIf $AuslesevariableSinus = 0 And $AuslesevariableCosinus = 0 And $AuslesevariableTangens = 0 Then
    MsgBox(0, "Ungültige Eingabe!", "Du hast nichts eingegeben.")
    EndIf
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • bilder komprimieren

    • UEZ
    • 18. August 2010 um 15:48

    Ich hatte mal dazu was geschrieben ;)

    Spoiler anzeigen
    [autoit]


    ;fast hack by UEZ
    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #include <ScreenCapture.au3>

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

    Opt('MustDeclareVars', 1)

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

    _Main()

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

    Func _Main()
    Local $hGUI1, $hGUI2, $hGUI3, $hImage, $hGraphic1, $hGraphic2, $hGraphic3, $sCLSID
    Local $bitmap1, $bitmap2, $bitmap3, $image1, $image2, $image3
    Local $tData, $tParams, $pParams, $pData

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

    ; Capture top left corner of the screen
    _ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg", 0, 0, 400, 300)

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

    ; Create a GUI for the original image
    $hGUI1 = GUICreate("Original", 400, 300, 0, 0)
    GUISetState()

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

    ; Create a GUI for the scaled up image
    $hGUI2 = GUICreate("Scaled Up", 800, 600, 0, 350)
    GUISetState()

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

    ; Create a GUI for the scaled down image
    $hGUI3 = GUICreate("Scaled Down", 200, 150, 820, 400)
    GUISetState()

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

    ; Initialize GDI+ library and load image
    _GDIPlus_Startup ()
    $hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

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

    $sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

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

    ; Draw original image
    $hGraphic1 = _GDIPlus_GraphicsCreateFromHWND ($hGUI1)
    $bitmap1 = _GDIPlus_BitmapCreateFromGraphics(400, 300, $hGraphic1)
    $image1 = _GDIPlus_ImageGetGraphicsContext($bitmap1)
    _GDIPlus_GraphicsDrawImageRect($image1, $hImage, 0, 0, 400, 300)
    _GDIPlus_GraphicsDrawImageRect($hGraphic1, $bitmap1, 0, 0, 400, 300)
    _GDIPlus_ImageSaveToFileEx($bitmap1, @ScriptDir & "\GDIPlus_Image1.jpg", $sCLSID)
    _WinAPI_DeleteObject($bitmap1)
    _GDIPlus_GraphicsDispose($image1)

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

    ; Draw 2x scaled up image and save with lower jpg quality
    $hGraphic2 = _GDIPlus_GraphicsCreateFromHWND ($hGUI2)
    $bitmap2 = _GDIPlus_BitmapCreateFromGraphics(800, 600, $hGraphic2)
    $image2 = _GDIPlus_ImageGetGraphicsContext($bitmap2)
    _GDIPlus_GraphicsDrawImageRectRect ($image2, $hImage, 0, 0, 400, 300, 0, 0, 800, 600)
    _GDIPlus_GraphicsDrawImageRect($hGraphic2, $bitmap2, 0, 0, 800, 600)
    $tParams = _GDIPlus_ParamInit (1)
    $tData = DllStructCreate("int Quality")
    DllStructSetData($tData, "Quality", 10) ;quality 0-100
    $pData = DllStructGetPtr($tData)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
    $pParams = DllStructGetPtr($tParams)
    _GDIPlus_ImageSaveToFileEx($bitmap2, @ScriptDir & "\GDIPlus_Image2.jpg", $sCLSID, $pParams)
    _WinAPI_DeleteObject($bitmap2)
    _GDIPlus_GraphicsDispose($image2)
    $tData = 0

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

    ; Draw 2x scaled down image
    $hGraphic3 = _GDIPlus_GraphicsCreateFromHWND ($hGUI3)
    $bitmap3 = _GDIPlus_BitmapCreateFromGraphics(200, 150, $hGraphic3)
    $image3 = _GDIPlus_ImageGetGraphicsContext($bitmap3)
    _GDIPlus_GraphicsDrawImageRectRect ($image3, $hImage, 0, 0, 400, 300, 0, 0, 200, 150)
    _GDIPlus_GraphicsDrawImageRect($hGraphic3, $bitmap3, 0, 0, 200, 150)
    _GDIPlus_ImageSaveToFileEx($bitmap3, @ScriptDir & "\GDIPlus_Image3.jpg", $sCLSID)
    _WinAPI_DeleteObject($bitmap3)
    _GDIPlus_GraphicsDispose($image3)

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

    ; Release resources
    _GDIPlus_GraphicsDispose ($hGraphic1)
    _GDIPlus_GraphicsDispose ($hGraphic2)
    _GDIPlus_GraphicsDispose ($hGraphic3)
    _GDIPlus_ImageDispose ($hImage)
    _GDIPlus_Shutdown ()

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

    ; Clean up screen shot file
    FileDelete(@MyDocumentsDir & "\GDIPlus_Image.jpg")

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

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

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

    Exit

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

    EndFunc ;==>_Main

    [/autoit]

    Schaue dir die Zeilen 52-58 genauer an :D

    Gruß,
    UEZ

    Dateien

    Image Scale and Save+.au3 3,37 kB – 242 Downloads
  • GDI+ Bild rotieren

    • UEZ
    • 17. August 2010 um 22:52

    Schau' mal hier nach: [ offen ] GDI - Png drehen und auf Hintergrund zeichen

    Gruß,
    UEZ

  • Gdi plus

    • UEZ
    • 16. August 2010 um 23:30

    Hier meine Version:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ 2011 build 2011-04-06
    ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
    #AutoIt3Wrapper_UseUpx=y
    #AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters
    ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

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

    #include <Date.au3>
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #Include <Timers.au3>
    #include <WindowsConstants.au3>

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

    Opt("MustDeclareVars", 1)
    Opt("GUIOnEventMode", 1)

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

    Global $hGUI, $hGraphics, $hBackbuffer, $hBitmap, $hPen1, $hPen2, $hPen3, $hPen4
    Global $iX = 600, $iY = $iX
    Global Const $p2_hm = $iX / 35
    Global Const $p3_hm = $iX / 35
    Global Const $p4_hm = $iX / 100
    Global $newY = $iX, $newX = $iY
    Global Const $minSize = $iX * 0.25
    Global Const $maxSize = $iX * 1.5
    Global Const $cX = $iX * 0.5, $cY = $iY * 0.5
    Global Const $deg = ACos(-1) / 180
    Global Const $radius = $iX * 0.85, $cR = $radius * 0.50
    Global Const $cR1 = $cR * 0.90, $cR2 = $cR * 0.20
    Global Const $cR3 = $cR * 0.80, $cR4 = $cR * 0.15
    Global Const $cR5 = $cR * 0.50, $cR6 = $cR * 0.10
    Global $sek = @SEC * 6 - 90
    Global $min = @MIN * 6 + (@SEC / 10) - 90
    Global $std = @HOUR * 30 + (@MIN / 2) - 90
    Global Const $fs = $iY / 30, $tms = $iY / 20, $tmh = $iY * 0.725
    Global $x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $x5, $x6, $y5, $y6, $tm
    ; Initialize GDI+
    _GDIPlus_Startup()

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

    $hGUI = GUICreate("GDI+ Simple Clock by UEZ 2011", $iX, $iY, -1, -1, $WS_SIZEBOX)
    If @OSBuild < 7600 Then WinSetTrans($hGui,"", 0xFF) ;workaround for XP machines when alpha blending is activated on _GDIP
    GUISetState()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)

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

    ; Using antialiasing
    _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)

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

    ; Create a Pen object
    $hPen1 = _GDIPlus_PenCreate(0xFF800010, 4)
    $hPen2 = _GDIPlus_PenCreate(0xA01010F0, $p2_hm)
    $hPen3 = _GDIPlus_PenCreate(0xA01010F0, $p3_hm)
    $hPen4 = _GDIPlus_PenCreate(0x9010D040, $p4_hm)

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

    Global Const $LineCapRound = 2, $LineCapTriangle = 3, $DashCapFlat = 0
    Global $hPath, $hCustomLineCap, $avCaps
    Global $avPoints[3][2] = [[2], [0, 0], [0, 0]]

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

    $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddLines($hPath, $avPoints)
    $hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)
    _GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $LineCapTriangle, $LineCapRound)
    $avCaps = _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
    _GDIPlus_PenSetLineCap($hPen2, $avCaps[0], $avCaps[1], $DashCapFlat)
    _GDIPlus_PenSetLineCap($hPen3, $avCaps[0], $avCaps[1], $DashCapFlat)
    _GDIPlus_PenSetLineCap($hPen4, $avCaps[0], $avCaps[1], $DashCapFlat)

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

    Global $ws = WinGetPos($hGUI)
    Global $ratio = $ws[3] / $ws[2]
    Global $font = "Comic Sans MS"
    If FileExists(@WindowsDir & "\fonts\showg.ttf") Then $font = "Showcard Gothic"

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

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

    AdlibRegister("Ticker", 50)

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

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_SIZING, "WM_SIZING")
    GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
    GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

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

    Global $timer = 100, $speak = False, $speak_init = True, $SpeakingClock = True
    Global $oVoice = ObjCreate("SAPI.SpVoice")
    If @error Then
    $speak_init = False
    Else
    $oVoice.Rate = -3
    EndIf

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

    GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113
    DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $timer, "int", 0)

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

    AdlibRegister( "SpeakingClock", 1000)

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

    While Sleep(100000000)
    WEnd

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

    Func Draw()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xF0FFFFFF)

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

    _GDIPlus_GraphicsDrawLine($hBackbuffer, $cX - $cR, $cY, $cX - $cR + 35, $cY, $hPen1)
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $cX + $cR, $cY, $cX + $cR - 35, $cY, $hPen1)
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $cX, $cY - $cR, $cX, $cY - $cR + 35, $hPen1)
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $cX, $cY + $cR, $cX, $cY + $cR - 35, $hPen1)
    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $cX - $cR, $cY - $cR, $radius, $radius, $hPen1)

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

    For $i = 0 To 11
    _GDIPlus_GraphicsDrawString($hBackbuffer, $i + 1, -$fs / 2 + $cX + Cos(-45 + $i * 29.7 * $deg) * $cR3, -$fs * 0.9 + $cY + Sin(-45 + $i * 29.7 * $deg) * $cR3, $font, $fs)
    Next
    If Int(StringLeft(_NowTime(4), 2) / 12) Then
    $tm = "PM"
    Else
    $tm = "AM"
    EndIf
    _GDIPlus_GraphicsDrawString($hBackbuffer, $tm, -$tms * 1.1 + $cX, $tmh, $font, $tms)

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

    $x5 = $cX + Cos($std * $deg) * $cR5
    $y5 = $cY + Sin($std * $deg) * $cR5
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $x5, $y5, $cX, $cY, $hPen2) ;hours

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

    $x3 = $cX + Cos($min * $deg) * $cR3
    $y3 = $cY + Sin($min * $deg) * $cR3
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $x3, $y3, $cX, $cY, $hPen3) ;minutes

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

    $x1 = $cX + Cos($sek * $deg) * $cR1
    $y1 = $cY + Sin($sek * $deg) * $cR1
    $x2 = $cX + Cos(($sek + 180) * $deg) * $cR2
    $y2 = $cY + Sin(($sek + 180) * $deg) * $cR2
    _GDIPlus_GraphicsDrawLine($hBackbuffer, Floor($x1), Floor($y1), Floor($x2), Floor($y2), $hPen4) ;seconds

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

    _GDIPlus_GraphicsDrawEllipse($hBackbuffer, $cX - 3, $cY - 3, 6, 6, $hPen1)

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

    _GDIPlus_GraphicsDrawString($hBackbuffer, @HOUR & ":" & @MIN & ":" & @SEC, 0, 0)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iX, $iY)
    _WinAPI_RedrawWindow($hGUI)
    EndFunc

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

    Func SpeakingClock()
    If $min = -90.00 And $speak_init And $SpeakingClock Then $oVoice.Speak("It is " & Mod(@HOUR, 12) & " " & $tm, 1)
    EndFunc

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

    Func WM_ERASEBKGND($hWnd, $Msg, $wParam, $lParam)
    Local $hGraphicsTemp = _GDIPlus_GraphicsCreateFromHDC($wParam)
    _GDIPlus_GraphicsDrawImageRect($hGraphicsTemp, $hBitmap, 0, 0, $iX, $iY)
    _GDIPlus_GraphicsDispose($hGraphicsTemp)
    Return True
    EndFunc ;==>_WM_ERASEBKGND

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

    Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    $iX = BitAND($lParam, 0x0000FFFF)
    $iY = BitShift(BitAND($lParam, 0xFFFF0000), 16)
    ;~ ConsoleWrite("x: " & $iX & ", y: " & $iY & @CRLF)
    _WinAPI_RedrawWindow($hGUI)
    Return "GUI_RUNDEFMSG"
    EndFunc

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

    Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)

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

    Switch $wParam ;drag side or corner
    Case 1, 2, 4, 7
    $newY = ($right - $left) * $ratio
    DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 2) + $newY, 4)
    Case Else
    $newX = ($bottom - $top) / $ratio
    DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 1) + $newX, 3)
    EndSwitch
    Return "GUI_RUNDEFMSG"
    EndFunc ;==>WM_SIZING

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

    Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, $minSize) ; min X
    DllStructSetData($minmaxinfo, 8, $minSize) ; min Y
    DllStructSetData($minmaxinfo, 9, $maxSize) ; max X
    DllStructSetData($minmaxinfo, 10, $maxSize) ; max Y
    Return "GUI_RUNDEFMSG"
    EndFunc ;==>WM_GETMINMAXINFO

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

    Func Ticker()
    $sek = @SEC * 6 - 90
    $min = @MIN * 6 + (@SEC * 0.10) - 90
    $std = @HOUR * 30 + (@MIN * 0.50) - 90
    EndFunc

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

    Func _Exit()
    AdlibUnRegister("Ticker")
    AdlibUnRegister("SpeakingClock")
    $oVoice = 0
    GUIRegisterMsg($WM_TIMER, "")
    GUIRegisterMsg($WM_GETMINMAXINFO, "")
    GUIRegisterMsg($WM_SIZE, "")
    GUIRegisterMsg($WM_ERASEBKGND, "")
    GUIRegisterMsg($WM_SIZING, "")

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

    ; Clean up GDI+ resources
    _GDIPlus_CustomLineCapDispose($hCustomLineCap)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_PenDispose($hPen3)
    _GDIPlus_PenDispose($hPen4)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hBackbuffer)
    _GDIPlus_GraphicsDispose($hGraphics)

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

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
    Exit
    EndFunc

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

    Func _GDIPlus_PathCreate($iFillMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", $iFillMode, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[2]
    EndFunc ;==>_GDIPlus_PathCreate

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

    Func _GDIPlus_PathAddLines($hPath, $aPoints)
    Local $iI, $iCount, $pPoints, $tPoints, $aResult
    $iCount = $aPoints[0][0]
    $tPoints = DllStructCreate("float[" & $iCount * 2 & "]")
    $pPoints = DllStructGetPtr($tPoints)
    For $iI = 1 To $iCount
    DllStructSetData($tPoints, 1, $aPoints[$iI][0], (($iI - 1) * 2) + 1)
    DllStructSetData($tPoints, 1, $aPoints[$iI][1], (($iI - 1) * 2) + 2)
    Next
    $aResult = DllCall($ghGDIPDll, "uint", "GdipAddPathLine2", "hwnd", $hPath, "ptr", $pPoints, "int", $iCount)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_PathAddLines

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

    Func _GDIPlus_PathDispose($hPath)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_PathDispose

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

    Func _GDIPlus_CustomLineCapCreate($hPathFill, $hPathStroke, $iLineCap = 0, $nBaseInset = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateCustomLineCap", "hwnd", $hPathFill, "hwnd", $hPathStroke, "int", $iLineCap, "float", $nBaseInset, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[5]
    EndFunc ;==>_GDIPlus_CustomLineCapCreate

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

    Func _GDIPlus_CustomLineCapSetStrokeCaps($hCustomLineCap, $iStartCap, $iEndCap)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int", $iStartCap, "int", $iEndCap)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_CustomLineCapSetStrokeCaps

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

    Func _GDIPlus_CustomLineCapGetStrokeCaps($hCustomLineCap)
    Local $aCaps[2], $aResult
    $aResult = DllCall($ghGDIPDll, "uint", "GdipGetCustomLineCapStrokeCaps", "hwnd", $hCustomLineCap, "int*", 0, "int*", 0)
    If @error Then Return SetError(@error, @extended, -1)
    If $aResult[0] Then Return -1
    $aCaps[0] = $aResult[2]
    $aCaps[1] = $aResult[3]
    Return $aCaps
    EndFunc ;==>_GDIPlus_CustomLineCapGetStrokeCap

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

    Func _GDIPlus_PenSetLineCap($hPen, $iStartCap, $iEndCap, $iDashCap)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetPenLineCap197819", "hwnd", $hPen, "int", $iStartCap, "int", $iEndCap, "int", $iDashCap)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_PenSetLineCap

    [/autoit]

    Gruß,
    UEZ

    Dateien

    Simple GDI+ Clock.au3 10,8 kB – 371 Downloads
  • _WinAPI_SetLayeredWindowAttributes

    • UEZ
    • 13. August 2010 um 17:04

    Hier was ähnliches als 1-Fenster Lösung:

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #Include <WinAPIEx.au3>

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

    Opt('MustDeclareVars', 1)

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

    If Not _WinAPI_DwmIsCompositionEnabled() Then
    MsgBox(16, 'Error', 'Require Windows Vista or above with enabled Aero theme.')
    Exit
    EndIf

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

    Global $hForm, $hRgn, $hDC, $hPen, $obj_orig

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

    ; Create GUI
    $hForm = GUICreate('Transparent GUI', 200, 200, Default, Default,$WS_POPUP, $WS_EX_TOPMOST)

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

    GUISetBkColor(0)
    GUISetState()

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

    $hDC = _WinAPI_GetWindowDC($hForm) ; DC of entire screen (desktop)
    $hPen = _WinAPI_CreatePen($PS_SOLID, 5,0xFFFFFF)
    $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
    _WinAPI_DrawLine($hDC, 5, 5, 5, 195)
    _WinAPI_DrawLine($hDC, 5, 5, 195, 5)
    _WinAPI_DrawLine($hDC, 195, 5, 195, 195)
    _WinAPI_DrawLine($hDC, 5, 195, 195, 195)

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

    ; Create the "sheet of glass" effect for the specified region. You must call this function whenever DWM composition is toggled.
    _WinAPI_DwmGetColorizationColor()
    If Not @extended Then
    $hRgn = _WinAPI_CreateRectRgn(5, 5, 195, 195)
    Else
    $hRgn = 0
    EndIf
    _WinAPI_DwmEnableBlurBehindWindow($hForm, 1, 0, $hRgn)
    If $hRgn Then
    _WinAPI_DeleteObject($hRgn)
    EndIf

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

    Do
    Until GUIGetMsg() = -3

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

    _WinAPI_SelectObject($hDC, $obj_orig)
    _WinAPI_DeleteObject($hPen)
    _WinAPI_ReleaseDC($hForm, $hDC)
    GUIDelete($hForm)
    Exit

    [/autoit]

    Benötigt wird die WinAPIEx.au3 und Vista+ und Aero!

    Gruß,
    UEZ

  • QuickDraw 100mal so schnell wie GDIPlus Update10 Texture speichern / Screencap

    • UEZ
    • 12. August 2010 um 23:55

    Hier mal 2 Beispiele erstellt mit QuickDraw:

    Tramp of Particles:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Twister:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Als Vergleich auch die GDI+ und WinAPI Version ;)

    Danke an Andy für die WinAPI Version! :thumbup:

    Isometric Level-3 Cube:
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Gruß,
    UEZ

    Bilder

    • Isometric Level-3 Cube.jpg
      • 7,65 kB
      • 260 × 209
    • Twister.png
      • 2,42 kB
      • 124 × 286

    Dateien

    Isometric Level-3 Cube.au3 3,86 kB – 315 Downloads GDI+ Isometric Level-3 Cube.au3 5,08 kB – 325 Downloads Tramp of Particles.png 6,69 kB – 0 Downloads Tramp of Particles.au3 2,71 kB – 359 Downloads GDI+ Tramp of Particles.au3 4,74 kB – 338 Downloads Tramp of Particles WinAPI.au3 5,17 kB – 315 Downloads Twister GDI+.au3 4,37 kB – 324 Downloads Twister WinAPI.au3 5,05 kB – 310 Downloads Twister.au3 3,08 kB – 325 Downloads
  • _WinAPI_SetLayeredWindowAttributes

    • UEZ
    • 11. August 2010 um 16:27

    Hier eine Version:

    Spoiler anzeigen
    [autoit]


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

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

    #Region ### START Koda GUI section ### Form=
    $width = 200
    $height = 200
    $hwnd = GUICreate("Form1", $width, $height, Default, Default, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
    GUISetState(@SW_SHOW)
    $bsize_x = 50
    $bsize_y = 30
    $child = GUICreate("", $bsize_x, $bsize_y, $width * 0.5 - $bsize_x * 0.5, $height * 0.5 - $bsize_y * 0.5, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hwnd)
    $button = GUICtrlCreateButton ("Test", 0, 0, $bsize_x, $bsize_y)
    _WinAPI_SetLayeredWindowAttributes($child, 0xFFFFFF, 160)
    GUISetState(@SW_SHOW)

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

    ;~ GUISetBkColor (0xFFFFFF)
    #EndRegion ### END Koda GUI section ###

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

    _GDIPlus_Startup ()
    $Graphics = _GDIPlus_GraphicsCreateFromHWND ($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

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

    $ScreenDc = _WinAPI_GetDC($hWnd)
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    $dc = _WinAPI_CreateCompatibleDC($ScreenDc)
    _WinAPI_SelectObject($dc, $gdibitmap)
    ; _WinAPI_UpdateLayeredWindow parameters
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", $width)
    DllStructSetData($tSize, "Y", $height)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    $alpha = 160
    DllStructSetData($tBlend, "Alpha", $alpha)
    DllStructSetData($tBlend, "Format", 0)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $PenRect = _GDIPlus_PenCreate (0xFFFFAA00, 10)
    _GDIPlus_GraphicsClear($backbuffer, 0xFFFFFFFF)
    _GDIPlus_GraphicsDrawRect($backbuffer, 0, 0, $width, $height, $PenRect)
    $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
    _WinAPI_SelectObject($dc, $gdibitmap)
    _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
    _WinAPI_DeleteObject($gdibitmap)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($bitmap)
    _WinAPI_DeleteDC($dc)
    _WinAPI_ReleaseDC($hWnd, $ScreenDc)
    _GDIPlus_GraphicsDispose($Graphics)
    _GDIPlus_Shutdown()
    $tSize = ""
    $tSource = ""
    $tBlend = ""
    $tPoint = ""
    GUIDelete($child)
    GUIDelete($hwnd)
    Exit
    Case $button
    WinSetOnTop($hwnd, "", False)
    MsgBox(0, "Transparenz", "von UEZ '2010")
    WinSetOnTop($hwnd, "", True)
    EndSwitch
    WEnd

    [/autoit]

    Gruß,
    UEZ

  • Tutorial AutoIt und Assembler UPDATE 24. Oktober 2010 Verwendung von Autoitvariablen im Assemblercode

    • UEZ
    • 9. August 2010 um 22:21

    Well done ANDY 8o :thumbup: :thumbup: :thumbup: :thumbup:

    Vielen Dank für das ausführliche Tutorial :!: :!: :!:

    Gruß,
    UEZ

  • [gelöst] 2d Physikengine geucht

    • UEZ
    • 9. August 2010 um 21:48
    Zitat von Sprenger120

    Hi,

    Kennt einer eine gute 2D Physikengine für AutoIt ? Moritz Engine ist ok aber halt Perpetuo Mobile ^^
    Schon mal danke für die Antworten!


    So weit ich mich erinnern kann, kann man auch die Reibung einschalten -=> z.B. $Reibungs_Kooeffizient = 0.995

    Gruß,
    UEZ

  • Radius berechnen

    • UEZ
    • 9. August 2010 um 16:27

    Hier mein Vorschlag:

    Spoiler anzeigen
    [autoit]


    ;coded by UEZ
    #include <GDIPlus.au3>
    $r = 250
    $width = 2 * $r
    $height = 2 * $r
    $GUI = GUICreate("GDI+", $width, $height)
    GUISetState()

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

    _GDIPlus_Startup()
    $Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI)
    $Bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $Graphic)
    $Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)
    $Pen_Size = 2
    $Pen = _GDIPlus_PenCreate(0xFFF08080, $Pen_Size)
    $pi180 = ACos(-1) / 180
    $step1 = 2
    $step2 = 8

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

    While 1
    _GDIPlus_GraphicsClear($Buffer, 0xFFFFFFFF)
    _GDIPlus_PenSetColor($Pen, 0xFFF08080)
    ;zeichne Kreis
    For $x = 0 To 359 Step $step1
    _GDIPlus_GraphicsDrawEllipse($Buffer, $r + Cos($x * $pi180) * ($r - $Pen_Size - 1), $r + Sin($x * $pi180) * ($r - $Pen_Size - 1), $Pen_Size, $Pen_Size, $Pen)
    Next
    _GDIPlus_PenSetColor($Pen, 0xFF208040)
    ;zeichne Rechteck
    For $x = 0 To $width Step $step2
    _GDIPlus_GraphicsDrawEllipse($Buffer, $x, $Pen_Size, $Pen_Size, $Pen_Size, $Pen)
    _GDIPlus_GraphicsDrawEllipse($Buffer, $x, $width - $Pen_Size, $Pen_Size, $Pen_Size, $Pen)
    _GDIPlus_GraphicsDrawEllipse($Buffer, $Pen_Size, $x, $Pen_Size, $Pen_Size, $Pen)
    _GDIPlus_GraphicsDrawEllipse($Buffer, $height - $Pen_Size, $x, $Pen_Size, $Pen_Size, $Pen)
    Next

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

    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $width, $height)
    Switch GUIGetMsg()
    Case -3
    _GDIPlus_PenDispose($Pen)
    _GDIPlus_GraphicsDispose($Buffer)
    _GDIPlus_BitmapDispose($Bitmap)
    _GDIPlus_GraphicsDispose($Graphic)
    _GDIPlus_Shutdown()
    Exit
    EndSwitch
    sleep(10)
    WEnd

    [/autoit]

    Gruß,
    UEZ

  • ascII Maschine

    • UEZ
    • 9. August 2010 um 15:57

    Hilft dir vielleicht das hier weiter: Ascii Screenshot?

    Gruß,
    UEZ

  • Prüfen ob Maustate gedrückt

    • UEZ
    • 8. August 2010 um 00:16

    Schaue mal in die Windows Message Codes . Dort kannst du vielleicht was finden.

    Gruß,
    UEZ

  • Mit gdiplus Bilder zusammenfügen

    • UEZ
    • 7. August 2010 um 15:14

    Lade bitte mal 2 Bilder hoch, so dass ich den "Fehler" nachvollziehen kann!

    Gruß,
    UEZ

  • Mit gdiplus Bilder zusammenfügen

    • UEZ
    • 7. August 2010 um 11:58

    Hier ein kleines Beispiel:

    Spoiler anzeigen
    [autoit]


    #include <GDIplus.au3>
    Global $image = FileOpenDialog("Bild auswählen", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png)")
    If @error Then Exit
    _GDIPlus_Startup()
    Global $bitmap_from_file = _GDIPlus_BitmapCreateFromFile($image)
    Global Const $iX = _GDIPlus_ImageGetWidth($bitmap_from_file)
    Global Const $iY = _GDIPlus_ImageGetHeight($bitmap_from_file)
    Global Const $width = $iX
    Global Const $height = 2 * $iY
    Global $hwnd = GUICreate("Clone Y", $width, $height)
    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, 0, 0)
    _GDIPlus_GraphicsDrawImage($backbuffer, $bitmap_from_file, 0, $iY)
    GUISetState()

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

    Do
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    Until GUIGetMsg() = -3 * Sleep(30)

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

    _GDIPlus_ImageSaveToFile($bitmap, @ScriptDir & "\Test.bmp")
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()

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

    GUIDelete($hwnd)
    Exit

    [/autoit]

    Hausaufgabe: den Code erweitern, indem du ein zweites Bild aussuchst und es unter das erste Bild kopierst ;)

    Gruß,
    UEZ

  • QuickDraw 100mal so schnell wie GDIPlus Update10 Texture speichern / Screencap

    • UEZ
    • 6. August 2010 um 18:45

    Diese 2 BMPs werden nicht richtig dargestellt!

    1.
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    2.
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.


    So sieht es aus:

    1.
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    2.
    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Verwendeter Code:

    Spoiler anzeigen
    [autoit]


    #include "QuickDraw.au3"
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

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

    Local $width = 640
    Local $height = 480
    Local $pi_div_180 = 4 * ATan(1) / 180
    Local $w_h = $width * 0.5, $h_h = $height * 0.5 ; Bildschirm Mitte
    Local $size_x = 300
    Local $size_y = 300

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

    _QuickDraw_Enable("Test", $width, $height, False)

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

    GUISetOnEvent(-3, "close")

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

    Local $earth = _QuickDraw_LoadTexture("earth_small.bmp")

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

    _QuickDraw_ClearBuffer(0xFF000000)
    _QuickDraw_Rect($w_h - $size_x * 0.5, $h_h - $size_y * 0.5, $size_x, $size_y, $earth, 0xFFFFFFFF)

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

    Do
    _QuickDraw_SwapBuffers()
    Until Not _QuickDraw_Running()

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

    Func Close()
    _QuickDraw_FreeTexture($earth)
    _QuickDraw_Disable()
    EndFunc

    [/autoit]

    Kann ich die GUI nicht, wie ich will, auf dem Desktop positionieren, sondern nur an Position 0,0?

    Gruß,
    UEZ

    Dateien

    e1.jpg 9,86 kB – 0 Downloads e2.jpg 10,14 kB – 0 Downloads earth_small.bmp 94,05 kB – 152 Downloads earth_small2.bmp 423,05 kB – 291 Downloads
  • QuickDraw 100mal so schnell wie GDIPlus Update10 Texture speichern / Screencap

    • UEZ
    • 6. August 2010 um 09:56
    Zitat von moritz1243

    Update -> Version 4


    Sehr schönes und interessantes Projekt :thumbup:

    Weiter so :!:

    Gruß,
    UEZ

  • XM-Player

    • UEZ
    • 18. Juli 2010 um 17:57

    Schau' mal hier rein: XM Player oder hier: Play Chip Sound from Memory


    FMOD.AU3 hier: http://www.autoitscript.com/forum/index.php?showtopic=38549&view=findpost&p=480953


    Gruss,
    UEZ

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™