Hier findest du, was du suchst: http://www.autoitscript.com/forum/index.php?showtopic=79863&view=findpost&p=575338
mfgE
Hier findest du, was du suchst: http://www.autoitscript.com/forum/index.php?showtopic=79863&view=findpost&p=575338
mfgE
Ich schreibe eh grad an einer neuen Version!
Sollte bald fertig werden...
Bis dahin einfach die (fehlerhafte) Version aus dem ersten Post VERGESSEN!
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!
Da werd ich wohl noch probieren müssen!
Danke, Danke!
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:
$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
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:
#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>
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()
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
; Clean up resources
_GDIPlus_PenDispose($pen)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_Shutdown()
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
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
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
Drehende Dreiecke von H2112:
#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
$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)
_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
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
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
Zum Vergleich einfach WinSetTrans in Zeile 14 bzw. 13 auskommentieren
Kann das jemand bestätigen?
Das wäre dann ein richtig einfacher Workaround
E
WHOW!
Deshalb, mein Lieber, nennt man dich den Gdi+-Meister
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
Hi
du darfst die GDI+ Funktionen erst nach _GdiPlus_StartUp aufrufen.
also Zeile 22-27 hinter Zeile 129 verschieben...
E
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.:
_CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 1600...
[/autoit]lgE
Hi
Ich hab mich mal an einer LED Laufschrift versucht
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $iX = 0, $iW, $iStep = 8
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
Global $hGui = GUICreate("LaufSchrift", 800, 200)
GUISetBkColor(0x000000)
GUISetOnEvent(-3, "_Exit")
GUISetState()
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
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
Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmapBuffer, 0, 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_PAINT
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
Func _Exit()
_GDIPlus_BitmapDispose($hBitmapLed)
_GDIPlus_GraphicsDispose($hGraphicsBuffer)
_GDIPlus_BitmapDispose($hBitmapBuffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
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
Hey,
Alles Gute und viel Glück!
lgE
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
Hallo
MSDN schreibt zu lParam bei WM_HSCROLL:
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
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
$hGui = GUICreate("Test", 200, 100)
$hSlider = GUICtrlCreateSlider(10, 10, 180, 30)
_GUIScrollBars_Init($hGui)
_GUIScrollBars_ShowScrollBar($hGui, $SB_VERT, False)
GUISetState()
GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL")
[/autoit] [autoit][/autoit] [autoit]While GUIGetMsg() <> -3
Sleep(10)
WEnd
Func _WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
ToolTip("lParam: " & $lParam & " / Slider: " & GUICtrlGetHandle($hSlider))
EndFunc ;==>_WM_HSCROLL
Was stimmt den nun?
Ist die Info auf MSDN falsch, oder hab ich einen Denkfehler?!
thx
E
Wesentlich schneller ist die LockBits-Methode:
#include <gdiplus.au3>
#include <array.au3>
_GDIPlus_Startup()
Global $Pic = _GDIPlus_ImageLoadFromFile("C:\test.bmp")
$array = _GetPixelsOfImage($Pic)
_ArrayDisplay($array)
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
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
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
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
Kann es sein, daß du Javascript deaktiviert hast?
Ja, und zwar alle Funktionen (wie auch Variablen), die als "stringcall" vorkommen wie zb.:
[autoit]GUICtrlSetOnEvent(-1, "Check_Status")
[/autoit]Das werd ich aber irgendwann mal einbauen...
thxE
Edit:
Das hatte ich schon eingebaut, jedoch vorerst wieder rausgenommen, weil das dann schon zu kompliziert wurde.
Ich habe mich zu sehr auf die Erkennung "nicht eindeutiger" Funktionsaufrufe konzentriert, z.B.:
GUICtrlSetOnEvent(-1 $sPre & "Function")
;Oder
GUICtrlSetOnEvent(-1 "Function" & $sPost)
obwohl sowas eher ganz selten vorkommt...
btw.: gibt es noch weitere Möglichkeiten um Funtionen und Variablen als String aufzurufen, als diese hier?:
GUISetOnEvent,GUICtrlSetOnEvent,GUIRegisterMsg,HotKeySet,Execute,Eval,Assign,IsDeclared,Call,TraySetOnEvent,
TrayItemSetOnEvent,DllCallbackRegister,AdlibRegister,AdlibUnRegister,GUICtrlRegisterListViewSort,OnAutoItExitRegister,
OnAutoItExitUnRegister,_FTP_ProgressDownload,_FTP_ProgressUpload,_FTP_SetStatusCallback,_SQLite_Exec,ObjEvent
thx
UEZ: Jo, das war ein Bug
Der Funktionsname Turn wurde mit einem Leerzeichen in das Scripting.Dictionary eingetragen...
geänderte Version im ersten Post
@progandy: geteilte Zeilen werden immer zusammengefügt, ist das schlecht?
mit Strings zusammenfügen meine ich sowas:
"String1" & "String2"
[/autoit]
sowas kommt häufig bei Konstanten in Includes vor:
Global Const $tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"
Global Const $tagNMCBEDRAGBEGIN = $tagNMHDR & ";int ItemID;ptr szText"
$tagNMHDR wird durch seinen Wert ersetzt und schon hab ich einen geteilten String
@nof@ker2: kannst du mir das entsprechende Script bitte zukommen lassen bzw. es reicht ein kurzes Testscript, bei dem der selbe Fehler auftritt...
Edit: Probier doch bitte die geänderte Version aus dem ersten Post nochmal
---
btw.: Die Variable $CmdLine darf natürlich nicht umbenannt werden!
gibt es noch weitere solche Variablen, die von Autoit reserviert sind?
lgE
Ich habe mich mal an einer Art Preprocessor für Autoit versucht.
Neue Version
Diese Version läuft etwas langsamer als die alte, dafür ist die Statusanzeige vielfach schneller (GDI+ statt RichEdit)
Zusätzlich wird auch noch ein LogFile erstellt.
Aufruf via CMD-Line und Run_Before ist auch möglich.
#AutoIt3Wrapper_Run_Before=""%autoitdir%\aapp.exe" "%in%""
(es wird auch ein Backup erstellt)
Der PreProcessor
.) fügt alle Includes ein
.) entfernt alle überflüssigen Funktionen
.) ersetzt Global Const durch ihren Wert
.) entfernt überflüssige Global Const
.) benennt Funktionen und Variablen in ganz kurze Namen um
.) berechnet einfache mathematische Ausdrücke
.) kombiniert & _ geteilte Zeilen (außer die Zeilenlänge würde 4095 Zeichen übersteigen)
.) kombiniert & geteilte Strings
.) optimiert IF und CASE
.) wandelt Zahlen in Hex um
Einige Probleme hatte ich mit den Stringcalls, also Funktionen bzw. Variablen die via String aufgerufen werden.
Wenn ein String erwartet wird, jedoch nur eine Variable gefunden wird:
$Str='_Func'
Call($Str)
dann wird in diesem Fall keine Funktion entfernt oder umbenannt, denn $Str könnte den Namen jeder Funktion enthalten!
oft verwendet man Execute nur um 2 Strings zusammenzufügen oder sonst was, jedoch nicht um eine Funktion oder Variable aufzurufen.
deshalb gibt es die Funktion Execute is used to call functions/variables
z.B.: bei Unicalc Grafik von Ludwig kann man diese Optionen deaktivieren, da sonst keine Funktionen entfernt bzw. umbenannt werden würden...
jedoch beim Hilfebeispiel _FTP_SetStatusCallback muß man diese Optionen aktiviert lassen, ansonsten ist das fertige Script nicht lauffähig
---
Kann mir jemand helfen die englischen Sätze richtig und gut zu formulieren?!
mein Englisch ist leider sehr bescheiden
thx
lgE
Das sollte so in etwa gehen:
[autoit]$fftstruct = DllStructCreate("float[128]")
_BASS_ChannelGetData($hMusicHandle, DllStructGetPtr($fftstruct), $BASS_DATA_FFT256)
For $i = 0 To 127
$fft = Round(DllStructGetData($fftstruct, 1, $i + 1) * 100)
Next
Nicht getestet!
Hi
bei meinem Audio-Recorder hab ich sowas eingebaut:
http://www.autoitscript.com/forum/index.php?showtopic=86639&view=findpost&p=621195
du mußt halt nur dir grafische Darstellung etwas "optimieren"