GDI+ Animationen

  • Hey Leute,

    ich hab mich in den letzten Tagen zum Spaß einfach mal mit ein paar GDI+ Animationen beschäftigt, ist wie gesagt nichts großes, aber vielleicht könnt ihr mir ja was dazu sagen ;)

    Ladebildschirm 1:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    Global $stat = 1
    Global $winkel=0
    Global $x1=Cos($winkel)*40 + 40
    Global $y1=Sin($winkel)*40 + 40
    Global $x11=Cos($winkel-10)*40 + 40
    Global $y11=Sin($winkel-10)*40 + 40
    Global $x12=Cos($winkel-20)*40 + 40
    Global $y12=Sin($winkel-20)*40 + 40
    Global $x2=Cos($winkel+179)*40 + 40
    Global $y2=Sin($winkel+179)*40 + 40
    Global $x21=Cos($winkel+169)*40 + 40
    Global $y21=Sin($winkel+169)*40 + 40
    Global $x22=Cos($winkel+159)*40 + 40
    Global $y22=Sin($winkel+159)*40 + 40
    OnAutoItExitRegister("_EXIT")
    AdlibRegister("_bewege",30)
    AdlibRegister("_loading",100)
    $Gui = GUICreate("",200,100)
    $label = GUICtrlCreateLabel("Loading.",110,80)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFF0F0F0)
    $brushGruen = _GDIPlus_BrushCreateSolid(0xFF60CCFF)
    $brushGruen1 = _GDIPlus_BrushCreateSolid(0xBB60CCFF)
    $brushGruen2 = _GDIPlus_BrushCreateSolid(0x7760CCFF)
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(100, 100, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    Do
    $msg = GUIGetMsg()
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 100, 100, $brushWeiss)
    _GDIPlus_GraphicsFillEllipse($buffer,$x1,$y1,20,20,$brushGruen)
    _GDIPlus_GraphicsFillEllipse($buffer,$x11+3,$y11+3,14,14,$brushGruen1)
    _GDIPlus_GraphicsFillEllipse($buffer,$x12+5,$y12+5,10,10,$brushGruen2)
    _GDIPlus_GraphicsFillEllipse($buffer,$x2,$y2,20,20,$brushGruen)
    _GDIPlus_GraphicsFillEllipse($buffer,$x21+5,$y21+5,14,14,$brushGruen1)
    _GDIPlus_GraphicsFillEllipse($buffer,$x22+5,$y22+5,10,10,$brushGruen2)
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 100, 100)
    Until $msg = -3
    Func _EXIT()
    _GDIPlus_BrushDispose($brushGruen)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc
    Func _bewege()
    If $winkel >= 360 Then $winkel = 0
    $winkel += 0.2
    $x1=Cos($winkel)*40 + 40
    $y1=Sin($winkel)*40 + 40
    $x11=Cos($winkel-10)*40 + 40
    $y11=Sin($winkel-10)*40 + 40
    $x12=Cos($winkel-20)*40 + 40
    $y12=Sin($winkel-20)*40 + 40
    $x2=Cos($winkel+179)*40 + 40
    $y2=Sin($winkel+179)*40 + 40
    $x21=Cos($winkel+169)*40 + 40
    $y21=Sin($winkel+169)*40 + 40
    $x22=Cos($winkel+159)*40 + 40
    $y22=Sin($winkel+159)*40 + 40
    EndFunc
    Func _loading()
    Switch $stat
    Case 1
    GUICtrlSetData($label,"Loading.")
    $stat = 2
    Case 2
    GUICtrlSetData($label,"Loading..")
    $stat = 3
    Case 3
    GUICtrlSetData($label,"Loading...")
    $stat = 1
    EndSwitch
    EndFunc

    [/autoit]

    Ladebildschirm 2:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    $x1 = 10
    $x2 = 0
    $x3 = -10
    $x4 = -20
    $x5 = -30
    $x6 = -40
    $x7 = -50
    $x8 = -60
    $x9 = -70
    $x10 = -80
    $x11 = -90
    $x12 = -100
    $x13 = -110
    $x14 = -120
    $x15 = -130
    OnAutoItExitRegister("_EXIT")
    AdlibRegister("_bewege",10)
    $Gui = GUICreate("",500,50)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $brushGruen = _GDIPlus_BrushCreateSolid(0xFF60CCFF)
    $brushGruen1 = _GDIPlus_BrushCreateSolid(0xEE60CCFF)
    $brushGruen2 = _GDIPlus_BrushCreateSolid(0xDD60CCFF)
    $brushGruen3 = _GDIPlus_BrushCreateSolid(0xCC60CCFF)
    $brushGruen4 = _GDIPlus_BrushCreateSolid(0xBB60CCFF)
    $brushGruen5 = _GDIPlus_BrushCreateSolid(0xAA60CCFF)
    $brushGruen6 = _GDIPlus_BrushCreateSolid(0x9960CCFF)
    $brushGruen7 = _GDIPlus_BrushCreateSolid(0x8860CCFF)
    $brushGruen8 = _GDIPlus_BrushCreateSolid(0x7760CCFF)
    $brushGruen9 = _GDIPlus_BrushCreateSolid(0x6660CCFF)
    $brushGruen10 = _GDIPlus_BrushCreateSolid(0x5560CCFF)
    $brushGruen11 = _GDIPlus_BrushCreateSolid(0x4460CCFF)
    $brushGruen12 = _GDIPlus_BrushCreateSolid(0x3360CCFF)
    $brushGruen13 = _GDIPlus_BrushCreateSolid(0x2260CCFF)
    $brushGruen14 = _GDIPlus_BrushCreateSolid(0x1160CCFF)
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(500, 50, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    Do
    $msg = GUIGetMsg()
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 500, 50, $brushWeiss)
    _GDIPlus_GraphicsFillEllipse($buffer,$x1,15,20,20,$brushGruen)
    _GDIPlus_GraphicsFillEllipse($buffer,$x2,15,20,20,$brushGruen1)
    _GDIPlus_GraphicsFillEllipse($buffer,$x3,15,20,20,$brushGruen2)
    _GDIPlus_GraphicsFillEllipse($buffer,$x4,15,20,20,$brushGruen3)
    _GDIPlus_GraphicsFillEllipse($buffer,$x5,15,20,20,$brushGruen4)
    _GDIPlus_GraphicsFillEllipse($buffer,$x6,15,20,20,$brushGruen5)
    _GDIPlus_GraphicsFillEllipse($buffer,$x7,15,20,20,$brushGruen6)
    _GDIPlus_GraphicsFillEllipse($buffer,$x8,15,20,20,$brushGruen7)
    _GDIPlus_GraphicsFillEllipse($buffer,$x9,15,20,20,$brushGruen8)
    _GDIPlus_GraphicsFillEllipse($buffer,$x10,15,20,20,$brushGruen9)
    _GDIPlus_GraphicsFillEllipse($buffer,$x11,15,20,20,$brushGruen10)
    _GDIPlus_GraphicsFillEllipse($buffer,$x12,15,20,20,$brushGruen11)
    _GDIPlus_GraphicsFillEllipse($buffer,$x13,15,20,20,$brushGruen12)
    _GDIPlus_GraphicsFillEllipse($buffer,$x14,15,20,20,$brushGruen13)
    _GDIPlus_GraphicsFillEllipse($buffer,$x15,15,20,20,$brushGruen14)
    _GDIPlus_GraphicsFillRect($buffer,0,0,20,50,$brushWeiss)
    _GDIPlus_GraphicsFillRect($buffer,460,0,20,50,$brushWeiss)
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 500, 50)
    Until $msg = -3
    Func _EXIT()
    _GDIPlus_BrushDispose($brushGruen)
    _GDIPlus_BrushDispose($brushGruen1)
    _GDIPlus_BrushDispose($brushGruen2)
    _GDIPlus_BrushDispose($brushGruen3)
    _GDIPlus_BrushDispose($brushGruen4)
    _GDIPlus_BrushDispose($brushGruen5)
    _GDIPlus_BrushDispose($brushGruen6)
    _GDIPlus_BrushDispose($brushGruen7)
    _GDIPlus_BrushDispose($brushGruen8)
    _GDIPlus_BrushDispose($brushGruen9)
    _GDIPlus_BrushDispose($brushGruen10)
    _GDIPlus_BrushDispose($brushGruen11)
    _GDIPlus_BrushDispose($brushGruen12)
    _GDIPlus_BrushDispose($brushGruen13)
    _GDIPlus_BrushDispose($brushGruen14)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc
    Func _bewege()
    If $x1 < 460 Then $x1 += 2
    If $x1 >= 460 Then $x1 = 0
    If $x2 < 460 Then $x2 += 2
    If $x2 >= 460 Then $x2 = 0
    If $x3 < 460 Then $x3 += 2
    If $x3 >= 460 Then $x3 = 0
    If $x4 < 460 Then $x4 += 2
    If $x4 >= 460 Then $x4 = 0
    If $x5 < 460 Then $x5 += 2
    If $x5 >= 460 Then $x5 = 0
    If $x6 < 460 Then $x6 += 2
    If $x6 >= 460 Then $x6 = 0
    If $x7 < 460 Then $x7 += 2
    If $x7 >= 460 Then $x7 = 0
    If $x8 < 460 Then $x8 += 2
    If $x8 >= 460 Then $x8 = 0
    If $x9 < 460 Then $x9 += 2
    If $x9 >= 460 Then $x9 = 0
    If $x10 < 460 Then $x10 += 2
    If $x10 >= 460 Then $x10 = 0
    If $x11 < 460 Then $x11 += 2
    If $x11 >= 460 Then $x11 = 0
    If $x12 < 460 Then $x12 += 2
    If $x12 >= 460 Then $x12 = 0
    If $x13 < 460 Then $x13 += 2
    If $x13 >= 460 Then $x13= 0
    If $x14 < 460 Then $x14 += 2
    If $x14 >= 460 Then $x14 = 0
    If $x15 < 460 Then $x15 += 2
    If $x15 >= 460 Then $x15 = 0
    EndFunc

    [/autoit]

    Und Nummer 3;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    $angle = 1
    $r = 1
    $startangle = 0
    Dim $brush[16]
    OnAutoItExitRegister("_EXIT")
    AdlibRegister("_bewege",15)
    $Gui = GUICreate("",100,100)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $brush[1] = _GDIPlus_BrushCreateSolid(0xFF66CCFF)
    $brush[2] = _GDIPlus_BrushCreateSolid(0xEE66CCFF)
    $brush[3] = _GDIPlus_BrushCreateSolid(0xDD66CCFF)
    $brush[4] = _GDIPlus_BrushCreateSolid(0xCC66CCFF)
    $brush[5] = _GDIPlus_BrushCreateSolid(0xBB66CCFF)
    $brush[6] = _GDIPlus_BrushCreateSolid(0xAA66CCFF)
    $brush[7] = _GDIPlus_BrushCreateSolid(0x9966CCFF)
    $brush[8] = _GDIPlus_BrushCreateSolid(0x8866CCFF)
    $brush[9] = _GDIPlus_BrushCreateSolid(0x7766CCFF)
    $brush[10] = _GDIPlus_BrushCreateSolid(0x6666CCFF)
    $brush[11] = _GDIPlus_BrushCreateSolid(0x5566CCFF)
    $brush[12] = _GDIPlus_BrushCreateSolid(0x4466CCFF)
    $brush[13] = _GDIPlus_BrushCreateSolid(0x3366CCFF)
    $brush[14] = _GDIPlus_BrushCreateSolid(0x2266CCFF)
    $brush[15] = _GDIPlus_BrushCreateSolid(0x1166CCFF)

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

    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(100, 100, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    Do
    $msg = GUIGetMsg()
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 100, 100, $brushWeiss)
    _GDIPlus_GraphicsFillPie($buffer,0,0,100,100,$startangle,$angle,$brush[$r])
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 100, 100)
    Until $msg = -3
    Func _EXIT()
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc
    Func _bewege()
    $startangle += 2
    If $angle < 360 Then $angle += 3
    If $angle >= 360 Then $angle = 0
    ;~ ConsoleWrite($angle&@CRLF)
    Select
    Case $angle < 24
    $r = 1
    Case $angle >= 24 And $angle < 48
    $r = 2
    Case $angle >= 48 And $angle < 72
    $r = 3
    Case $angle >= 72 And $angle < 96
    $r = 4
    Case $angle >= 96 And $angle < 120
    $r = 5
    Case $angle >= 120 And $angle < 144
    $r = 6
    Case $angle >= 144 And $angle < 168
    $r = 7
    Case $angle >= 168 And $angle < 192
    $r = 8
    Case $angle >= 192 And $angle < 216
    $r = 9
    Case $angle >= 216 And $angle < 240
    $r = 10
    Case $angle >= 240 And $angle < 264
    $r = 11
    Case $angle >= 264 And $angle < 288
    $r = 12
    Case $angle >= 288 And $angle < 322
    $r = 13
    Case $angle >= 322 And $angle < 346
    $r = 14
    Case $angle >= 346 And $angle < 360
    $r = 15
    EndSelect
    EndFunc

    [/autoit]

    8:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    Global $pi = 3.1415926535898
    Global $formel = 1
    Global $winkel1 = 0
    Global $winkel2 = $pi
    Global $x1start=Round(Cos($winkel1)*40 + 40,0)
    Global $y1start=Round(Sin($winkel1)*40 + 40,0)
    Global $x1=$x1start
    Global $y1=$y1start
    OnAutoItExitRegister("_EXIT")
    AdlibRegister("_bewege",10)
    $Gui = GUICreate("",200,100)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFF0F0F0)
    $brushGruen = _GDIPlus_BrushCreateSolid(0xFF60CCFF)
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(200, 100, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    Do
    $msg = GUIGetMsg()
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 200, 100, $brushWeiss)
    _GDIPlus_GraphicsFillEllipse($buffer,$x1,$y1,20,20,$brushGruen)
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 200, 100)
    Until $msg = -3
    Func _EXIT()
    _GDIPlus_BrushDispose($brushGruen)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc
    Func _bewege()
    If $formel=1 Then
    $winkel1 += $pi/30
    $x1=Round(Cos($winkel1)*40 + 40,0)
    $y1=Round(Sin($winkel1)*40 + 40,0)
    Else
    $winkel2 -= $pi/30
    $x1=Round(Cos($winkel2)*40 + 120,0)
    $y1=Round(Sin($winkel2)*40 + 40,0)
    EndIf
    If $x1 = $x1start And $y1 = $y1start Then $formel = $formel*-1
    EndFunc

    [/autoit]

    Regen:

    Spoiler anzeigen
    [autoit]

    #include <GuiConstants.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>
    Opt("GUIOnEventMode", 1)

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

    $fach = 0
    Dim $gegner[80][2]
    For $j = 0 To UBound($gegner) - 1 Step 1
    $gegner[$j][0] = -100
    Next
    OnAutoItExitRegister("_EXIT")
    $Gui = GUICreate("Regen", 500, 500, 100, 100)
    _GDIPlus_Startup()
    $brushSchwarz = _GDIPlus_BrushCreateSolid(0xFFABCDEF)
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(500, 500, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    AdlibRegister("_gegnerSpawn", 50)
    GUISetOnEvent(-3,"_ExitMode")
    Do
    For $m = 0 To UBound($gegner) - 1 Step 1
    If $gegner[$m][1] >= 480 Then $gegner[$m][1] = 0
    Next
    For $k = 0 To UBound($gegner) - 1 Step 1
    $gegner[$k][1] += 2
    Next
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 500, 500, $brushWeiss)
    For $i = 0 To UBound($gegner) - 1 Step 1
    _GDIPlus_GraphicsFillEllipse($buffer, $gegner[$i][0], $gegner[$i][1], 20, 20, $brushSchwarz)
    Next
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 500, 500)
    Until Not 1
    Func _EXIT()
    _GDIPlus_BrushDispose($brushSchwarz)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_Shutdown()
    EndFunc ;==>_EXIT
    Func _gegnerSpawn()
    If $fach <= UBound($gegner) - 2 Then
    $gegner[$fach][0] = Random(0, 480, 1)
    $fach += 1
    $gegner[$fach][1] = 0
    EndIf
    EndFunc ;==>_gegnerSpawn
    Func _ExitMode()
    Exit
    EndFunc

    [/autoit]

    Ich hoffe es gefällt euch

    DFPWare

  • Die Ideen gefallen mir (besonders Nummer 3), aber die Umsetzung könnte man noch verbessern... z.B. Solltest du die Animation nicht in der MessageLoop ablaufen lassen, sondern eher zusammen mit den Berechnungen in eine Funktion packen die du mit AdlibRegister abrufst. Dadurch wird u.A. verhindert, dass unnötige Frames gezeichnet werden (d.h. es wird gezeichnet, auch wenn keines der Objekte die Position geändert hat).

  • Etwa so?:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    $angle = 1
    $r = 1
    $startangle = 0
    Dim $brush[16]
    OnAutoItExitRegister("_EXIT")
    AdlibRegister("_bewege",15)
    $Gui = GUICreate("",100,100)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    $brush[1] = _GDIPlus_BrushCreateSolid(0xFF66CCFF)
    $brush[2] = _GDIPlus_BrushCreateSolid(0xEE66CCFF)
    $brush[3] = _GDIPlus_BrushCreateSolid(0xDD66CCFF)
    $brush[4] = _GDIPlus_BrushCreateSolid(0xCC66CCFF)
    $brush[5] = _GDIPlus_BrushCreateSolid(0xBB66CCFF)
    $brush[6] = _GDIPlus_BrushCreateSolid(0xAA66CCFF)
    $brush[7] = _GDIPlus_BrushCreateSolid(0x9966CCFF)
    $brush[8] = _GDIPlus_BrushCreateSolid(0x8866CCFF)
    $brush[9] = _GDIPlus_BrushCreateSolid(0x7766CCFF)
    $brush[10] = _GDIPlus_BrushCreateSolid(0x6666CCFF)
    $brush[11] = _GDIPlus_BrushCreateSolid(0x5566CCFF)
    $brush[12] = _GDIPlus_BrushCreateSolid(0x4466CCFF)
    $brush[13] = _GDIPlus_BrushCreateSolid(0x3366CCFF)
    $brush[14] = _GDIPlus_BrushCreateSolid(0x2266CCFF)
    $brush[15] = _GDIPlus_BrushCreateSolid(0x1166CCFF)

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

    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(100, 100, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    GUISetState()
    Do
    $msg = GUIGetMsg()
    Until $msg = -3
    Func _EXIT()
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc
    Func _bewege()
    $startangle += 2
    If $angle < 360 Then $angle += 3
    If $angle >= 360 Then $angle = 0
    ;~ ConsoleWrite($angle&@CRLF)
    Select
    Case $angle < 24
    $r = 1
    Case $angle >= 24 And $angle < 48
    $r = 2
    Case $angle >= 48 And $angle < 72
    $r = 3
    Case $angle >= 72 And $angle < 96
    $r = 4
    Case $angle >= 96 And $angle < 120
    $r = 5
    Case $angle >= 120 And $angle < 144
    $r = 6
    Case $angle >= 144 And $angle < 168
    $r = 7
    Case $angle >= 168 And $angle < 192
    $r = 8
    Case $angle >= 192 And $angle < 216
    $r = 9
    Case $angle >= 216 And $angle < 240
    $r = 10
    Case $angle >= 240 And $angle < 264
    $r = 11
    Case $angle >= 264 And $angle < 288
    $r = 12
    Case $angle >= 288 And $angle < 322
    $r = 13
    Case $angle >= 322 And $angle < 346
    $r = 14
    Case $angle >= 346 And $angle < 360
    $r = 15
    EndSelect
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, 100, 100, $brushWeiss)
    _GDIPlus_GraphicsFillPie($buffer,0,0,100,100,$startangle,$angle,$brush[$r])
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 100, 100)
    EndFunc

    [/autoit]
  • Schönes Beispiel! :thumbup:

    Hab's mal ein bissl gestrafft:

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    $w = 300
    $h = 300
    $angle = 1
    $r = 1
    $startangle = 0
    Dim $brush[16]
    OnAutoItExitRegister("_EXIT")
    $Gui = GUICreate("", $w, $h)
    _GDIPlus_Startup()
    $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    For $i = 0 To 14
    $brush[$i + 1] = _GDIPlus_BrushCreateSolid("0x" & Hex(0xFF - $i * 0x11, 2) & "66CCFF")
    Next
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsSetSmoothingMode($buffer, 2)
    GUISetState()
    AdlibRegister("_bewege", 15)
    Do
    $msg = GUIGetMsg()
    Until $msg = -3

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

    Func _EXIT()
    For $i = 1 To 15
    _GDIPlus_BrushDispose($brush[$i])
    Next
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc ;==>_EXIT

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

    Func _bewege()
    $startangle += 2
    $angle = Mod($angle + 3, 360)
    ;~ ConsoleWrite($angle&@CRLF)
    $r = 1 + Floor($angle / 24)
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, $w, $h, $brushWeiss)
    _GDIPlus_GraphicsFillPie($buffer, 0, 0, $w, $h, $startangle, $angle, $brush[$r])
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, $w, $h)
    EndFunc ;==>_bewege

    [/autoit]

    Ladebildschirm 1 sieht aus schön aus!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Colle Ideen :thumbup:

    Ich hab auch schonmal irg welche sinnlosen GDI+ Spielereinein gemacht, z.B. dashier

    Auto(It)
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstants.au3>
    Opt("GuiOnEventMode", 1)
    _GDIPlus_Startup()
    Global $GuiWidth = 500, $GuiHeight = 400
    Global $KreisWidth = 50, $KreisHeight = 50, $KreisX = 50, $KreisY = $GuiHeight - $KreisHeight * 1.5, $fStartAngel = 175, $fSweepAngel = 100, $fStartAngel2 = 264, $fSweepAngel2 = 102
    Global $fStartAngel3 = 360, $fSweepAngel3 = 93, $fStartAngel4 = 450, $fSweepAngel4 = 90, $Speed = 10
    $Schritt = 0
    Global $nX = $GuiWidth, $nY = 30
    $hInput = InputBox("Text", "Bitte Text eingeben!")
    $hWnd = GUICreate("Physik", $GuiWidth, $GuiHeight)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    GUISetState()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphic)
    $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    $hPen = _GDIPlus_PenCreate(0xff0000ff, 40)
    $hPen2 = _GDIPlus_PenCreate(0xffff0000, 40)
    $hPen3 = _GDIPlus_PenCreate(0xffffff00, 40)
    $hPen4 = _GDIPlus_PenCreate(0xff00ff00, 40)
    $hBrush = _GDIPlus_BrushCreateSolid(0xff00ddff)
    $hBrush2 = _GDIPlus_BrushCreateSolid(0xffff50ff)
    $hBrush3 = _GDIPlus_BrushCreateSolid(0xffddddff)

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

    While 1
    If $nX <= 0 - StringLen($hInput) * 34 Then
    Global $nX = $GuiWidth, $nY = 30
    EndIf
    _GDIPlus_GraphicsClear($hBackbuffer, 0xffffffff)
    For $i = $Schritt To $GuiWidth Step 20
    _GDIPlus_GraphicsDrawLine($hBackbuffer, $i, 0, $i, $GuiHeight)
    Next
    _GDIPlus_GraphicsDrawString($hBackbuffer, $hInput, $nX, $nY, "Good Times", 20)
    $Schritt -= $Speed / 4
    $nX -= $Speed / 4
    _GDIPlus_GraphicsFillRect($hBackbuffer, $KreisX * 2, $GuiHeight / 3, $KreisX * 4.5, 200, $hBrush2)
    _GDIPlus_GraphicsFillRect($hBackbuffer, $KreisX * 3.8, $GuiHeight / 2.5, $KreisX * 2, 90, $hBrush3)
    _GDIPlus_GraphicsFillRect($hBackbuffer, $KreisX, $GuiHeight / 1.5, $KreisX * 7, 100, $hBrush)

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

    _rad()
    $fStartAngel += $Speed
    $fStartAngel2 += $Speed
    $fStartAngel3 += $Speed
    $fStartAngel4 += $Speed

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

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $GuiWidth, $GuiHeight)

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

    ;~ _GDIPlus_ImageSaveToFile ($hBitmap, @desktopdir & "\Extra Bilder\Bild"&$t&".jpg")
    WEnd

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

    Func _rad()
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel4, $fSweepAngel4, $hPen4)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel3, $fSweepAngel3, $hPen3)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel, $fSweepAngel, $hPen)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel2, $fSweepAngel2, $hPen2)

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

    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX * 7, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel4, $fSweepAngel4, $hPen4)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX * 7, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel3, $fSweepAngel3, $hPen3)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX * 7, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel, $fSweepAngel, $hPen)
    _GDIPlus_GraphicsDrawArc($hBackbuffer, $KreisX * 7, $KreisY, $KreisWidth, $KreisHeight, $fStartAngel2, $fSweepAngel2, $hPen2)
    EndFunc ;==>_rad

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

    Func _exit()
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_exit

    [/autoit]

    Ich weiß das es sehr schlecht gemacht ist :D

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • Wieso ist doch nicht schlecht ;)

    Ich hab das ja auch nur aus Langeweile gemacht und vielleicht hilft es dem einen oder anderen, der GDI+ noch nicht beherrscht, obwohl ich es eigentlich auch nimcht beherrsche, ich hab...sagen wir Grundkenntnisse;)

    DFPWare


    EDIT: Ich hab jetzt die UDF, wenn man das so nennen will mal Beispielhaft für Lade3 gemacht um zu gucken ob das so okay ist, die Kommentare kommen noch ;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    OnAutoItExitRegister("Lade_shutdown")
    $gui = GUICreate("GUI",100,100)
    Lade_startup($gui,100,100)
    GUISetState()
    AdlibRegister("Lade_bewege",15)
    Do
    $msg = GUIGetMsg()
    Until $msg = -3

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

    Func Lade_bewege()
    $startangle += 2
    $angle = Mod($angle + 3, 360)
    $r = 1 + Floor($angle / 24)
    _GDIPlus_GraphicsFillRect($buffer, 0, 0, $w, $h, $brushWeiss)
    _GDIPlus_GraphicsFillPie($buffer, 0, 0, $w, $h, $startangle, $angle, $brush[$r])
    _GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, $w, $h)
    EndFunc
    Func Lade_startup($hWnd,$width,$height)
    Global $w = $width
    Global $h = $height
    Global $angle = 1
    Global $r = 1
    Global $startangle = 0
    Global $brush[16]
    _GDIPlus_Startup()
    Global $brushWeiss = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    For $i = 0 To 14
    $brush[$i + 1] = _GDIPlus_BrushCreateSolid("0x" & Hex(0xFF - $i * 0x11, 2) & "66CCFF")
    Next
    Global $graphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $graphic)
    Global $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsSetSmoothingMode($buffer, 2)
    EndFunc
    Func Lade_shutdown()
    For $i = 1 To 15
    _GDIPlus_BrushDispose($brush[$i])
    Next
    _GDIPlus_BrushDispose($brushWeiss)
    _GDIPlus_GraphicsDispose($graphic)
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_Shutdown()
    EndFunc

    [/autoit]

    Ich hoffe ihr könnt mir noch sagen was ich verbessern kann, weil wenn man es ausführt bekommt man eine Reihe von Warnings, obwohl es funktioniert ;)