Sau geil!
Gruß,
UEZ
Sau geil!
Gruß,
UEZ
Versuche doch mal beide Dateien (SciTE.session und SciTEUser.properties in %USERPROFILE%) umzubennen! SciTE sollte nicht laufen!
Es gibt auch eine SciTEGlobal.properties im SciTE Verzeichnis selbst, die vielleicht auch mal umbenennen, wenn der Versuch oben nicht funzt!
Gruß,
UEZ
Werde ich mal heute Abend auf meiner Kiste testen, wobei bei mir das allerdings schon einigermaßen sauber läuft (ab und zu flackert's mal kurz)! In der VM gab es so wie so keine Probleme!
Gruß,
UEZ
Ein "Always on Top", Drag'n'Drop und farbige Zeilen wären außerdem noch nett!
Ansonsten kann ich keine Fehler finden!
Gruß,
UEZ
Probiere es mal mit $Body = GUICtrlRead($Input1) & GUICtrlRead($Input2)
Ansonsten hast du noch Fehler im Code!
Gruß,
UEZ
Hallo UEZ,
in deiner neuen Version habe ich ein Flackern der Titelleiste, auch die Initialisierung am Anfang erscheint mir etwas zu lange,
mfg (Auto)Bert
Geht mir auch so, habe Win7 X86p.s. Ich muss natührlich meinen Senf dazugeben, das wenn man ein ¿ darstellt, das zuweit unten ist
Geht mir auch so, habe Win7 X86p.s. Ich muss natührlich meinen Senf dazugeben, das wenn man ein ¿ darstellt, das zuweit unten ist
Ich kann unter Vista x32 kein flackern erkennen, aber kommentiert doch mal die Zeilen WinSetTitle() (54 & 111) aus! Dadurch wird kein FPS mehr und beim Erstellen der LED Bitmap wird der Status nicht mehr angezeigt (sollte schneller sein)!
Ihr könnt ja die Fenster- bzw. LED Größe manuell anpassen, so dass auch "komische" Zeichen besser dargestellt werden!
Sehr geil das ganze. Danke Eukalyptus und UEZ
Der Danke sollte an Eukalyptus gehen! Mein Beitrag dazu ist eher nebensächlich und eher von kosmetischer Natur
![]()
Gruß,
UEZ
Avi ist ein Video Container! Du musst den Audiostream demuxen und dann evt. umwandeln. Vielleicht kannst du mit AutoIt die Tools steuern, aber mit AutoIt den Audio Stream demuxen ist noch nicht implementiert!
Gruß,
UEZ
Ich habe mal eine andere Backbuffer Technik benutzt, um GDI+ zu beschleunigen und die korrigierten GDI+ Funktion von progandy noch hinzugefügt!
Guckst du Post#14 ![]()
Gruß,
UEZ
Sieht schön aus, jedoch weiss ich nicht ganz, was CSV is
Aber ich entnehme aus dem Post von UEZ das es sich um Excel dateien handelt.
Finds also dementsprechend recht gut gelungen, jedoch nicht wirklich
geeignet für normale text dateien.
MfG. PrideRage
CSV = Comma-separated values
Gruß,
UEZ
Nette Idee, um mal schnell CSV Dateien angezeigt zu bekommen, ohne gleich mit der Excel Keule zuzuschlagen!
Ideen:
Gruß,
UEZ
Coole Sache OOP mit AutoIt! Jetzt muss ich mir nur noch OOP reinziehen und verstehen!
Mal sehen, ob man damit auch GDI+ mit Klassen verwenden kann! Aber bis dahin ist noch ein langer weg für mich...
Danke für die OOP Implementierung
![]()
Warum wurde eine DLL hinzugefügt? Ursprünglich war dich keine dabei oder?
Gruß,
UEZ
Jetzt wo du es sagt, es sind genau die selben Bilder bei deinen sowohl meins als auch deins nicht geht, bzw. Fehler enthalten, sehr komisch.
Der Work-Around ist _GDIPlus_GraphicsDrawImageRect() anstelle von _GDIPlus_GraphicsDrawImage() zu benutzen! Ich weiß nicht, warum einige Bilder mit _GDIPlus_GraphicsDrawImage() gestreckt angezeigt werden! ![]()
Gruß,
UEZ
Versuch es mal ohne, aber dafür mit den korrekten DllCall-Typen:
Danke progandy! Hatte die Funktionen nicht auf korrekte DLLCalls geprüft ![]()
Läuft jetzt auch unter Win7 x64 "sauber"!
Gruß,
UEZ
Hat schon was lustiges inzwischen. Wieder eine modifizierte Sache von dir, die bei mir unter Win 7 nicht geht XD.
Wenn du Win7 x64 benutzt, dann vorher mit der Option #AutoIt3Wrapper_UseX64=n kompilieren und die Exe starten. Jetzt sollte es funzen, oder?
Gruß,
UEZ
Doch durch die Modifikationen geht es, aber das verschieben und der Rand (gibt Spuren) ist immernoch da
![]()
Trotzdem Danke.
Was meinst du mit "das verschieben und der Rand (gibt Spuren) ist immernoch da"? An den Window Moves habe ich nichts geändert, sondern nur ein wenig an der GUI...
UEZ
Ist gut geworden!
Hier ein paar kleine Modifikationen:
#notrayicon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Date.au3>
#include <Misc.au3>
global $fx=@DesktopWidth-225 ;-100
global $fy=@DesktopHeight-160 ;-35
$tmp=iniread("Uhr.ini","coords","x","x")
if $tmp<>"x" Then $fx=int($tmp)
$tmp=iniread("Uhr.ini","coords","y","y")
if $tmp<>"y" Then $fy=int($tmp)
global $title="Uhr"
_GDIPlus_Startup()
global $uhr=_GDIPlus_BitmapCreateFromFile(@ScriptDir&"\Uhr.png")
global $iX = _GDIPlus_ImageGetWidth($uhr)
global $iY = _GDIPlus_ImageGetHeight($uhr)
global $iX_2 = $iX / 2
Global $iY_2 = $iY / 2
global $zeiger_l1 = 62
global $zeiger_l2 = 52
global $zeiger_l3 = 32
#Region ### START Koda GUI section ### Form=d:\progen\autoit\meine\forms\analog.kxf
$Form1 = GUICreate($title, $iX, $iY, $fx, $fy, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED))
$Label1 = GUICtrlCreateLabel("",0,0)
_WinAPI_SetLayeredWindowAttributes($Form1, 0xE0DFE3)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
winsetontop($title,"",1)
global $pen=_GDIPlus_PenCreate(0xFFFF0000,2)
global $pen2=_GDIPlus_PenCreate(0xFF0000FF,2)
global $pen3=_GDIPlus_PenCreate(0xFF0000BB,2)
global $gra=_GDIPlus_GraphicsCreateFromHWND($Form1)
global $buffer=_GDIPlus_BitmapCreateFromGraphics($iX,$iY,$gra)
global $backgra=_GDIPlus_ImageGetGraphicsContext($buffer)
_GDIPlus_GraphicsSetSmoothingMode($backgra, 2)
global const $pi_div_180 = 4 * ATan(1) / 180
Opt("GUIOnEventMode", 1)
GUIRegisterMsg(0x000F, "Redraw_GUI")
GUISetOnEvent($GUI_EVENT_CLOSE,"ende")
adlibregister("x",100)
While not _IsPressed("1B")
if _IsPressed("1") Then
$pos=mousegetpos()
$winpos=WinGetPos($title)
if $winpos[0]+100<=$pos[0] and $winpos[0]+225>=$pos[0] and $winpos[1]+35<=$pos[1] and $winpos[1]+160>=$pos[1] Then
$xplus=$pos[0]-$winpos[0]-100
$yplus=$pos[1]-$winpos[1]-35
while _IsPressed("1")
$pos=MouseGetPos()
winmove($title,"",$pos[0]-100-$xplus,$pos[1]-35-$yplus)
$fx=$pos[0]-100-$xplus
$fy=$pos[1]-35-$yplus
if $fx<-100 then
winmove($title,"",-100,$fy)
$fx=-100
endif
if $fy<-35 then
winmove($title,"",$fx,-35)
$fy=-35
endif
if $fx>@DesktopWidth-225 then
winmove($title,"",@DesktopWidth-225,$fy)
$fx=@DesktopWidth-225
endif
if $fy>@DesktopHeight-160 then
winmove($title,"",$fx,@DesktopHeight-160)
$fy=@DesktopHeight-160
endif
sleep(50)
WEnd
EndIf
EndIf
sleep(50)
WEnd
ende()
Func ende()
iniwrite("Uhr.ini","coords","x",$fx)
iniwrite("Uhr.ini","coords","y",$fy)
winsetontop($title,"",0)
adlibunregister("x")
_GDIPlus_PenDispose($pen)
_GDIPlus_PenDispose($pen2)
_GDIPlus_PenDispose($pen3)
_GDIPlus_GraphicsDispose($gra)
_GDIPlus_BitmapDispose($uhr)
_GDIPlus_BitmapDispose($buffer)
_GDIPlus_Shutdown()
Exit
EndFunc
func Redraw_GUI($hWnd, $msg, $wParam, $lParam)
_WinAPI_RedrawWindow($hWnd, "", "", $RDW_UPDATENOW + $RDW_FRAME)
;~ _GDIPlus_GraphicsClear($backgra,0x00000000)
_GDIPlus_GraphicsDrawImage($backgra,$uhr,0,0)
$winkel=int(stringmid(_NowTime(),7,2))+30
_GDIPlus_GraphicsDrawLine($backgra,$iX_2,$iY_2,$iX_2 + $zeiger_l1 * Sin($winkel * -6 * $Pi_Div_180),$iY_2 + $zeiger_l1 * Cos($winkel * -6 * $Pi_Div_180), $pen)
$winkel=int(stringmid(_NowTime(),4,2))+30
_GDIPlus_GraphicsDrawLine($backgra,$iX_2,$iY_2,$iX_2 + $zeiger_l2 * Sin($winkel * -6 * $Pi_Div_180),$iY_2 + $zeiger_l2 * Cos($winkel * -6 * $Pi_Div_180), $pen2)
$winkel=(int(stringmid(_NowTime(),1,2))+6)*5
_GDIPlus_GraphicsDrawLine($backgra,$iX_2,$iY_2,$iX_2 + $zeiger_l3 * Sin($winkel * -6 * $Pi_Div_180),$iY_2 + $zeiger_l3 * Cos($winkel * -6 * $Pi_Div_180), $pen3)
_GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$iX,$iY)
EndFunc
func x()
GUICtrlSetData($Label1,"")
endfunc
Gruß,
UEZ
Ich habe mal versucht den LEDs mehr Volumen zu geben!
Hier das Resultat:
Neue Backbuffer Technik:
;http://www.autoit.de/index.php?page=Thread&threadID=17855
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Local $fps = 0, $fps_diff, $fps_maintimer, $fps_timer, $display_FPS = -1, $average_FPS, $i = 1
Local $w = 1024
Local $h = 384
Local $iX = 0, $iW, $iStep = 24
_GDIPlus_Startup()
Local $hGui = GUICreate("LED Laufschrift", $w, $h)
GUISetBkColor(0x000000)
GUISetOnEvent(-3, "_Exit")
GUISetState()
;~ Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
;~ Local $hBitmapBuffer = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
;~ Local $hGraphicsBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmapBuffer)
Local $hDC = _WinAPI_GetWindowDC($hGUI)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)
Local $hBMP = _WinAPI_CreateBitmap($w, $h) ;create a dummy bitmap
Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
Local $hScrDC = _WinAPI_GetDC(0)
Local $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hScrDC)
Local $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap)
Local $hGraphicsBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
_GDIPlus_GraphicsClear($hGraphics, 0xFF000000)
Local $hBitmapLed = _CreateLedBitmap($hGraphics, "LED Laufschrift mit GDI+ erstellt von Eukalyptus
", $w, $h, $iStep, $iStep, 0xFFFFF030, 0x90101000)
;Local $hBitmapLed = _CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 800, 200, $iStep, $iStep, 0xFF00FF00, 0x66000000)
$iW = @extended
;~ GUIRegisterMsg($WM_PAINT, "_WM_PAINT")
$fps_maintimer = TimerInit()
While 1
$fps_timer = TimerInit()
$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)
;~ _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
_WinAPI_BitBlt($hDC, 3, 23, $w, $h, $hDC_backbuffer, 0, 0, 0x00CC0020)
$fps_diff = TimerDiff($fps_timer)
If TimerDiff($fps_maintimer) >= 1000 Then ;calculate FPS
$fps = Round(1000 / $fps_diff, 2)
WinSetTitle($hGui, "", "LED Laufschrift: " & $fps & " FPS (ø " & Round($average_FPS / $i, 2) & " FPS)")
$fps_maintimer = TimerInit()
EndIf
$average_FPS += $fps
$i += 1
Sleep(50)
WEnd
;~ Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
;~ _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
;~ Return $GUI_RUNDEFMSG
;~ EndFunc ;==>_WM_PAINT
Func _CreateLedBitmap($hGraphics, $sText, $iW, $iH, $iLedOffSet, $iLedSize, $iOnColor = 0xF0FFFF00, $iOffColor = 0x88111122, $sFont = "Arial")
$sText = StringUpper(StringReplace($sText,@LF,""))
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)
Local $hBrush = _GDIPlus_BrushCreateSolid($iOnColor)
Local $hPen = _GDIPlus_PenCreate()
_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)
Local $hBrushGrad, $hPath
Local $progress = ($Height * $Width - 2) / ($iLedOffSet ^ 2), $c = 1
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
$hPath = _GDIPlus_CreatePath()
_GDIPlus_AddPathEllipse($hPath, $col, $row, $iLedSize, $iLedSize)
$hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath)
_GDIPlus_SetLineGammaCorrection($hBrushGrad, True)
_GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, $iOffColor)
_GDIPlus_SetPathGradientCenterColor($hBrushGrad, $iOnColor)
_GDIPlus_FillPath($hGraphicsLed, $hBrushGrad, $hPath)
_GDIPlus_ClosePathFigure($hPath)
_GDIPlus_GraphicsDrawEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hPen)
Else
_GDIPlus_GraphicsFillEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hBrushOff)
EndIf
WinSetTitle($hGui, "", "LED Laufschrift: " & Int($c / $progress * 100) & " %")
$c += 1
Next
Next
_GDIPlus_BitmapUnlockBits($hBitmapTxt, $BitmapData)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrushGrad)
_GDIPlus_PathDispose($hPath)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BrushDispose($hBrushOff)
_GDIPlus_BitmapDispose($hBitmapTxt)
_GDIPlus_GraphicsDispose($hGraphicsTxt)
_GDIPlus_GraphicsDispose($hGraphicsLed)
Return SetExtended($iWidth, $hBitmapLed)
EndFunc ;==>_CreateLedBitmap
Func _Exit()
_WinAPI_ReleaseDC($hGUI, $hDC)
_WinAPI_DeleteObject($hBMP)
_GDIPlus_BitmapDispose($hImage)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_DeleteDC($hDC_backbuffer)
_GDIPlus_GraphicsDispose($hGraphicsBuffer)
_GDIPlus_BitmapDispose($hBitmapLed)
;~ _GDIPlus_GraphicsDispose($hGraphicsBuffer)
;~ _GDIPlus_BitmapDispose($hBitmapBuffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Func _GDIPlus_CreatePath($brushMode=0)
Local $hPath
$hPath = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $brushMode, "handle*", 0)
If @error Then Return SetError(1,@error,0)
Return SetError($hPath[0], 0, $hPath[2])
EndFunc
Func _GDIPlus_AddPathEllipse($hPath, $iX, $iY, $iWidth, $iHeight)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", $iX, "float", $iY, "float", $iWidth, "float", $iHeight)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Func _GDIPlus_CreatePathGradientFromPath($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "int*", 0)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[2])
EndFunc
Func _GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "handle", $hBrush, "int", $useGammaCorrection)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Func _GDIPlus_SetPathGradientCenterColor($hBrush, $iARGB)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hBrush, "int", $iARGB)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hGraphic, "handle", $hBrushGrad, "handle", $hPath)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Func _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrush, $aArgb)
Local $iI, $iCount, $aResult, $res, $x, $pArgb
If IsArray($aArgb) Then
$iCount = UBound($aArgb)
$tArgb = DllStructCreate("int[" & $iCount & "]")
$pArgb = DllStructGetPtr($tArgb)
For $iI = 0 To $iCount - 1
DllStructSetData($tArgb, 1, $aArgb[$iI], $iI + 1)
Next
Else
$iCount = 1
$tArgb = DllStructCreate("int")
$pArgb = DllStructGetPtr($tArgb)
DllStructSetData($tArgb, 1, $aArgb, 1)
EndIf
$aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hBrush, "int", $pArgb, "int*", $iCount)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], $aResult[3], $aResult[0]=0)
EndFunc
Func _GDIPlus_ClosePathFigure($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "handle", $hPath)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0], 0, $aResult[0]=0)
EndFunc
Alte:
;http://www.autoit.de/index.php?page=Thread&threadID=17855
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Local $fps = 0, $fps_diff, $fps_maintimer, $fps_timer, $display_FPS = -1, $average_FPS, $i = 1
Local $w = 1024
Local $h = 384
Local $iX = 0, $iW, $iStep = 24
_GDIPlus_Startup()
Local $hGui = GUICreate("LED Laufschrift", $w, $h)
GUISetBkColor(0x000000)
GUISetOnEvent(-3, "_Exit")
GUISetState()
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Local $hBitmapBuffer = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
Local $hGraphicsBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmapBuffer)
_GDIPlus_GraphicsClear($hGraphics, 0xFF000000)
Local $hBitmapLed = _CreateLedBitmap($hGraphics, "LED Laufschrift mit GDI+ erstellt von Eukalyptus
", $w, $h, $iStep, $iStep, 0xFFFFF030, 0x88101000)
;Local $hBitmapLed = _CreateLedBitmap($hGraphics, "Dies ist eine Laufschrift!", 800, 200, $iStep, $iStep, 0xFF00FF00, 0x66000000)
$iW = @extended
;~ GUIRegisterMsg($WM_PAINT, "_WM_PAINT")
$fps_maintimer = TimerInit()
While 1
$fps_timer = TimerInit()
$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)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
$fps_diff = TimerDiff($fps_timer)
If TimerDiff($fps_maintimer) >= 1000 Then ;calculate FPS
$fps = Round(1000 / $fps_diff, 2)
WinSetTitle($hGui, "", "LED Laufschrift: " & $fps & " FPS (ø " & Round($average_FPS / $i, 2) & " FPS)")
$fps_maintimer = TimerInit()
EndIf
$average_FPS += $fps
$i += 1
Sleep(50)
WEnd
;~ Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
;~ _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
;~ Return $GUI_RUNDEFMSG
;~ EndFunc ;==>_WM_PAINT
Func _CreateLedBitmap($hGraphics, $sText, $iW, $iH, $iLedOffSet, $iLedSize, $iOnColor = 0xF0FFFF00, $iOffColor = 0x88111122, $sFont = "Arial")
$sText = StringUpper(StringReplace($sText, @LF, ""))
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)
Local $hBrush = _GDIPlus_BrushCreateSolid($iOnColor)
Local $hPen = _GDIPlus_PenCreate()
_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)
Local $hBrushGrad, $hPath
Local $progress = ($Height * $Width - 2) / ($iLedOffSet ^ 2), $c = 1
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
$hPath = _GDIPlus_CreatePath()
_GDIPlus_AddPathEllipse($hPath, $col, $row, $iLedSize, $iLedSize)
$hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath)
_GDIPlus_SetLineGammaCorrection($hBrushGrad, True)
_GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, $iOffColor)
_GDIPlus_SetPathGradientCenterColor($hBrushGrad, $iOnColor)
_GDIPlus_FillPath($hGraphicsLed, $hBrushGrad, $hPath)
_GDIPlus_ClosePathFigure($hPath)
_GDIPlus_GraphicsDrawEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hPen)
Else
_GDIPlus_GraphicsFillEllipse($hGraphicsLed, $col, $row, $iLedSize, $iLedSize, $hBrushOff)
EndIf
WinSetTitle($hGui, "", "LED Laufschrift: " & Int($c / $progress * 100) & " %")
$c += 1
Next
Next
_GDIPlus_BitmapUnlockBits($hBitmapTxt, $BitmapData)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrushGrad)
_GDIPlus_PathDispose($hPath)
_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
Func _GDIPlus_CreatePath($brushMode = 0)
Local $hPath
$hPath = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $brushMode, "handle*", 0)
If @error Then Return SetError(1, @error, 0)
Return SetError($hPath[0], 0, $hPath[2])
EndFunc ;==>_GDIPlus_CreatePath
Func _GDIPlus_AddPathEllipse($hPath, $iX, $iY, $iWidth, $iHeight)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", $iX, "float", $iY, "float", $iWidth, "float", $iHeight)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_AddPathEllipse
Func _GDIPlus_CreatePathGradientFromPath($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "int*", 0)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[2])
EndFunc ;==>_GDIPlus_CreatePathGradientFromPath
Func _GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "handle", $hBrush, "int", $useGammaCorrection)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_SetLineGammaCorrection
Func _GDIPlus_SetPathGradientCenterColor($hBrush, $iARGB)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hBrush, "int", $iARGB)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_SetPathGradientCenterColor
Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hGraphic, "handle", $hBrushGrad, "handle", $hPath)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_FillPath
Func _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrush, $aArgb)
Local $iI, $iCount, $aResult, $res, $x, $pArgb
If IsArray($aArgb) Then
$iCount = UBound($aArgb)
$tArgb = DllStructCreate("int[" & $iCount & "]")
$pArgb = DllStructGetPtr($tArgb)
For $iI = 0 To $iCount - 1
DllStructSetData($tArgb, 1, $aArgb[$iI], $iI + 1)
Next
Else
$iCount = 1
$tArgb = DllStructCreate("int")
$pArgb = DllStructGetPtr($tArgb)
DllStructSetData($tArgb, 1, $aArgb, 1)
EndIf
$aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hBrush, "int", $pArgb, "int*", $iCount)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], $aResult[3], $aResult[0] = 0)
EndFunc ;==>_GDIPlus_SetPathGradientSurroundColorsWithCount
Func _GDIPlus_ClosePathFigure($hPath)
Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_ClosePathFigure
Func _GDIPlus_PathDispose($hPath)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "handle", $hPath)
If @error Then Return SetError(1, @error, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_PathDispose
Gruß,
UEZ
So, nun bin ich von der PowerShell Schulung zurück!
Ich möchte mich bei allen Gratulanten bedanken und auch den jenigen gratulieren, die außer mir auch noch heute Geburtstag haben!
Uns allen zusammen wünsche ich Gesundheit und eine schöne Zeit mit AutoIt!
@tince: wie hast du mein Bild gefunden? Google hat ja einige Daten von mir, aber ein Bild? ![]()
VIELEN DANK!
Gruß,
UEZ
PS: midlife crisis rückt näher...
Sieht gut aus! Weiter so!
Jeder darf meine Codes benutzen, wie er/sie will ![]()
Gruß,
UEZ
Sehr schönes Skript! ![]()
Zum Löschen des Startbildschirms: _GDIPlus_GraphicsClear($hGraphics, 0xFF000000) in Zeile 19 ersetzen!
Ich habe mich auch _GDIPlus_BitmapLockBits() und _GDIPlus_BitmapUnlockBits() beschäfftigt, bin aber momentan noch nicht ganz dahinter gestiegen, wozu man die Funktion benutzen kann...
Gruß,
UEZ
PS: Eukalyptus ist ein GDI+ Meister! ![]()