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. eukalyptus

Beiträge von eukalyptus

  • Another AutoIt PreProcessor

    • eukalyptus
    • 11. März 2010 um 11:10

    neue Version ist nun fertig

    download im ersten Post

  • GDI+ Sinuskurve

    • eukalyptus
    • 11. März 2010 um 05:34

    Keine Angst, liegt nicht an dir!

    AutoIt rechnet mit Radiant statt mit Grad:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    $hGUI = GUICreate("Sinuskurve", 640, 480)
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

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

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

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

    GUISetState()
    Do
    Until GUIGetMsg() = -3

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

    Func WM_PAINT()
    Local $pi = 3.14159265358979
    Local $degToRad = $pi / 180
    For $i = 0 To 720
    _GDIPlus_GraphicsFillRect($hGraphic,$i,240 + (Sin($i*$degToRad) * 100),1,1)
    Next
    EndFunc ;==>WM_PAINT

    [/autoit]
  • GDI+ Rotating Cubes

    • eukalyptus
    • 10. März 2010 um 18:14

    PrideRage: Wenn du XP hast, dann probier mal WinSetTrans($hwnd,"",255) in Zeile 14 (nach GuiSetState)

    UEZ: einfach toll :thumbup:

  • Leviathan hat Gebrtstag

    • eukalyptus
    • 10. März 2010 um 18:12

    Alles Gute!

    mfgE

  • [Beendet] µitLight März

    • eukalyptus
    • 10. März 2010 um 12:04

    Ich habe meine Versionen nun fertig!

    Version 1 kommt ohne Obergrenze aus und man kann bestimmen, wieviele Primzahlen man haben möchte.
    Laufzeit ca 60 Sekunden

    Version 2 benötigt die besagte Obergrenze und liefert alle Primzahlen bis zu dieser.
    Laufzeit ca 3,5 Sekunden (ist jedoch etwas unfair optimiert :whistling: )

    Und dann hab ich noch Version 3 mit etwa 700ms Laufzeit, fällt jedoch aus bestimmtem Grunde aus dem Wettbewerb raus ;)


    Bei Version 1 verwende ich nicht MOD, sonderen etwas anderes ;)
    Dadurch ist sie um etwa 10 Sekunden schneller...

    mfg
    E

  • GUI mit Style $WS_Popup vergrößern?

    • eukalyptus
    • 8. März 2010 um 23:43

    Du solltest auch die benötigten Bilder dazugeben, dann kann man besser testen...

    Probier mal:

    [autoit]

    $Zettel = GUICreate("Test",100,100,50,50,$WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_MDICHILD),$MainGUI)

    [/autoit]


    und laß die Funktion _GUIinGUI ganz weg!

  • GUI mit Style $WS_Popup vergrößern?

    • eukalyptus
    • 7. März 2010 um 09:51

    Hier findest du, was du suchst: http://www.autoitscript.com/forum/index.php?showtopic=79863&view=findpost&p=575338

    mfgE

  • Another AutoIt PreProcessor

    • eukalyptus
    • 3. März 2010 um 19:43

    Ich schreibe eh grad an einer neuen Version!
    Sollte bald fertig werden...

    Bis dahin einfach die (fehlerhafte) Version aus dem ersten Post VERGESSEN! ;)

  • [Beendet] µitLight März

    • eukalyptus
    • 2. März 2010 um 18:50

    Ich hab mom. 2 verschiedene Algos im Test und die benötigen etwa 6 bzw. 8 Sekunden.
    die 3.3 Sekunden von Jonathan sind mir ein Rätsel, alleine eine For-Schleife von 0 bis 1299710 mit einer simplen If-Abfrage benötigt bei mir schon 2 Sekunden! 8|

    Da werd ich wohl noch probieren müssen!

  • eukalyptus hat Geburtstag

    • eukalyptus
    • 2. März 2010 um 17:29

    Danke, Danke! ^^

  • LED - Laufschrift

    • eukalyptus
    • 22. Februar 2010 um 14:06

    Hab mal versucht daraus eine UDF zu basteln.

    Ist allerdings noch ziemlich experimentell ;)
    Irgendwie sollte das auch noch einfacher zu handhaben werden, denn es sind doch sehr viele Parameter zum einstellen!

    folgende Parameter gibt es:

    Code
    $hGui: Handle zum Fenster
    $sText: Der Text
    $iX: X-Position der Laufschrift 
    $iY: Y-Position
    $iW: Länge
    $iH: Höhe
    $iType: Aussehen der LEDs 0=Rund mit 3D.Effekt, 1=Eckig mit 3D, 2=Rund, 3=Eckig; (die letzen beiden werden ausgefüllt und/oder umrandet, jenachdem welche Farben<>0 sind)
    $iLedW = X-Größe eines LEDs
    $iLedH = Y-Größe eines LEDs
    $nLedOnCol1 = Farbe 1 der ON-LEDs (Vordergrund bei 3D, Füllfarbe bei $iType 2 und 3)
    $nLedOnCol2 = Farbe 2 der ON-LEDs (Hintergrund bei 3D, Farbe der Umrandung bei $iType 2 und 3)
    $nLedOffCol1 = Farbe 1 der OFF-LEDs
    $nLedOffCol2 = Farbe 2 der OFF-LEDs
    $nBkColor = Hintergrundfarbe
    $iDistW = X-Abstand der LEDs
    $iDistH = Y-Abstand der LEDs
    $sFont = Schriftart
    $iTextSize = Schriftgröße
    $iTextOpt = Schrift Optionen (siehe _GDIPlus_FontCreate )
    $iTextOffY = Y-Offset der Schrift
    Alles anzeigen

    Die Geschwindigkeit mit der die Laufschrift erstellt wird konnte ich auch etwas erhöhen

    viel Vergnügen
    E

    Dateien

    LEDTXT-Example.au3 2,09 kB – 758 Downloads
  • Schlechte GDI+ Performance auf WinXP

    • eukalyptus
    • 22. Februar 2010 um 01:57

    Ich hab da was ganz seltsames entdeckt!

    Und zwar, wenn man vor _GDIPlus_GraphicsCreateFromHWND die Zeile

    [autoit]

    WinSetTrans($hWnd,"",255)

    [/autoit]

    einfügt, dann läuft das Script auch unter WinXP flüssig

    UEZ´s Script aus dem ersten Post:

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_Run_Obfuscator=y
    #Obfuscator_Parameters=/so
    #AutoIt3Wrapper_Res_SaveSource=n
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
    #AutoIt3Wrapper_Run_After=del /f /q "Explosions (from AutoIteroids)_Obfuscated.au3"
    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #include <Array.au3>

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

    Opt('MustDeclareVars', 1)
    Global $hGUI, $hWnd, $hGraphic, $width, $height
    $width = @DesktopWidth * 0.75
    $height = @DesktopHeight * 0.75
    Global Const $explosion_step = 6, $explosion_length = ($width + $height) / 8, $explosion_max_amount = 20, $explosion_max_particle = 20
    Global $explosion_coordinate[$explosion_max_particle][6 * $explosion_max_amount] ; on/off, x, y, vx, vy, v
    Global $explosion_amount = 0
    ; Create GUI
    $hGUI = GUICreate("Explosions (from AUTOITEROIDS) using GDI+ by UEZ 2009!", $width, $height)
    $hWnd = WinGetHandle($hGUI)
    WinSetTrans($hWnd,"",255)
    _GDIPlus_Startup()
    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
    Global $pen_size = 1
    Global $pen_color = 0xAFFF8070
    Global $pen = _GDIPlus_PenCreate($pen_color, $pen_size)
    GUISetState()

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

    Do
    _GDIPlus_GraphicsClear($backbuffer, 0x9A000000)
    If Mod(Random(1, 10, 1), 9) >= 5 Then ;
    Explosion_Init(Random(50, $width - 50, 1), Random(50, $height - 50, 1))
    EndIf
    Explosion()
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    Until Not Sleep(30) Or GUIGetMsg() = $GUI_EVENT_CLOSE

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

    ; Clean up resources
    _GDIPlus_PenDispose($pen)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()

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

    Func Explosion_Init($ex, $ey) ;initialise explosion
    For $o = 0 To $explosion_step * ($explosion_max_amount - 1) Step $explosion_step ;fill array with coordinate of hit object
    If $explosion_coordinate[0][$o] <> 1 Then
    $explosion_coordinate[0][$o] = 1
    $explosion_coordinate[0][$o + 1] = $ex ;save x coordinate
    $explosion_coordinate[0][$o + 2] = $ey ;save x coordinate
    For $n = 0 To $explosion_max_particle - 1
    $explosion_coordinate[$n][$o + 1] = $explosion_coordinate[0][$o + 1] ;duplicate x start position of all explosion particles
    $explosion_coordinate[$n][$o + 2] = $explosion_coordinate[0][$o + 2] ;duplicate y start position of all explosion particles
    $explosion_coordinate[$n][$o + 3] = _Random(-7, 7, 1) ;create random x vector (explosion particle speed)
    $explosion_coordinate[$n][$o + 4] = _Random(-7, 7, 1) ;create random y vector (explosion particle speed)
    $explosion_coordinate[$n][$o + 5] = Abs($explosion_coordinate[$n][3 + $o]) + Abs($explosion_coordinate[$n][4 + $o]) ;add absolute distance of vectors x and y
    Next
    ExitLoop
    EndIf
    Next
    EndFunc ;==>Explosion_Init

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

    Func Explosion() ;draw explosions coordinates
    Local $q, $k
    $explosion_amount = 0
    For $k = 0 To $explosion_step * ($explosion_max_amount - 1) Step $explosion_step
    If $explosion_coordinate[0][$k] = 1 Then ;only draw active explosions
    $explosion_amount += 1
    For $q = 0 To $explosion_max_particle - 1
    $explosion_coordinate[$q][$k + 1] += $explosion_coordinate[$q][$k + 3] ;draw new x coordinate of a particle
    $explosion_coordinate[$q][$k + 2] += $explosion_coordinate[$q][$k + 4] ;draw new y coordinate of a particle
    $explosion_coordinate[$q][$k + 5] += Abs($explosion_coordinate[$q][$k + 3]) + Abs($explosion_coordinate[$q][$k + 4])
    If $explosion_coordinate[$q][$k + 5] <= $explosion_length Then ;draw until max. distance has been reached
    _GDIPlus_GraphicsDrawEllipse($backbuffer, $explosion_coordinate[$q][$k + 1], $explosion_coordinate[$q][$k + 2], 2, 2, $pen)
    Else ;when max. distance has been reached then set x vector and y vector to 0
    $explosion_coordinate[0][$k] = 0
    EndIf
    Next
    EndIf
    Next
    ConsoleWrite($explosion_amount & @CRLF)
    EndFunc ;==>Explosion

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

    Func _Random($w1, $w2, $w3 = 0) ;just to avoid 0 as random number
    Local $x = 0, $l1 = 0.50
    While $x = 0
    $x = Random($w1, $w2, $w3)
    If $x < $l1 And $x >= 0 Then $x += $l1
    If $x > -$l1 And $x <= 0 Then $x -= $l1
    WEnd
    Return $x
    EndFunc ;==>_Random

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

    Drehende Dreiecke von H2112:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

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

    Opt("GUIOnEventMode", 1); Setzt das Script in den OnEventModus

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

    Global $hGraphic, $bitmap, $backbuffer, $Pen, $brush
    Global $rotation1 = 0, $rotation2 = 0, $rotation3 = 0, $rotation4 = 0, $rotation5 = 0
    Global $Pi = 3.14159

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

    $hwnd = GUICreate("GDI+ Beispiel: Drehende Dreiecke", 450, 450, -1, -1); Erstellt ein Fenster
    GUISetBkColor(0x000000); Setzt die Hintergrundfarbe der GUI auf schwarz
    GUISetOnEvent(-3, "_Close"); Die Funktion '_Close' wird ausgeführt, wenn das Fenster geschlossen wird
    GUISetState(@SW_SHOW, $hwnd); Macht das Fenster sichtbar
    WinSetTrans($hwnd,"",255)

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

    _GDIPlus_Startup(); Ladet die GDI+ dll
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd) ; Erstelle GDI+ Objekt von der GUI (Grafik)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(450, 450, $hGraphic) ; Erstelle Bitmap von der Grafik
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) ; Erstelle Grafik Kontext von der Bitmap (dient für die Doppeltbufferung der Grafik, damit die Bewegungen flüssiger aussehen
    $pen = _GDIPlus_PenCreate(0, 1) ; Erstelle Stift mit der Stärke 1 Pixels
    _GDIPlus_PenSetColor($Pen, 0xFF00FF00) ; Setze Stiftfarbe
    $brush = _GDIPlus_BrushCreateSolid(0x10000000); Erstellt ein vollfarbiges Pinselobjekt

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

    While 1
    _GDIPlus_GraphicsFillRect($backbuffer, 0, 0, 450, 450, $brush); Überzeichnet den Buffer mit einem transparentem schwarz
    ; Ab hier werden die Dreiecke im Buffer gezeichnet und berechnet
    $rotation1 += $Pi / 200
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation1 + $Pi / 2) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2) * 200 + 450 / 2, Cos($rotation1 + $Pi / 2 + (2 * $Pi) / 3) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2 + (2 * $Pi) / 3) * 200 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation1 + $Pi / 2 + (2 * $Pi) / 3) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2 + (2 * $Pi) / 3) * 200 + 450 / 2, Cos($rotation1 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 200 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation1 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 200 + 450 / 2, Cos($rotation1 + $Pi / 2) * 200 + 450 / 2, Sin($rotation1 + $Pi / 2) * 200 + 450 / 2, $pen)
    $rotation2 -= $Pi / 100
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation2 + $Pi / 2) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2) * 100 + 450 / 2, Cos($rotation2 + $Pi / 2 + (2 * $Pi) / 3) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2 + (2 * $Pi) / 3) * 100 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation2 + $Pi / 2 + (2 * $Pi) / 3) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2 + (2 * $Pi) / 3) * 100 + 450 / 2, Cos($rotation2 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 100 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation2 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 100 + 450 / 2, Cos($rotation2 + $Pi / 2) * 100 + 450 / 2, Sin($rotation2 + $Pi / 2) * 100 + 450 / 2, $pen)
    $rotation3 += $Pi / 50
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation3 + $Pi / 2) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2) * 50 + 450 / 2, Cos($rotation3 + $Pi / 2 + (2 * $Pi) / 3) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2 + (2 * $Pi) / 3) * 50 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation3 + $Pi / 2 + (2 * $Pi) / 3) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2 + (2 * $Pi) / 3) * 50 + 450 / 2, Cos($rotation3 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 50 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation3 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 50 + 450 / 2, Cos($rotation3 + $Pi / 2) * 50 + 450 / 2, Sin($rotation3 + $Pi / 2) * 50 + 450 / 2, $pen)
    $rotation4 -= $Pi / 25
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation4 + $Pi / 2) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2) * 25 + 450 / 2, Cos($rotation4 + $Pi / 2 + (2 * $Pi) / 3) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2 + (2 * $Pi) / 3) * 25 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation4 + $Pi / 2 + (2 * $Pi) / 3) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2 + (2 * $Pi) / 3) * 25 + 450 / 2, Cos($rotation4 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 25 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation4 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 25 + 450 / 2, Cos($rotation4 + $Pi / 2) * 25 + 450 / 2, Sin($rotation4 + $Pi / 2) * 25 + 450 / 2, $pen)
    $rotation5 += $Pi / 12.5
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation5 + $Pi / 2) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2) * 12.5 + 450 / 2, Cos($rotation5 + $Pi / 2 + (2 * $Pi) / 3) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2 + (2 * $Pi) / 3) * 12.5 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation5 + $Pi / 2 + (2 * $Pi) / 3) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2 + (2 * $Pi) / 3) * 12.5 + 450 / 2, Cos($rotation5 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 12.5 + 450 / 2, $pen)
    _GDIPlus_GraphicsDrawLine($backbuffer, Cos($rotation5 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2 + ((2 * $Pi) / 3) * 2) * 12.5 + 450 / 2, Cos($rotation5 + $Pi / 2) * 12.5 + 450 / 2, Sin($rotation5 + $Pi / 2) * 12.5 + 450 / 2, $pen)
    ; Ende der Zeichnungen und Berechnungen
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $bitmap, 0, 0, 450, 450) ; Das Zeichnen hat im Buffer stattgefunden. Damit das Ganze sichtbar wird, wird das Ganze in die Graphik kopiert
    Sleep(10)
    WEnd

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

    Func _Close()
    _GDIPlus_BrushDispose($brush); Löst das Pinselobjekt auf
    _GDIPlus_PenDispose($pen); Löst den Pinsel auf
    _GDIPlus_GraphicsDispose($backbuffer); Löst den Buffer auf
    _GDIPlus_BitmapDispose($bitmap); Löst die Bitmap auf
    _GDIPlus_GraphicsDispose($hGraphic); Löst die Graphic auf
    _GDIPlus_Shutdown(); Schließt die GDI+ dll
    WinClose($hwnd); Schließt das Fenster
    Exit; Beendet das Script
    EndFunc

    [/autoit]

    Zum Vergleich einfach WinSetTrans in Zeile 14 bzw. 13 auskommentieren

    Kann das jemand bestätigen?
    Das wäre dann ein richtig einfacher Workaround :thumbup:

    E

  • LED - Laufschrift

    • eukalyptus
    • 18. Februar 2010 um 06:34

    WHOW!
    Deshalb, mein Lieber, nennt man dich den Gdi+-Meister :thumbup:

    Daraus sollten wir eine UDF machen...

    wär´s evtl. besser am Anfang nur 2 LEDs (on/off) zu erstellen und dann via DrawImage einzuzeichnen?!

    E

  • Autoit stürtzt ab

    • eukalyptus
    • 17. Februar 2010 um 18:15

    Hi

    du darfst die GDI+ Funktionen erst nach _GdiPlus_StartUp aufrufen.
    also Zeile 22-27 hinter Zeile 129 verschieben...

    E

  • LED - Laufschrift

    • eukalyptus
    • 17. Februar 2010 um 14:03

    Danke für´s Feedback

    Schrift beginnt nun außerhalb des Fensters.

    Mit $iW kann man einstellen, wie lange die Schrift benötigt um erneut aufzutauchen
    z.b.:

    [autoit]

    _CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 1600...

    [/autoit]

    lgE

  • LED - Laufschrift

    • eukalyptus
    • 17. Februar 2010 um 12:12

    Hi

    Ich hab mich mal an einer LED Laufschrift versucht

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlusConstants.au3>
    #include <GUIConstantsEx.au3>
    Opt("GUIOnEventMode", 1)

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

    Global $iX = 0, $iW, $iStep = 8

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

    _GDIPlus_Startup()
    Global $hGui = GUICreate("LaufSchrift", 800, 200)
    GUISetBkColor(0x000000)
    GUISetOnEvent(-3, "_Exit")
    GUISetState()

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

    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Global $hBitmapBuffer = _GDIPlus_BitmapCreateFromGraphics(800, 200, $hGraphics)
    Global $hGraphicsBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmapBuffer)
    _GDIPlus_GraphicsClear($hGraphicsBuffer, 0xFF000000)
    Global $hBitmapLed = _CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 800, 200, $iStep, $iStep, 0xFFFFBB00, 0x66111122)
    ;Global $hBitmapLed = _CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 800, 200, $iStep, $iStep, 0xFF00FF00, 0x66000000)
    $iW = @extended

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

    GUIRegisterMsg($WM_PAINT, "_WM_PAINT")

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

    While 1
    $iX -= $iStep
    If $iX + $iW < 0 Then $iX += $iW
    _GDIPlus_GraphicsDrawImage($hGraphicsBuffer, $hBitmapLed, $iX, 0)
    _GDIPlus_GraphicsDrawImage($hGraphicsBuffer, $hBitmapLed, $iX + $iW, 0)
    _WinAPI_RedrawWindow($hGui, 0, 0, $RDW_INTERNALPAINT)
    Sleep(20)
    WEnd

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

    Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmapBuffer, 0, 0)
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_PAINT

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

    Func _CreateLedBitmap($hGraphics, $sText, $iW, $iH, $iLedOffSet, $iLedSize, $iOnColor = 0xFFFFBB00, $iOffColor = 0x88111122, $sFont = "Arial")
    $sText = StringUpper(StringReplace($sText,@LF,""))
    Local $hBrush = _GDIPlus_BrushCreateSolid($iOnColor)
    Local $hBrushOff = _GDIPlus_BrushCreateSolid($iOffColor)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
    Local $hFont = _GDIPlus_FontCreate($hFamily, $iH, 1, 2)
    Local $tLayout = _GDIPlus_RectFCreate($iW, 0, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sText, $hFont, $tLayout, $hFormat)
    Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width")) + $iW
    $iWidth -= Mod($iWidth, $iLedOffSet)
    Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
    DllStructSetData($aInfo[0], "Y", -Round(($iHeight - $iH) / 3))
    Local $hBitmapTxt = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Local $hBitmapLed = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Local $hGraphicsTxt = _GDIPlus_ImageGetGraphicsContext($hBitmapTxt)
    Local $hGraphicsLed = _GDIPlus_ImageGetGraphicsContext($hBitmapLed)
    _GDIPlus_GraphicsClear($hGraphicsTxt, $iOffColor)
    _GDIPlus_GraphicsDrawStringEx($hGraphicsTxt, $sText, $hFont, $aInfo[0], $hFormat, $hBrush)
    Local $BitmapData = _GDIPlus_BitmapLockBits($hBitmapTxt, 0, 0, $iWidth, $iHeight, $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    Local $Stride = DllStructGetData($BitmapData, "Stride")
    Local $Width = DllStructGetData($BitmapData, "Width")
    Local $Height = DllStructGetData($BitmapData, "Height")
    Local $Scan0 = DllStructGetData($BitmapData, "Scan0")
    Local $PixelData, $Color = Hex($iOnColor)
    For $row = 0 To $Height - 1 Step $iLedOffSet
    For $col = 0 To $Width - 1 Step $iLedOffSet
    $PixelData = DllStructCreate("dword", $Scan0 + ($row * $Stride) + ($col * 4))
    If Hex(DllStructGetData($PixelData, 1)) = $Color Then
    _GDIPlus_GraphicsFillEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hBrush)
    Else
    _GDIPlus_GraphicsFillEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hBrushOff)
    EndIf
    Next
    Next
    _GDIPlus_BitmapUnlockBits($hBitmapTxt, $BitmapData)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrushOff)
    _GDIPlus_BitmapDispose($hBitmapTxt)
    _GDIPlus_GraphicsDispose($hGraphicsTxt)
    _GDIPlus_GraphicsDispose($hGraphicsLed)
    Return SetExtended($iWidth, $hBitmapLed)
    EndFunc ;==>_CreateLedBitmap

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

    Func _Exit()
    _GDIPlus_BitmapDispose($hBitmapLed)
    _GDIPlus_GraphicsDispose($hGraphicsBuffer)
    _GDIPlus_BitmapDispose($hBitmapBuffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    viel Spaß!

    E

    Edit: Die Schrift beginnt jetzt außerhalb des Fensters
    Mit dem Alphakanal der OffColor kann man übrigens das Nachglühen einstellen 0x66111122
    Die OnColor muß den Alphawert 0xFF haben!

    Es gibt noch ein paar Bugs, wenn man die Größe des Fensters oder der Leds verändert
    das werd ich mir mal ansehen, wenn ich etwas mehr Zeit hab ;)

  • HAPPY BIRTHDAY @ UEZ

    • eukalyptus
    • 17. Februar 2010 um 11:42

    Hey,
    Alles Gute und viel Glück!

    lgE

  • Verständnisproblem WM_HSCROLL & lParam

    • eukalyptus
    • 13. Februar 2010 um 14:48

    Erstmal Danke für die Antwort!

    Ich will die Funktion nur ausführen, wenn tatsächlich auf die Scrollleiste geklickt wurde.
    In diesem Fall: If lParam <> 0 Then Return

    Damit der Slider nichts ungewollt auslöst ;)

    thx
    E

  • Verständnisproblem WM_HSCROLL & lParam

    • eukalyptus
    • 13. Februar 2010 um 08:15

    Hallo

    MSDN schreibt zu lParam bei WM_HSCROLL:

    Code
    If the message is sent by a scroll bar, then this parameter is the handle to the scroll bar control.
    If the message is not sent by a scroll bar, this parameter is NULL.

    bei folgendem Script ist das jedoch genau umgekehrt.
    Wenn man den Slider bewegt, enthält lParam den Handle des Sliders;
    Bewegt man die Scrollleiste ist lParam = 0

    Spoiler anzeigen
    [autoit]

    #include <GuiScrollBars.au3>
    #include <ScrollBarConstants.au3>
    #include <WindowsConstants.au3>

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

    $hGui = GUICreate("Test", 200, 100)
    $hSlider = GUICtrlCreateSlider(10, 10, 180, 30)
    _GUIScrollBars_Init($hGui)
    _GUIScrollBars_ShowScrollBar($hGui, $SB_VERT, False)
    GUISetState()

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

    GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL")

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

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

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

    Func _WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    ToolTip("lParam: " & $lParam & " / Slider: " & GUICtrlGetHandle($hSlider))
    EndFunc ;==>_WM_HSCROLL

    [/autoit]

    Was stimmt den nun?
    Ist die Info auf MSDN falsch, oder hab ich einen Denkfehler?!

    thx
    E

  • Alle Pixel eines Bildes in ein Array schreiben

    • eukalyptus
    • 12. Februar 2010 um 20:39

    Wesentlich schneller ist die LockBits-Methode:

    Spoiler anzeigen
    [autoit]

    #include <gdiplus.au3>
    #include <array.au3>
    _GDIPlus_Startup()

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

    Global $Pic = _GDIPlus_ImageLoadFromFile("C:\test.bmp")
    $array = _GetPixelsOfImage($Pic)
    _ArrayDisplay($array)

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

    Func _GetPixelsOfImage($hImage)
    Local $iWidth = _GDIPlus_ImageGetWidth($hImage), $iHeight = _GDIPlus_ImageGetHeight($hImage)
    Local $aPixel[$iWidth][$iHeight]
    _GetPixels($aPixel,$hImage,0,0,$iWidth,$iHeight)
    Return $aPixel
    EndFunc ;==>_GetPixelsOfImage

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

    Func _GetPixels(ByRef $aPixel, $hBitmap, $iX, $iY, $iW, $iH)
    Local $BitmapData = _GDIPlus_BitmapLockBits($hBitmap, $iX, $iY, $iW, $iH, $GDIP_ILMREAD, $GDIP_PXF32RGB)
    Local $Stride = DllStructGetData($BitmapData, "Stride")
    Local $Width = DllStructGetData($BitmapData, "Width")
    Local $Height = DllStructGetData($BitmapData, "Height")
    Local $Scan0 = DllStructGetData($BitmapData, "Scan0")
    Local $PixelData
    For $row = 0 To $Height - 1 ; Reihe für Reihe
    For $col = 0 To $Width - 1 ; Spalte für Spalte
    $PixelData = DllStructCreate("dword", $Scan0 + ($row * $Stride) + ($col * 4))
    $aPixel[$col][$row]=Hex(DllStructGetData($PixelData, 1))
    Next
    Next
    _GDIPlus_BitmapUnlockBits($hBitmap, $BitmapData)
    EndFunc ;==>_GreyScale

    [/autoit]

    Wobei es da eine noch schnellere Version gibt, bei der nicht jedesmal DllStructCreate aufgerufen wird,
    leider finde ich die grad nicht!

    lgE


    Edit:
    dies hab ich gemeint, ist jedoch langsamer
    Damit kann man aber besser die einzelnen Farben auslesen

    [autoit]

    Local $PixelData = DllStructCreate("ubyte lData[" & (Abs($Stride) * $Height - 1) & "]", $Scan0)
    For $row = 0 To $Height - 1 ; Reihe für Reihe
    For $col = 0 To $Width - 1 ; Spalte für Spalte
    $aPixel[$col][$row] = Hex(BitShift(DllStructGetData($PixelData, 1, ($row * $Stride) + ($col * 4)), -24) + BitShift(DllStructGetData($PixelData, 1, ($row * $Stride) + ($col * 4) + 3), -16) + BitShift(DllStructGetData($PixelData, 1, ($row * $Stride) + ($col * 4) + 2), -8) + DllStructGetData($PixelData, 1, $row * $Stride + ($col * 4) + 1))
    Next
    Next

    [/autoit]

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™