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

  • GDI+ Image Rotator and Saver

    • UEZ
    • 19. Februar 2010 um 21:51
    Zitat von Greek

    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

  • LED - Laufschrift

    • UEZ
    • 19. Februar 2010 um 19:59
    Zitat von progandy


    Versuch es mal ohne, aber dafür mit den korrekten DllCall-Typen:

    Danke progandy! Hatte die Funktionen nicht auf korrekte DLLCalls geprüft :whistling:

    Läuft jetzt auch unter Win7 x64 "sauber"!

    Gruß,
    UEZ

  • LED - Laufschrift

    • UEZ
    • 19. Februar 2010 um 15:39
    Zitat von chip

    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

  • Zeigeruhr

    • UEZ
    • 19. Februar 2010 um 15:36
    Zitat von TheShadowAE

    Doch durch die Modifikationen geht es, aber das verschieben und der Rand (gibt Spuren) ist immernoch da :D
    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

  • Zeigeruhr

    • UEZ
    • 19. Februar 2010 um 09:40

    Ist gut geworden!

    Hier ein paar kleine Modifikationen:

    Spoiler anzeigen
    [autoit]


    #notrayicon
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <Date.au3>
    #include <Misc.au3>

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

    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)

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

    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)

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

    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()

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

    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

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

    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

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

    func x()
    GUICtrlSetData($Label1,"")
    endfunc

    [/autoit]

    Gruß,
    UEZ

  • LED - Laufschrift

    • UEZ
    • 18. Februar 2010 um 00:20

    Ich habe mal versucht den LEDs mehr Volumen zu geben!

    Hier das Resultat:

    Neue Backbuffer Technik:

    Spoiler anzeigen
    [autoit]


    ;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)

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

    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()

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

    ;~ Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    ;~ Local $hBitmapBuffer = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
    ;~ Local $hGraphicsBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmapBuffer)

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

    Local $hDC = _WinAPI_GetWindowDC($hGUI)
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)

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

    Local $hBMP = _WinAPI_CreateBitmap($w, $h) ;create a dummy bitmap
    Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
    Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)

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

    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)

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

    _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

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

    ;~ 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

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

    ;~ Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    ;~ _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
    ;~ Return $GUI_RUNDEFMSG
    ;~ EndFunc ;==>_WM_PAINT

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

    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

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

    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)

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

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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

    [/autoit]

    Alte:

    Spoiler anzeigen
    [autoit]


    ;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)

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

    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()

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

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    Local $hBitmapBuffer = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphics)
    Local $hGraphicsBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmapBuffer)

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

    _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

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

    ;~ 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

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

    ;~ Func _WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    ;~ _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapBuffer, 0, 0, $w, $h)
    ;~ Return $GUI_RUNDEFMSG
    ;~ EndFunc ;==>_WM_PAINT

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

    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

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

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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

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

    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

    [/autoit]

    Gruß,
    UEZ

    Dateien

    LED Laufschrift New.au3 9,97 kB – 778 Downloads
  • HAPPY BIRTHDAY @ UEZ

    • UEZ
    • 17. Februar 2010 um 17:41

    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? :rofl:


    VIELEN DANK!

    Gruß,
    UEZ

    PS: midlife crisis rückt näher...

  • GDI+ PunkteDieVonWändenAbprallenScript

    • UEZ
    • 17. Februar 2010 um 17:26

    Sieht gut aus! Weiter so!

    Jeder darf meine Codes benutzen, wie er/sie will :!:

    Gruß,
    UEZ

  • LED - Laufschrift

    • UEZ
    • 17. Februar 2010 um 14:27

    Sehr schönes Skript! :thumbup:


    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! ;)

  • Font-GDI-Gui!

    • UEZ
    • 15. Februar 2010 um 22:51

    Du kannt auch den Font in GDI+ benutzen ohne ihn zu installieren -> http://www.autoitscript.com/forum/index.php?showtopic=94679

    Gruß,
    UEZ

  • Font-GDI-Gui!

    • UEZ
    • 15. Februar 2010 um 22:33

    Du musst deinen Font installieren -> selektiere Font -> rechte Maustaste -> installieren.

    $hFamily = _GDIPlus_FontFamilyCreate ("Arial") ;-> Arial ist der TTF Font. Du kannst auch "Times", "Georgia", usw. oder deinen Font nehmen!

    Gruß,
    UEZ

  • Font-GDI-Gui!

    • UEZ
    • 15. Februar 2010 um 22:13

    Liest denn niemand die Hilfe? Dort sind solche Beispiele vorhanden! ?(

    Hier das Beispiel aus der Hilfe:

    Spoiler anzeigen
    [autoit]


    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>

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

    Opt('MustDeclareVars', 1)

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

    _Main()

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

    Func _Main()
    Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Create GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState()

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

    ; Draw a string
    _GDIPlus_Startup ()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
    $hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
    $hFormat = _GDIPlus_StringFormatCreate ()
    $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
    $hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
    _GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

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

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

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

    ; Clean up resources
    _GDIPlus_FontDispose ($hFont)
    _GDIPlus_FontFamilyDispose ($hFamily)
    _GDIPlus_StringFormatDispose ($hFormat)
    _GDIPlus_BrushDispose ($hBrush)
    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_Shutdown ()

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

    EndFunc ;==>_Main

    [/autoit]


    Gruß,
    UEZ

  • _GDIPlus_GraphicsReflectImageRect

    • UEZ
    • 14. Februar 2010 um 22:16

    Bei mir stürzt das Skript ab:

    Problemsignatur:
    Problemereignisname: APPCRASH
    Anwendungsname: AutoIt3.exe
    Anwendungsversion: 3.3.4.0
    Anwendungszeitstempel: 4b509352
    Fehlermodulname: GDIPlus.dll
    Fehlermodulversion: 5.2.6002.18005
    Fehlermodulzeitstempel: 49e036f1
    Ausnahmecode: c0000005
    Ausnahmeoffset: 000464c9
    Betriebsystemversion: 6.0.6002.2.2.0.256.4 -> Vista x32
    Gebietsschema-ID: 1031
    Zusatzinformation 1: 5a39
    Zusatzinformation 2: cdfd3cb33466d6ffbb26c3edc7aaf68f
    Zusatzinformation 3: 54f0
    Zusatzinformation 4: 2de12d5a49c981685da61adf0664ddf7

    Liegt an der Zeile 24: $reflect = _GDIPlus_BitmapCloneArea($backbuffer, 0, 0, 700, 700, $GDIP_PXF64PARGB) -> auskommentieren, dann läuft das Skript wieder!

    Gruß,
    UEZ

  • Dateien in die ExE einbinden -> Problem

    • UEZ
    • 14. Februar 2010 um 12:34

    In der Tat gibt es noch eine andere Möglichkeit, die Ressourcen einzubinden und direkt aus dem Speicher zu nutzen!

    Schaue dir mal Resources.au3 an: http://www.autoitscript.com/forum/index.php?showtopic=51103

    Gruß,
    UEZ

  • Aufrufparameter für AutoIt-Skript

    • UEZ
    • 12. Februar 2010 um 11:22
    Zitat von Mr.Fritz

    Hallo Forum.

    Ich bin (noch) neu hier im Forum und auch noch relativ neu bei AutoIt selbst. Bin allerdings schon seit langem in VB und Derivaten in div. Ausprägungen aktiv.

    Eben von VB kenne ich die Möglichkeit, einer EXE Aufrufparameter mitzugeben - und suche diese Möglichkeit nun auch in AutoIt.
    Geht das überhaupt?
    Die Hilfe spuckt mir hierzu nichts aus, auch im Web wird man nicht wirklich fündig...

    Danke schon mal für Eure Hilfe!

    Viele Grüße, Alex

    Geht auch in AutoIt -> suche mal in der Hilfe nach $CmdLine

    Gruß,
    UEZ

  • GDI+: Fussball Chronograph v1.4 Build 2010-03-09

    • UEZ
    • 12. Februar 2010 um 00:18

    Update auf v1.1 (siehe 1. Post)!

    UEZ

  • GDI+ Paint

    • UEZ
    • 11. Februar 2010 um 17:00

    Na siehste, war doch gar nicht so schwer :D

    Wenn du willst, kannst du hier mal reinschauen und dein Programm erweitern: [ gelöst ] GDI+ Zeichnen und als Bild speichern.

    Weiter so!

    UEZ

  • GDI+: Fussball Chronograph v1.4 Build 2010-03-09

    • UEZ
    • 9. Februar 2010 um 17:35
    Zitat von Oscar

    Klasse gemacht, UEZ! :thumbup:

    Wenn die Ränder (beim Stopuhr-PNG) jetzt noch nicht ganz so "ausgefranst" aussehen würden (Anti-Aliasing), wäre es perfekt!
    Ist aber nur ein kleiner "Mangel". Nur, falls Du das im PNG beheben kannst (selbst erstellt oder irgendwo gedownloadet?).
    Ansonsten aber wirklich super!

    Danke,

    die Stoppuhr und den Ball habe ich seperat herunter geladen und mit Gimp "vereint" :D Ein besseres Anti-Anliasing habe ich nicht hinbekommen, da ich mich in Gimp eigentlich überhaupt nicht auskenne!

    Wer talentiert ist, kann ja das besser machen und mir zukommen lassen (siehe Anhang -> GIMP Format) :P


    Danke auch an Schnitzel und Sprenger120 für die "Blumen"!

    Gruß,
    UEZ

    Dateien

    Fussball.7z 181,23 kB – 646 Downloads
  • Another AutoIt PreProcessor

    • UEZ
    • 9. Februar 2010 um 16:55

    Kann es sein, dass nicht alle Funktionsnamen in Kürzere umgewandelt werden?

    Z.B. der Code hier: GDI+: Fussball Chronograph Build 2010-02-09

    Gruß,
    UEZ

  • GDI+: Fussball Chronograph v1.4 Build 2010-03-09

    • UEZ
    • 9. Februar 2010 um 16:35

    Danke für die Blumen!

    Das Ganze ist aus diesem Thread heraus entstanden: Stoppuhr für Fußball

    Gruß,
    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™