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. Mars

Beiträge von Mars

  • Zahlen in Worte umwandeln

    • Mars
    • 17. April 2013 um 10:41
    [autoit]

    Func Ziffer($Par, $r, $w)
    $x = 'ein,zwei,drei,vier,fünf,sech,sieb,acht,neun'
    $x = StringSplit($x,",")
    $w = $w & $x[$r]

    [/autoit]

    Hab das jetzt nicht nachgeprüft, aber hier steckt schonmal eine 9 in $x[0]. Vllt ist das deine 9 :)

    Insgesamt sehr schön umgesetzt ;)

  • Tic Tac Toe [mit KI Funktion]

    • Mars
    • 16. April 2013 um 23:36
    Zitat von General Kaboom


    3000 Zeilen für Tic-Tac-Toe :huh: dann muss die KI mich aber in einem einzigen Zug besiegen können :D

    Made my Day :thumbup:

    Sehr interessantes Skript.
    Hatte leider zu viel Angst es auszuführen, da ich die 3000 Zeilen nicht genau verstanden habe (aufgrund der Menge natürlich :P)
    Irgendwann wenn ich durch bin wirds mal getestet

    Edit: Habs jetzt getestet.
    Hab noch nie so heftige If Abfragen gesehen...
    gutes Spiel.

  • Schnelle Grafikroutinen aus der MSIMG32

    • Mars
    • 16. April 2013 um 23:11

    Moin,
    Die Funktionen nutze ich schon eine Ewigkeit :P

    Als kleine Anmerkung:
    Der Alphablend verfälscht die Farben.
    Das Resultat erhält zusätzlich zur Transparenz auch noch einen höheren Schwarzwert.
    Je höher die Transparenz, desto niedriger die Farbigkeit.
    (wollte ich nur mal erwähnen, weil mich das irgendwann so genervt hat, dass ich den AlphaBlend wieder zu den Akten gelegt habe)

    PS: Mein halbes MicroTD besteht aus dem AlphaBlend. Da ist der Schwarzwert wunderbar, weil es die ganze Sache düsterer aussehen lässt :D

  • rechten Mausklick abfragen

    • Mars
    • 13. April 2013 um 01:03

    Um die Maus abzufragen kann _IsPressed verwendet werden.

    [autoit]

    #include <Misc.au3>
    While Sleep(100)
    If _IsPressed('01') Then
    ToolTip('Links')
    ElseIf _IsPressed('02') Then
    ToolTip('Rechts')
    Else
    ToolTip('')
    EndIf
    WEnd

    [/autoit]

    lg
    Mars

  • AutoIt-only 3D Engine. Mit Farb-Shading, Models aus Dateien, Rotation, Zoom, uvm.

    • Mars
    • 12. April 2013 um 20:49

    Hab was getestet, sollte ein Kasten mit Loch werden.
    Irgendwie stimmen da die Überblendungen nicht.

    Spoiler anzeigen
    Code
    17
    v 1 -3 -0.5
    v 1 0 -0.5
    v 4 0 -0.5
    v 4 -3 -0.5
    v 2 -2 -0.5
    v 2 -1 -0.5
    v 3 -1 -0.5
    v 3 -2 -0.5
    v 3 0 -0.5
    v 1 -3 0.5
    v 1 0 0.5
    v 4 0 0.5
    v 4 -3 0.5
    v 2 -2 0.5
    v 2 -1 0.5
    v 3 -1 0.5
    v 3 -2 0.5
    v 3 0 0.5
    5
    f 4 4 7 16 13 0 0 255
    f 4 6 5 14 15 0 0 255
    f 4 5 4 13 14 0 0 255
    f 4 7 6 15 16 0 0 255
    f 10 1 8 6 5 4 7 8 2 3 0 0 255 255
    f 10 10 17 15 14 13 16 17 11 12 9 0 255 255
    Alles anzeigen

    Wenn man die 2 großen Flächen entfernt sieht man, dass die 4 inneren alle korrekt sind.
    Irgendwie wird manchmal die hintere Große Fläche vor die kleinen gezogen. (Vermutung !!!).

    Aber schonmal sehr löblich, dass keine Polygone erforderlich sind :P

  • Die Sache mit dem Alphakanal

    • Mars
    • 9. April 2013 um 02:05

    Das schreit eigentlich nach ASM, aber dazu war ich jetzt zu faul :P
    Hier gibts schonmal eine potentielle Lösung des Problems.
    Die Funktion läd ein Bild, ändert die Transparenz und speichert es unter einem anderen Namen ab.
    Damit müsste es Dir möglich sein ein Skript zu bauen um alle Bilder zu verändern.
    Hab es hier nur kurz getestet. bevor du damit auf Nutzdaten losgehst muss das umfassend getestet werden !
    Falls du bei der Änderung des Alphakanals die Farben beeinflusst hast ist ein Informationsverlust wahrscheinlich.
    Zur (teilweisen) Rekonstruktion ist dein Skript in diesem Fall unerlässlich.

    Skript
    [autoit]

    #include <GDIPlus.au3>

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

    _SetAlpha('Test1.png', 'Test2.png', 100)
    Sleep(1000) ; Damit die Festplatte hinterherkommt
    _SetAlpha('Test2.png', 'Test3.png', 255)

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

    ; Diese Funktion kann man überall einsetzen

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

    Func _SetAlpha($sPfad1, $sPfad2, $iAlpha)
    _GDIPlus_Startup()
    Local $aImg = _Image_CreateFromFile($sPfad1)
    Local $iW = _GDIPlus_ImageGetWidth($aImg[0])
    Local $iH = _GDIPlus_ImageGetHeight($aImg[0])
    Local $iPtr = $aImg[2], $vBmp = $aImg[1], $hBmp = $aImg[0], $xAlpha = Hex(Int($iAlpha),2)
    For $i = 1 To $iW * $iH Step 1
    DllStructSetData($vBmp, 1, '0x' & $xAlpha & StringRight(Hex(Int(DllStructGetData($vBmp, 1, $i)),8),6), $i)
    Next
    _GDIPlus_ImageSaveToFile($hBmp, $sPfad2)
    _Image_DeleteGDIPlus($aImg)
    EndFunc

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

    ; !!! Achtung folgendes ist inkompatibel zu _Image_Create !!!
    ; Die folgenden Funktionen sind auf das Problem zugeschnitten und nutzen GDI+ statt GDI

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

    Func _Image_CreateFromFile($sPfad)
    Local $hBmp = _GDIPlus_ImageLoadFromFile($sPfad)
    Local $aImg = _Image_CreateGDIPlus(_GDIPlus_ImageGetWidth($hBmp), _GDIPlus_ImageGetHeight($hBmp))
    Local $hGFX = _GDIPlus_ImageGetGraphicsContext($aImg[0])
    _GDIPlus_GraphicsDrawImage($hGFX, $hBmp, 0, 0)
    _GDIPlus_GraphicsDispose($hGFX)
    Return $aImg
    EndFunc

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

    Func _Image_CreateGDIPlus($iW, $iH)
    Local $iPtr, $hBmp, $aTmp, $vBmp
    $vBmp = DllStructCreate('int[' & $iW * $iH & ']')
    $aTmp = DllCall('GDIPlus.dll', 'uint', 'GdipCreateBitmapFromScan0', 'int', $iW, 'int', $iH, 'int', $iW * 4, 'int', 0x0026200A, 'ptr', DllStructGetPtr($vBmp), 'int*', 0)
    $hBmp = $aTmp[6]
    $iPtr = DllStructGetPtr($vBmp)
    Local $a[3] = [$hBmp, $vBmp, $iPtr]
    Return $a
    EndFunc

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

    Func _Image_DeleteGDIPlus(ByRef $a)
    _GDIPlus_BitmapDispose($a[0])
    $a = 0
    EndFunc

    [/autoit]


    lg
    Mars

  • GDI+ - Skript beschleunigen und Linien abrunden

    • Mars
    • 2. April 2013 um 16:41

    Die gute alte _Image_Create Funktion :D
    Leichter anzuwenden als ein GDI+ Backbuffer und 20x schneller.

  • [GDI+] Runder, Animierter Ladebalken

    • Mars
    • 2. April 2013 um 15:57
    Zitat von UEZ

    Hi GtaSpider,

    ist schon klar, wenn du die 5 Zeilen weg lässt, dass es geht, aber


    ProgressSet Funktion läuf bei mir nicht ;)

    Gruß,
    UEZ


    Eventuell sollte ich die Funktion umbenennen, aber sie tut genau das was sie soll.
    Die Prozentzahl wird schon beim Zeichnen angegeben, daher ist der ProgressSet für diesen Wert überflüssig.
    Die Funktion ist dazu da um die Attribute (Farben, Drehung, usw) anzupassen.
    Alle im Beispiel befindlichen Ladebalken zeigen den gleichen Stand (den vom Slider oben), ProgressSet zeigt nur die verschiedenen Designmöglichkeiten.

  • [GDI+] Runder, Animierter Ladebalken

    • Mars
    • 2. April 2013 um 14:48

    Schön, dass es euch gefällt :)
    Selbstverständlich darf jeder nach eigenem Ermessen Modifikationen vornehmen.
    Solange es danach nicht vollkommen entstellt ist ( :D ) darf mein Name irgendwo auftauchen.
    Ein kleines Update (war Gestern Abend nicht mehr Willig im Code aufzuräumen) im ersten Post.

  • [GDI+] Runder, Animierter Ladebalken

    • Mars
    • 2. April 2013 um 03:12

    Moin,
    Vor Urzeiten habe ich schonmal einen Runden Ladebalken gebastelt.
    Als GDI+ Anfänger war es aber bei weitem nicht das, was man so alles rausholen kann.
    Hier mal eine kleine Demonstration meines heutigen Werkes:
    Runde sich drehende Ladebalken mit Animationen (Beim Füllen werden die Segmente Aufgebaut, Bei 100% wird die Rotation beschleunigt und die Größe reduziert)
    Wer daran herumbasteln will darf dies gerne tun, dafür ist der Spaß ja da ;)

    &quot;Skript + Sonstiges&quot;

    Edit: Nun ist der Code etwas besser aufgeräumt
    + ProgressSet Funktion läuft
    + Eine Hand voll mehr Einstellungsmöglichkeiten

    Edit2:
    + Umbenennung von ProgressSet zu ProgressSetDesign
    Der Progress enthält zurzeit keine Informationen über seinen "Füllstand" (keine Prozentzahl)
    Da ich davon ausging, dass bei jedem Neuzeichnen ein neuer Prozentwert übergeben wird, existiert keine Funktion um einen Prozentstand zuzuweisen.

    Edit3:
    + ProgressSet & ProgressGet setzen oder geben den aktuellen Prozentwert.
    + BitBlt statt GDI+ (macht nur das Beispiel schneller, die eigentlichen Funktionen bleiben leider relativ zeitintensiv...)

    [autoit]


    #include <GDIPlus.au3>

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

    Opt('GUIOnEventMode', 1)

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

    Global Const $PI = 3.14159265358979
    Global Const $Deg2Rad = $PI / 180

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

    Global Const $W = 500, $H = 500

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

    Global $GFX, $SLI, $PER, $PRO[3], $BUF, $CNT, $NUM, $DC, $IMG

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

    $GUI = GUICreate('Test', $W, $H)

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

    _GDIPlus_Startup()
    $IMG = _Image_Create($W, $H)
    $BUF = DllStructGetData($IMG, 1)
    $DC = _WinAPI_GetDC($GUI)
    $GFX = _GDIPlus_GraphicsCreateFromHDC($BUF)
    _GDIPlus_GraphicsSetSmoothingMode($GFX, 4)

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

    $SLI = GUICtrlCreateSlider(5, 5, 490, 30)
    GUICtrlSetLimit(-1, 1000, 0)

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

    $PRO[0] = _ProgressCreate(7, 10, 0.1, 0x0060FF, 0x30002080)
    $PRO[1] = _ProgressCreate(11, 25, -0.32, 0xFF6000, 0x30802000)
    $PRO[2] = _ProgressCreate(25, 35, 0.2, 0x00FF60, 0x30008020)

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

    OnAutoItExitRegister('_Dispose')
    GUISetOnEvent(-3, '_Event', $GUI)
    GUISetState(@SW_SHOW, $GUI)

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

    While Sleep(10)
    $PER = GUICtrlRead($SLI) / 1000
    If $PER < 1 Then GUICtrlSetData($SLI, GUICtrlRead($SLI) + 1)
    $CNT += 1

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

    _GDIPlus_GraphicsClear($GFX)

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

    If IsInt($CNT/100) Then
    $NUM += 1
    If $NUM = UBound($PRO) Then $NUM = 0
    _ProgressSetDesign($PRO[$NUM], Random(1, 15, 1), Random(10, 40), Random(-1, 1), '0x' & Hex(Int(Random(0,255, 1)),2) & Hex(Int(Random(0,255, 1)),2) & Hex(Int(Random(0,255, 1)),2), '0x35' & Hex(Int(Random(0,255, 1)),2) & Hex(Int(Random(0,255, 1)),2) & Hex(Int(Random(0,255, 1)),2))
    EndIf

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

    _ProgressSet($PRO[0], $PER)
    _ProgressSet($PRO[1], 1 - $PER)
    _ProgressSet($PRO[2], $PER/2)

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

    _ProgressDraw($GFX, $W / 4, $H / 3 + 25, 250, 35, $PRO[0])
    _ProgressDraw($GFX, $W / 4 * 3, $H / 2 + 25, 150, 45, $PRO[1])
    _ProgressDraw($GFX, $W / 2, $H / 4 * 3 + 25, 150, 15, $PRO[2])

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

    _WinAPI_BitBlt($DC, 0, 50, $W, $H - 50, $BUF, 0, 50, 0xCC0020)

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

    WEnd

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

    Func _ProgressGet($aProgress)
    Return $aProgress[9]
    EndFunc

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

    Func _ProgressSet(ByRef $aProgress, $nPercent)
    If $nPercent <= 1 Then
    $aProgress[9] = $nPercent
    Else
    $aProgress[9] = $nPercent / 100
    EndIf
    EndFunc

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

    Func _ProgressSetDesign(ByRef $aProgress, $iAnzahl = 0, $nDist = 0, $nAniTempo = 0, $iCol = 0, $iColIdle = 0, $iStartTrans = 0, $iPos = 0)
    If $iCol Then $aProgress[1] = StringRight(Hex($iCol, 8), 6) ; Farbe des Ladebalkens (Alpha wird ignoriert), möglich ist also 0xFFAARRGGBB oder 0xRRGGBB
    If $iColIdle Then $aProgress[2] = $iColIdle ; Farbe der nicht benutzen Flächen (Alpha ist relevant !)
    If $iPos Then $aProgress[4] = $iPos ; Animationscounter (drehanimation)
    If $iAnzahl Then $aProgress[5] = $iAnzahl ; Anzahl Segmente für den Ladebalken
    If $nDist Then $aProgress[6] = 360 - 3.6 * $nDist ; Abstand zwischen den Segmenten (0 < $nDist < 100)
    If $nAniTempo Then $aProgress[7] = $nAniTempo ; Drehgeschwindigkeit in Grad/Frame. (negativer Wert = drehung gegen deh Uhrzeigersinn)
    If $iStartTrans Then $aProgress[8] = $iStartTrans ; Starttransparenz des Segments bei Färbebeginn
    EndFunc ;==>_ProgressSet

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

    Func _ProgressCreate($iAnzahl = 9, $nDist = 10, $nAniTempo = 0.25, $iCol = 0xFF4080FF, $iColIdle = 0x20808080, $iStartTrans = 32, $iStartPos = 0)
    If Not $iStartPos Then $iStartPos = Random(0, 360)
    Local $a[10]
    $a[0] = _GDIPlus_PenCreate() ; GDI+ Pen
    $a[1] = StringRight(Hex($iCol, 8), 6) ; Farbe des Ladebalkens (Alpha wird ignoriert), möglich ist also 0xFFAARRGGBB oder 0xRRGGBB
    $a[2] = $iColIdle ; Farbe der nicht benutzen Flächen (Alpha ist relevant !)
    $a[3] = 0 ; Animationscounter (100% Animation)
    $a[4] = $iStartPos ; Animationscounter (drehanimation)
    $a[5] = $iAnzahl ; Anzahl Segmente für den Ladebalken
    $a[6] = 360 - 3.6 * $nDist ; Abstand zwischen den Segmenten (0 < $nDist < 100)
    $a[7] = $nAniTempo ; Drehgeschwindigkeit in Grad/Frame. (negativer Wert = drehung gegen deh Uhrzeigersinn)
    $a[8] = $iStartTrans ; Starttransparenz des Segments bei Färbebeginn
    $a[9] = 0 ; Prozentwert von 0 bis 1
    Return $a
    EndFunc ;==>_ProgressCreate

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

    Func _ProgressDraw($hGfx, $mx, $my, $d1, $d2, ByRef $aProgress)
    $aProgress[4] += $aProgress[7]
    Local $nPercent = $aProgress[9], $a, $b = 360 * $nPercent, $c, $d = $aProgress[6] / $aProgress[5], $e = $d1 / 50, $f = ($nPercent = 1), $g = $aProgress[4] - Int($aProgress[4]/360)*360
    If $f Then
    If $aProgress[3] < 15 Then $aProgress[3] += 1
    $d2 *= 0.97 ^ $aProgress[3]
    $aProgress[4] += $aProgress[7] * 1.1 ^ $aProgress[3]
    Else
    If $aProgress[3] > 0 Then
    $aProgress[3] -= 1
    $d2 *= 0.97 ^ $aProgress[3]
    $aProgress[4] += $aProgress[7] * 1.1 ^ $aProgress[3]
    EndIf
    EndIf
    For $i = 0 To $aProgress[5] - 1 Step 1
    $a = $i * 360 / $aProgress[5] + $g
    If $b >= 360 / $aProgress[5] Then
    $c = 1
    $b -= 360 / $aProgress[5]
    Else
    $c = $b / (360 / $aProgress[5])
    EndIf
    Switch $c
    Case 0
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], $aProgress[2])
    Case 0 To 0.33
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x' & Hex(Int($c * 3 * (128-$aProgress[8])+ $aProgress[8]), 2) & $aProgress[1])
    Case 0.33 To 0.66
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x80' & $aProgress[1])
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2 / 2, $a, $d, $aProgress[0], '0x' & Hex(Int(($c - 0.33) * 150), 2) & 'FFFFFF')
    Case 0.66 To 0.99
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x80' & $aProgress[1])
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2 / 2, $a, $d, $aProgress[0], '0x32FFFFFF')
    _ProgressDrawPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x' & Hex(Int(($c - 0.66) * 384), 2) & $aProgress[1], 3)
    Case 0.99 To 1
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x80' & $aProgress[1])
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2 / 2, $a, $d, $aProgress[0], '0x32FFFFFF')
    _ProgressDrawPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0x80' & $aProgress[1], 3)
    If $f Then _ProgressDrawPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0], '0xFF' & $aProgress[1], $e / 3)
    EndSwitch
    If $c < 1 Then
    DllCall($ghGDIPDll, 'int', 'GdipSetPenColor', 'handle', $aProgress[0], 'dword', $aProgress[2])
    DllCall($ghGDIPDll, 'int', 'GdipSetPenWidth', 'handle', $aProgress[0], 'float', $d2)
    For $j = $i + 1 To $aProgress[5] - 1 Step 1
    $a = $j * 360 / $aProgress[5] + $aProgress[4]
    $a -= Int($a / 360) * 360
    _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $a, $d, $aProgress[0])
    Next
    ExitLoop
    EndIf
    Next
    EndFunc ;==>_ProgressDraw

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

    Func _ProgressDelete(ByRef $aProgress)
    _GDIPlus_PenDispose($aProgress[0])
    $aProgress = 0
    EndFunc ;==>_ProgressDelete

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

    Func _ProgressDrawPieSegment($hGfx, $mx, $my, $d1, $d2, $fStart, $fSweep, $hPen, $iCol, $dPen)
    DllCall($ghGDIPDll, 'int', 'GdipSetPenColor', 'handle', $hPen, 'dword', $iCol)
    DllCall($ghGDIPDll, 'int', 'GdipSetPenWidth', 'handle', $hPen, 'float', $dPen)
    DllCall($ghGDIPDll, 'int', 'GdipDrawArc', 'handle', $hGfx, 'handle', $hPen, 'float', $mx - $d1 / 2, 'float', $my - $d1 / 2, 'float', $d1, 'float', $d1, 'float', $fStart + ($dPen / ($d1 * $PI)) * 180, 'float', $fSweep - ($dPen / ($d1 * $PI)) * 360)
    DllCall($ghGDIPDll, 'int', 'GdipDrawArc', 'handle', $hGfx, 'handle', $hPen, 'float', $mx - $d1 / 2 + $d2, 'float', $my - $d1 / 2 + $d2, 'float', $d1 - $d2 * 2, 'float', $d1 - $d2 * 2, 'float', $fStart + ($dPen / (($d1 - $d2) * $PI)) * 180, 'float', $fSweep - ($dPen / (($d1 - $d2) * $PI)) * 360)
    DllCall($ghGDIPDll, 'int', 'GdipDrawLine', 'handle', $hGfx, 'handle', $hPen, 'float', $mx + ($d1 - $d2 * 2 - $dPen) / 2 * Cos($fStart * $Deg2Rad), 'float', $my + ($d1 - $d2 * 2 - $dPen) / 2 * Sin($fStart * $Deg2Rad), 'float', $mx + ($d1 + $dPen) / 2 * Cos($fStart * $Deg2Rad), 'float', $my + ($d1 + $dPen) / 2 * Sin($fStart * $Deg2Rad))
    DllCall($ghGDIPDll, 'int', 'GdipDrawLine', 'handle', $hGfx, 'handle', $hPen, 'float', $mx + ($d1 - $d2 * 2 - $dPen) / 2 * Cos(($fStart + $fSweep) * $Deg2Rad), 'float', $my + ($d1 - $d2 * 2 - $dPen) / 2 * Sin(($fStart + $fSweep) * $Deg2Rad), 'float', $mx + ($d1 + $dPen) / 2 * Cos(($fStart + $fSweep) * $Deg2Rad), 'float', $my + ($d1 + $dPen) / 2 * Sin(($fStart + $fSweep) * $Deg2Rad))
    EndFunc ;==>_ProgressDrawPieSegment

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

    Func _ProgressFillPieSegment($hGfx, $mx, $my, $d1, $d2, $fStart, $fSweep, $hPen, $iCol = 0)
    If Not $iCol Then Return DllCall($ghGDIPDll, 'int', 'GdipDrawArc', 'handle', $hGfx, 'handle', $hPen, 'float', $mx - $d1 / 2 + $d2 / 2, 'float', $my - $d1 / 2 + $d2 / 2, 'float', $d1 - $d2, 'float', $d1 - $d2, 'float', $fStart, 'float', $fSweep)
    DllCall($ghGDIPDll, 'int', 'GdipSetPenColor', 'handle', $hPen, 'dword', $iCol)
    DllCall($ghGDIPDll, 'int', 'GdipSetPenWidth', 'handle', $hPen, 'float', $d2)
    DllCall($ghGDIPDll, 'int', 'GdipDrawArc', 'handle', $hGfx, 'handle', $hPen, 'float', $mx - $d1 / 2 + $d2 / 2, 'float', $my - $d1 / 2 + $d2 / 2, 'float', $d1 - $d2, 'float', $d1 - $d2, 'float', $fStart, 'float', $fSweep)
    EndFunc ;==>_ProgressFillPieSegment

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

    Func _Image_Create($iW, $iH)
    Local $Ptr, $hDC, $hBmp, $tBMI, $aDIB, $vStruct
    $hDC = _WinAPI_CreateCompatibleDC(0)
    $tBMI = DllStructCreate($tagBITMAPINFO)
    DllStructSetData($tBMI, 'Size', DllStructGetSize($tBMI) - 4)
    DllStructSetData($tBMI, 'Width', $iW)
    DllStructSetData($tBMI, 'Height', -$iH)
    DllStructSetData($tBMI, 'Planes', 1)
    DllStructSetData($tBMI, 'BitCount', 32)
    $aDIB = DllCall('GDI32.DLL', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'uint', 0)
    $hBmp = $aDIB[0]
    $Ptr = $aDIB[4]
    _WinAPI_SelectObject($hDC, $hBmp)
    $vStruct = DllStructCreate('int[5]')
    DllStructSetData($vStruct, 1, $hDC, 1)
    DllStructSetData($vStruct, 1, $iW, 2)
    DllStructSetData($vStruct, 1, $iH, 3)
    DllStructSetData($vStruct, 1, $Ptr, 4)
    DllStructSetData($vStruct, 1, $hBmp, 5)
    Return $vStruct
    EndFunc;==>_Image_Create

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

    Func _Image_Delete(ByRef $vStruct)
    _WinAPI_DeleteObject(DllStructGetData($vStruct, 1, 5))
    _WinAPI_DeleteDC(DllStructGetData($vStruct, 1, 1))
    $vStruct = 0
    EndFunc ;==>_Image_Delete

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

    Func _Event()
    Exit
    EndFunc ;==>_Event

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

    Func _Dispose()
    For $i = 0 To UBound($PRO) - 1 Step 1
    _ProgressDelete($PRO[$i])
    Next
    _Image_Delete($IMG)
    _WinAPI_ReleaseDC($GUI, $DC)
    _GDIPlus_GraphicsDispose($GFX)
    _GDIPlus_Shutdown()
    EndFunc ;==>_Dispose

    [/autoit]


    lg
    Mars

  • GDI+ - Skript beschleunigen und Linien abrunden

    • Mars
    • 1. April 2013 um 21:54

    1. Arrayfunktionen sind immer relativ langsam (je größer das Array, desto langsamer)
    Das liegt daran, dass Arrays einen festen Peicherplatz belegen. Bei jeder Größenänderung mit Redim (in Add und Delete vorhanden) wird das komplette Array kopiert.
    2. DrawImageRect langsamer als DrawImage langsamer als BitBlt (erfordert einige Umstellung im Skript)
    3. Pencreate + Pendispose langsamer als PenSetCol (lieber nur einen Pen nutzen un den immer färben, statt andauernd neue zu erstellen und zu löschen)

  • [GDI+] Rotierende Kreisausschnittsegmente

    • Mars
    • 1. April 2013 um 02:44

    Hab grade noch eine Kleinigkeit geändert, usprünglich war die Segmentfunktion nicht für viele gleichfarbige gleichdicke Segmente gedacht.
    In diesem Speziellen Fall kann man also das Dicke und Farbe einstellen aus der Schleife rausziehen, wodurch sich die Geschwindigkeit stark erhöht.
    Bei mir läufts jetzt ca. 40% schneller als vorher. (Auf der Schrottmühle läuft das was ich im ersten Post eingefügt habe noch annehmbar flüssig)
    Als Sperrbildschirm brauchts somit eine ganze Ecke weniger CPU,

  • [GDI+] Rotierende Kreisausschnittsegmente

    • Mars
    • 1. April 2013 um 01:58
    Zitat von minx

    Mars Cooler Trick zum Zeichnen der Elemente :D

    Genau die Funktion (Zeichnen eines PieSegments mit GDI+) habe ich gesucht.
    Nachdem Google und Konsorten keine Antwort liefern konnten musste der Pen herhalten.
    Ist leider nicht optimal, da man so keine Ausschnitte "zeichnen" (also mit einer Linie) kann. Dazu würden 2 DrawArc + 2x DrawLine gebraucht.
    Im Endeffekt würde es in _GDIPlus_GraphicsFillPieSegment und _DrawPieSegment enden. Wobei beide seltsamerweise mit einem Pen funktionieren würden.

    Edit: Mit 20 Stück im Vollbild bekommt man ja n epilleptischen Anfall^^

  • [GDI+] Rotierende Kreisausschnittsegmente

    • Mars
    • 31. März 2013 um 20:58

    Moin,

    Motiviert durch die gestrigen Animationen habe ich heute eine kleine Animation gebastelt.
    Auf meinem Minirechner (hat keine Graka und nur einen IntelAtom) läuft der Spaß mehr oder weniger flüssig, wenns bei euch schneller ist könnt ihr die Größe erhöhen und die Anzahl hochschrauben.

    AutoIt
    #include <GDIPlus.au3>
    
    Opt('GUIOnEventMode', 1)
    
    Global Const $W = @DesktopWidth / 3 * 2, $H = @DesktopHeight / 3 * 2
    Global Const $Anzahl = 12
    
    
    Global $PEN, $GFX, $BUF, $BMP, $GUI, $TWI[$Anzahl], $BRU
    
    Global Enum $CNT, $COL, $ANZ, $OFF, $DIS, $ROT, $DIA, $WID, $RAN, _
            $ROT_End, $ROT_DisMul, $ROT_OffMul, $ROT_Dir, $DIR, $COL_Add
    
    _GDIPlus_Startup()
    $GUI = GUICreate('Test', $W, $H)
    $GFX = _GDIPlus_GraphicsCreateFromHWND($GUI)
    $BMP = _GDIPlus_BitmapCreateFromGraphics($W, $H, $GFX)
    $BUF = _GDIPlus_ImageGetGraphicsContext($BMP)
    $PEN = _GDIPlus_PenCreate()
    $BRU = _GDIPlus_BrushCreateSolid(0x30000000)
    _GDIPlus_GraphicsSetSmoothingMode($BUF, 2)
    
    For $i = 1 To $Anzahl Step 1
        $TWI[$i - 1] = _CreateTwister(60 + $i ^ 1.4 * 15, 6 + $i ^ 0.8 * Random(2, 4))
    Next
    
    OnAutoItExitRegister('_Dispose')
    GUISetOnEvent(-3, '_Event', $GUI)
    GUISetState(@SW_SHOW, $GUI)
    
    While Sleep(10)
        _GDIPlus_GraphicsFillRect($BUF, 0, 0, $W, $H, $BRU)
        For $i = 0 To $Anzahl - 1 Step 1
            _Twister($TWI[$i])
        Next
        _GDIPlus_GraphicsDrawImage($GFX, $BMP, 0, 0)
    WEnd
    
    Func _CreateTwister($_DIA, $_WID)
        Local $a[15]
        $a[$ANZ] = Random(6, 15, 1)
        $a[$CNT] = Random(-555555, 555555)
        $a[$COL] = 0
        $a[$OFF] = 0
        $a[$DIS] = 0
        $a[$ROT] = 0
        $a[$DIA] = $_DIA
        $a[$WID] = $_WID
        $a[$ROT_End] = 0
        $a[$ROT_OffMul] = 0
        $a[$ROT_DisMul] = 0
        $a[$ROT_Dir] = 0
        $a[$RAN] = Random(10, 20, 1)
        $a[$DIR] = Random(-2.5, 2.5)
        $a[$COL_Add] = Random(0, 10000)
        Return $a
    EndFunc   ;==>_CreateTwister
    
    
    Func _Twister(ByRef $a)
    
        $a[$CNT] += $a[$DIR]
        $a[$COL_Add] += 2
        $a[$COL] = '0xAA' & Hex(Int(Sin(($a[$COL_Add] + $a[$CNT]) / 100) * 127.9 + 128), 2) & Hex(Int(Sin(($a[$COL_Add] + $a[$CNT]) / 150) * 127.9 + 128), 2) & Hex(Int(Cos(($a[$COL_Add] + $a[$CNT]) / 120) * 127.9 + 128), 2)
    
        If $a[$ROT] Then
            If Not $a[$ROT_End] Then
                $a[$ROT_End] = Random(240, 480)
                $a[$ROT_DisMul] = Random(0.7, 2)
                $a[$ROT_OffMul] = Random(0.4, 2)
                $a[$ROT_Dir] = Random(0, 1, 1)
            EndIf
            If $a[$ROT] > $a[$ROT_End] Then
                $a[$ROT] /= 1.5
                $a[$ROT_End] /= 1.5
                If Round($a[$ROT], 0) = 0 Then
                    $a[$ROT_End] = 0
                    $a[$ROT] = 0
                    $a[$RAN] = Random(10, 20, 1)
                EndIf
            Else
                $a[$ROT] += $a[$ROT] ^ 0.3
            EndIf
            $a[$DIS] = ($a[$DIS] * 6 + $a[$DIS] / $a[$ROT_DisMul]) / 7
            $a[$OFF] = ($a[$OFF] * 7 + $a[$OFF] / $a[$ROT_OffMul]) / 8
            If Not Random(0, 100, 1) Then
                $a[$ANZ] += Random(-1, 1, 1)
                If $a[$ANZ] < 5 Then $a[$ANZ] = 5
                If $a[$ANZ] > 16 Then $a[$ANZ] = 16
            EndIf
        Else
            If IsInt(Int($a[$CNT]) / $a[$RAN]) Then $a[$ROT] += 2
        EndIf
    
        If Not Random(0, 100, 1) Then $a[$DIR] = Random(-2.5, 2.5)
    
        $a[$DIS] = ($a[$DIS] * 9 + $a[$WID]) / 10
        $a[$OFF] = ($a[$OFF] * 8 + $a[$DIA]) / 9
    
        DllCall($__g_hGDIPDll, 'int', 'GdipSetPenColor', 'handle', $PEN, 'dword', $a[$COL])
        DllCall($__g_hGDIPDll, 'int', 'GdipSetPenWidth', 'handle', $PEN, 'float', $a[$DIS])
    
    
        For $i = 0 To $a[$ANZ] - 1 Step 1
            _PieSegment($BUF, $W / 2, $H / 2, $a[$OFF], $a[$OFF], $a[$DIS], $i * 360 / $a[$ANZ] + $a[$CNT] + ($a[$ROT_Dir] = 0) * $a[$ROT] * 2 - $a[$ROT], 300 / $a[$ANZ], $a[$COL])
        Next
    
    EndFunc   ;==>_Twister
    
    
    Func _PieSegment($GFX, $mX, $mY, $W, $H, $D, $fStart, $fSweep, $iCol)
        DllCall($__g_hGDIPDll, 'int', 'GdipDrawArc', 'handle', $GFX, 'handle', $PEN, 'float', $mX + $D / 2 - $W / 2, 'float', $mY + $D / 2 - $H / 2, 'float', $W - $D, 'float', $H - $D, 'float', $fStart, 'float', $fSweep)
    EndFunc   ;==>_PieSegment
    
    Func _Event()
        Exit
    EndFunc   ;==>_Event
    
    Func _Dispose()
        _GDIPlus_BrushDispose($BRU)
        _GDIPlus_GraphicsDispose($GFX)
        _GDIPlus_GraphicsDispose($BUF)
        _GDIPlus_BitmapDispose($BMP)
        _GDIPlus_PenDispose($PEN)
        _GDIPlus_Shutdown()
    EndFunc   ;==>_Dispose
    Alles anzeigen

    Edit: 28.09.18: Das skript hat es (wahrscheinlich vor langer Zeit) zerschossen, habe es repariert.

    lg

    Mars

  • [3.3.9.5] Fragen zu Strukturen

    • Mars
    • 28. März 2013 um 19:03
    Zitat von BugFix

    Ich weiß nicht ob es sinnvoll ist, sich mit dieser (zurückgezogenen) Beta auseinanderzusetzen. Im Moment weiß niemand wohin die Reise geht. Ich würde also erstmal abwarten was denn tatsächlich Einzug in die nächste Version hält.


    Genau diese Tatsache ist grausam. Wenn der Kram nicht unterstützt wird, update ich nicht.
    Aus dem einfachen Grund: Angenommen die (neue) 9.5 enthält diese Erweiterungen nicht, was enthält sie dann außer Bugfixes die mich nicht betreffen ?
    Habe bisher kaum "echte" Bugs in AutoIt gehabt. Also nichts was sich nicht beheben ließe.

  • [C“ 2013] The winners!

    • Mars
    • 20. März 2013 um 23:48

    Na die anderen waren ja nicht sooo heiß im Bewerten^^

  • 3D-Objekte mit GDI+

    • Mars
    • 19. März 2013 um 23:03
    Überraschung ;)
    Code
    p0:0/-3.5/-3
    p1:0.1/-3.5/-3
    p2:0.1/-3.5/-2
    p3:0.1/1.5/-2
    p4:0.1/1.5/-3
    p5:0/1.5/-3
    p6:0/1.5/-2
    p7:0/-3.5/-2
    l:0-1
    l:0-5
    l:0-7
    l:3-2
    l:3-4
    l:3-6
    l:1-2
    l:1-4
    l:2-7
    l:4-5
    l:5-6
    l:6-7
    p8:0/-1.5/-2
    p9:0.1/-1.5/-2
    p10:0.1/-1.5/3
    p11:0.1/-0.5/3
    p12:0.1/-0.5/-2
    p13:0/-0.5/-2
    p14:0/-0.5/3
    p15:0/-1.5/3
    l:8-9
    l:8-13
    l:8-15
    l:11-10
    l:11-12
    l:11-14
    l:9-10
    l:9-12
    l:10-15
    l:12-13
    l:13-14
    l:14-15
    p16:0/-6.5/-1
    p17:0.1/-6.5/-1
    p18:0.1/-6.5/3
    p19:0.1/-5.5/3
    p20:0.1/-5.5/-1
    p21:0/-5.5/-1
    p22:0/-5.5/3
    p23:0/-6.5/3
    l:16-17
    l:16-21
    l:16-23
    l:19-18
    l:19-20
    l:19-22
    l:17-18
    l:17-20
    l:18-23
    l:20-21
    l:21-22
    l:22-23
    p24:0/-5.5/2
    p25:0.1/-5.5/2
    p26:0.1/-5.5/3
    p27:0.1/-3.5/3
    p28:0.1/-3.5/2
    p29:0/-3.5/2
    p30:0/-3.5/3
    p31:0/-5.5/3
    l:24-25
    l:24-29
    l:24-31
    l:27-26
    l:27-28
    l:27-30
    l:25-26
    l:25-28
    l:26-31
    l:28-29
    l:29-30
    l:30-31
    p32:0/-3.5/-1
    p33:0.1/-3.5/-1
    p34:0.1/-3.5/3
    p35:0.1/-2.5/3
    p36:0.1/-2.5/-1
    p37:0/-2.5/-1
    p38:0/-2.5/3
    p39:0/-3.5/3
    l:32-33
    l:32-37
    l:32-39
    l:35-34
    l:35-36
    l:35-38
    l:33-34
    l:33-36
    l:34-39
    l:36-37
    l:37-38
    l:38-39
    p40:0/0.5/-1
    p41:0.1/0.5/-1
    p42:0.1/0.5/3
    p43:0.1/1.5/3
    p44:0.1/1.5/-1
    p45:0/1.5/-1
    p46:0/1.5/3
    p47:0/0.5/3
    l:40-41
    l:40-45
    l:40-47
    l:43-42
    l:43-44
    l:43-46
    l:41-42
    l:41-44
    l:42-47
    l:44-45
    l:45-46
    l:46-47
    p48:0/1.5/-1
    p49:0.1/1.5/-1
    p50:0.1/1.5/0
    p51:0.1/3.5/0
    p52:0.1/3.5/-1
    p53:0/3.5/-1
    p54:0/3.5/0
    p55:0/1.5/0
    l:48-49
    l:48-53
    l:48-55
    l:51-50
    l:51-52
    l:51-54
    l:49-50
    l:49-52
    l:50-55
    l:52-53
    l:53-54
    l:54-55
    p56:0/1.5/2
    p57:0.1/1.5/2
    p58:0.1/1.5/3
    p59:0.1/3.5/3
    p60:0.1/3.5/2
    p61:0/3.5/2
    p62:0/3.5/3
    p63:0/1.5/3
    l:56-57
    l:56-61
    l:56-63
    l:59-58
    l:59-60
    l:59-62
    l:57-58
    l:57-60
    l:58-63
    l:60-61
    l:61-62
    l:62-63
    p64:0/3.5/-1
    p65:0.1/3.5/-1
    p66:0.1/3.5/3
    p67:0.1/4.5/3
    p68:0.1/4.5/-1
    p69:0/4.5/-1
    p70:0/4.5/3
    p71:0/3.5/3
    l:64-65
    l:64-69
    l:64-71
    l:67-66
    l:67-68
    l:67-70
    l:65-66
    l:65-68
    l:66-71
    l:68-69
    l:69-70
    l:70-71
    p72:0/5.5/-3
    p73:0.1/5.5/-3
    p74:0.1/5.5/-2
    p75:0.1/8.5/-2
    p76:0.1/8.5/-3
    p77:0/8.5/-3
    p78:0/8.5/-2
    p79:0/5.5/-2
    l:72-73
    l:72-77
    l:72-79
    l:75-74
    l:75-76
    l:75-78
    l:73-74
    l:73-76
    l:74-79
    l:76-77
    l:77-78
    l:78-79
    p80:0/6.5/-2
    p81:0.1/6.5/-2
    p82:0.1/6.5/2
    p83:0.1/7.5/2
    p84:0.1/7.5/-2
    p85:0/7.5/-2
    p86:0/7.5/2
    p87:0/6.5/2
    l:80-81
    l:80-85
    l:80-87
    l:83-82
    l:83-84
    l:83-86
    l:81-82
    l:81-84
    l:82-87
    l:84-85
    l:85-86
    l:86-87
    p88:0/5.5/2
    p89:0.1/5.5/2
    p90:0.1/5.5/3
    p91:0.1/8.5/3
    p92:0.1/8.5/2
    p93:0/8.5/2
    p94:0/8.5/3
    p95:0/5.5/3
    l:88-89
    l:88-93
    l:88-95
    l:91-90
    l:91-92
    l:91-94
    l:89-90
    l:89-92
    l:90-95
    l:92-93
    l:93-94
    l:94-95
    p96:0/9.5/-3
    p97:0.1/9.5/-3
    p98:0.1/9.5/-1
    p99:0.1/10.5/-1
    p100:0.1/10.5/-3
    p101:0/10.5/-3
    p102:0/10.5/-1
    p103:0/9.5/-1
    l:96-97
    l:96-101
    l:96-103
    l:99-98
    l:99-100
    l:99-102
    l:97-98
    l:97-100
    l:98-103
    l:100-101
    l:101-102
    l:102-103
    p104:0/8.5/-1
    p105:0.1/8.5/-1
    p106:0.1/8.5/0
    p107:0.1/11.5/0
    p108:0.1/11.5/-1
    p109:0/11.5/-1
    p110:0/11.5/0
    p111:0/8.5/0
    l:104-105
    l:104-109
    l:104-111
    l:107-106
    l:107-108
    l:107-110
    l:105-106
    l:105-108
    l:106-111
    l:108-109
    l:109-110
    l:110-111
    p112:0/9.5/0
    p113:0.1/9.5/0
    p114:0.1/9.5/3
    p115:0.1/10.5/3
    p116:0.1/10.5/0
    p117:0/10.5/0
    p118:0/10.5/3
    p119:0/9.5/3
    l:112-113
    l:112-117
    l:112-119
    l:115-114
    l:115-116
    l:115-118
    l:113-114
    l:113-116
    l:114-119
    l:116-117
    l:117-118
    l:118-119
    p120:0/-11.5/-3
    p121:0.1/-11.5/-3
    p122:0.1/-11.5/3
    p123:0.1/-10.5/3
    p124:0.1/-10.5/-3
    p125:0/-10.5/-3
    p126:0/-10.5/3
    p127:0/-11.5/3
    l:120-121
    l:120-125
    l:120-127
    l:123-122
    l:123-124
    l:123-126
    l:121-122
    l:121-124
    l:122-127
    l:124-125
    l:125-126
    l:126-127
    p128:0/-8.5/-3
    p129:0.1/-8.5/-3
    p130:0.1/-8.5/3
    p131:0.1/-7.5/3
    p132:0.1/-7.5/-3
    p133:0/-7.5/-3
    p134:0/-7.5/3
    p135:0/-8.5/3
    l:128-129
    l:128-133
    l:128-135
    l:131-130
    l:131-132
    l:131-134
    l:129-130
    l:129-132
    l:130-135
    l:132-133
    l:133-134
    l:134-135
    p136:0/-10.5/-3
    p137:0.1/-10.5/-3
    p138:0.1/-10.5/-2
    p139:0.1/-8.5/-2
    p140:0.1/-8.5/-3
    p141:0/-8.5/-3
    p142:0/-8.5/-2
    p143:0/-10.5/-2
    l:136-137
    l:136-141
    l:136-143
    l:139-138
    l:139-140
    l:139-142
    l:137-138
    l:137-140
    l:138-143
    l:140-141
    l:141-142
    l:142-143
    p144:0/-10.5/0
    p145:0.1/-10.5/0
    p146:0.1/-10.5/1
    p147:0.1/-8.5/1
    p148:0.1/-8.5/0
    p149:0/-8.5/0
    p150:0/-8.5/1
    p151:0/-10.5/1
    l:144-145
    l:144-149
    l:144-151
    l:147-146
    l:147-148
    l:147-150
    l:145-146
    l:145-148
    l:146-151
    l:148-149
    l:149-150
    l:150-151
    Alles anzeigen
    Spoiler anzeigen
    Code
    Würfel(-3.5,-3,0,5,1,0.1)
    Würfel(-1.5,-2,0,1,5,0.1)
    Würfel(-6.5,-1,0,1,4,0.1)
    Würfel(-5.5, 2,0,2,1,0.1)
    Würfel(-3.5,-1,0,1,4,0.1)
    Würfel( 0.5,-1,0,1,4,0.1)
    Würfel( 1.5,-1,0,2,1,0.1)
    Würfel( 1.5, 2,0,2,1,0.1)
    Würfel( 3.5,-1,0,1,4,0.1)
    Würfel( 5.5,-3,0,3,1,0.1)
    Würfel( 6.5,-2,0,1,4,0.1)
    Würfel( 5.5, 2,0,3,1,0.1)
    Würfel( 9.5,-3,0,1,2,0.1)
    Würfel( 8.5,-1,0,3,1,0.1)
    Würfel( 9.5, 0,0,1,3,0.1)
    Würfel(-11.5,-3,0,1,6,0.1)
    Würfel(-8.5,-3,0,1,6,0.1)
    Würfel(-10.5,-3,0,2,1,0.1)
    Würfel(-10.5, 0,0,2,1,0.1)
    Alles anzeigen
  • 3D-Objekte mit GDI+

    • Mars
    • 19. März 2013 um 22:25

    Sooo hier schonmal ein Tool um Würfel zu generieren.

    Tool
    [autoit]


    ; Würfel($x, $y, $z, $dx, $dy, $dz)
    Local $s = 'Würfel(-1,-1,-1,2,2,2)' & @CRLF & 'Würfel(-0.5,-0.5,-0.5,1,1,1)'

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

    ConsoleWrite(_Translate($s) & @CRLF)

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

    Func _Translate($s)
    ; Punkte - pn:x/y/z
    ; Linie - l:a-b
    ; Punkte haben Koordinaten
    ; Linien haben Punkte als Start und Ende
    Local $r = '', $a = StringSplit(StringReplace($s, @CR, '', 0, 1), @LF, 2), $u = UBound($a), $PunktNr = 0, $p, $l1 = '111444223567', $l2 = '268357358678'

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

    For $i = 0 To $u - 1 Step 1
    $p = StringSplit($a[$i], '(', 2)
    Switch $p[0]
    Case 'Würfel'
    $p = StringSplit(StringTrimRight($p[1],1), ',', 2)
    For $e = 0 To 7 Step 1
    $r &= 'p' & $PunktNr & ':' & $p[0] + $p[3] * ($e>0 and $e<5) & '/' & $p[1] + $p[4] * ($e>2 and $e<7) & '/' & $p[2] + $p[5] * (IsInt(($e+2)/4) Or IsInt(($e+1)/4)) & @CRLF
    $PunktNr += 1
    Next
    For $e = 1 To 12 Step 1
    $r &= 'l:' & $PunktNr + StringMid($l1, $e, 1) - 9 & '-' & $PunktNr + StringMid($l2, $e, 1) - 9 & @CRLF
    Next
    Case 'WasAuchImmer'

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

    EndSwitch
    Next

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

    Return $r
    EndFunc

    [/autoit]


    .
    .

  • 3D-Objekte mit GDI+

    • Mars
    • 19. März 2013 um 21:19

    Es gibt doch ein ganz ähnliches 3D Format. kann man dafür nicht einen Konverter bauen ?
    Dann könntest du schön komplexe Sachen zeichnen lassen.

    Performance lässt sich noch etwas steigern:
    - Nur repaint, wenn es nötig ist
    - Funktionen durch den DllCall ersetzen (Dadurch entfällt das DefPen erstellen usw)
    - DrawStringEx nehmen. (nur den DllCall). das ist 10x so schnell wie DrawString
    - Timer statt Adlib

  • 3D-Objekte mit GDI+

    • Mars
    • 19. März 2013 um 21:11

    Ganz großen Daumen hoch. :D

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™