Moin,
Hier mal ein kleines Skript welches Rollen aus Rechtecken in GDI+ zeichnen kann.
Vllt kann man sowas ja zur Unterstützung eines Ladebalkens oder Ähnlichem mal einsetzen.
(Dann sollte man die wenigen Frames aber puffern. Das sollte schnell gehen)
"Skript"
#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]Opt('GUIOnEventMode', 1)
Opt('MustDeclareVars', 1)
Global Const $iFrameRate = 45
[/autoit] [autoit][/autoit] [autoit]Global Const $iHoehe = 480, $iBreite = Int($iHoehe * 4 / 3)
Global $hGUI, $hBUF, $hBMP, $hGFX, $hBRU, $fLast, $iFPS = 0, $iTimer
$hGUI = GUICreate('Beispiel:', $iBreite, $iHoehe)
GUISetBkColor(0x000000, $hGUI)
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGFX = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBMP = _GDIPlus_BitmapCreateFromGraphics($iBreite, $iHoehe, $hGFX)
$hBUF = _GDIPlus_ImageGetGraphicsContext($hBMP)
$hBRU = _GDIPlus_BrushCreateSolid()
_GDIPlus_GraphicsClear($hBUF, 0xFF000000)
WM_PAINT()
OnAutoItExitRegister('_Freigeben')
GUIRegisterMsg(0xF, 'WM_PAINT')
GUISetOnEvent(-3, '_Exit', $hGUI)
GUISetState(@SW_SHOW, $hGUI)
$iTimer = TimerInit()
[/autoit] [autoit][/autoit] [autoit]While True
_GDIPlus_GraphicsClear($hBUF, 0xFF000000)
_Main()
WM_PAINT()
WEnd
Func _Main()
Local Static $iCounter = 0, $aARGB1[4] = [255, 255, 0, 0], $aARGB2[4] = [100, 0, 255, 0], $aARGB3[4] = [255, 0, 0, 255], $aARGB4[4] = [150, 0, 255, 255]
_Rolle($hBUF, 5, 25, 25, $iBreite / 2 - 50, $iHoehe / 2 - 50, 20, $aARGB1, $iCounter, False)
_Rolle($hBUF, 35, 25 + $iBreite / 2, 25, $iBreite / 2 - 50, $iHoehe / 2 - 50, 10, $aARGB2, $iCounter, False)
_Rolle($hBUF, 25, 25, 25 + $iHoehe / 2, $iBreite / 2 - 50, $iHoehe / 2 - 50, 10, $aARGB3, $iCounter, True)
_Rolle($hBUF, 25, 25 + $iBreite / 2, 25 + $iHoehe / 2, $iBreite / 2 - 50, $iHoehe / 2 - 50, 5, $aARGB4, $iCounter, True)
$iCounter += 1
If $iCounter = 360 Then $iCounter = 0
EndFunc ;==>_Main
Func _Rolle($hGFX, $iAnz, $iX, $iY, $iB, $iH, $iElementH, $aARGB, $iCounter, $iAlpha = False)
Local $iT = $iH, $_Y[$iAnz], $_T[$iAnz], $_C[$iAnz], $iTMP_1, $iTMP_2
For $i = 0 To $iAnz - 1 Step 1
$_Y[$i] = $iH / 2 + _Sin($iCounter + (360 / $iAnz) * $i) * ($iH / 2 - $iElementH / 2) + $iY
$_T[$i] = (2.5 + (-_Sin($iCounter + (360 / $iAnz) * $i + 90)) / 2) / 3
Next
For $x = 0 To $iAnz - 1 Step 1
$iTMP_1 = 0
$iTMP_2 = $_T[0]
For $i = 1 To $iAnz - 1 Step 1
If $iTMP_2 > $_T[$i] Then
$iTMP_2 = $_T[$i]
$iTMP_1 = $i
EndIf
Next
_Balken($hGFX, $iX, $_Y[$iTMP_1], $iB, $iElementH, $_T[$iTMP_1], $aARGB, $iAlpha)
$_T[$iTMP_1] = 10
Next
EndFunc ;==>_Rolle
Func _Balken($hGFX, $iX, $iY, $iB, $iH, $iT, $aARGB, $iAlpha)
Local $iTMP_1 = $iT ^ 3
If $iAlpha Then
_GDIPlus_BrushSetSolidColor($hBRU, '0x' & Hex(Int($aARGB[0] * $iTMP_1), 2) & Hex(Int($aARGB[1] * $iTMP_1), 2) & Hex(Int($aARGB[2] * $iTMP_1), 2) & Hex(Int($aARGB[3] * $iTMP_1), 2))
Else
_GDIPlus_BrushSetSolidColor($hBRU, '0x' & Hex(Int($aARGB[0]), 2) & Hex(Int($aARGB[1] * $iTMP_1), 2) & Hex(Int($aARGB[2] * $iTMP_1), 2) & Hex(Int($aARGB[3] * $iTMP_1), 2))
EndIf
_GDIPlus_GraphicsFillRect($hGFX, $iX + $iB / 2 - ($iB * $iT) / 2, $iY - ($iH * $iT) / 2, $iB * $iT, $iH * $iT, $hBRU)
$iY += $iH
EndFunc ;==>_Balken
Func _Sin($a)
Return Sin($a * 0.0174532925199433)
EndFunc ;==>_Sin
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _Freigeben()
_GDIPlus_BrushDispose($hBRU)
_GDIPlus_GraphicsDispose($hBUF)
_GDIPlus_BitmapDispose($hBMP)
_GDIPlus_GraphicsDispose($hGFX)
_GDIPlus_Shutdown()
EndFunc ;==>_Freigeben
Func WM_PAINT()
_GDIPlus_GraphicsDrawImage($hGFX, $hBMP, 0, 0)
$fLast += _FPS($iFrameRate)
$iFPS += 1
If TimerDiff($iTimer) > 1000 Then
WinSetTitle($hGUI, '', 'FPS: ' & $iFPS & ' | Auslastung: ' & Round($fLast / $iFPS, 2) * 100 & '%')
$iFPS = 0
$fLast = 0
$iTimer = TimerInit()
EndIf
EndFunc ;==>WM_PAINT
Func _FPS($i)
Local Static $_T = TimerInit(), $f
Local $s = TimerDiff($_T), $l = (1000 / $i - $s)
$f += $l
If $f < 0 Then $f = 0
If $l < 0 Then $l = 0
Sleep(Int($f / 10) * 10)
$f -= Int($f / 10) * 10
$_T = TimerInit()
Return $s / ($s + $l)
EndFunc ;==>_FPS
.