• Zitat

    Edit: Wie findet man eigentlich solche Formeln? Bin grade auf der Suche danach, Interessiert mich nähmlich sehr

    einfach rumexperimentieren, oder von irgendwem schon fertige "Formeln" übernehmen und damit weiterexperimentieren...
    Das läuft dann meist unter Fraktale. Als Startwert kann man dann z.B. die aktuelle Aussteuerung von gleichzeitig abgespielter Musik nehmen, das gibt dann feine Effekte.
    Jetzt noch den "inner Loop" als c++ oder asm-funktion realisiert, und man bekommt auch schnelle Bilder!

    Btw., wie wäre es, wenn die c++-Spezialisten mal ein Grundgerüst dieses "inner loops" (in einer dll) schreiben würden! So dass man nur noch die 3-4 Zeilen Berechnungen einfügen muss. Das wäre dann bestimmt einfacher zu realisieren und würde mit Sicherheit auch mehr Leute ansprechen wie eine ASM-Funktion :D. Da ja Visual C++ Express kostenlos und weit verbreitet ist, würde es sich anbieten.
    So könnte man in AutoIt mit den Formeln experimentieren und nachher die fertigen Funktion(en) einfach in C übertragen und den "inner loop" aus der dll aufrufen. Das sollten auch Nicht-C++ler (so wie ich ^^) hinbekommen.

  • Ich versuche gerade mit ASM die Bilder zu erstellen, aber ich erreich dich nie, ich brauch Hilfe :P
    Im moment funktioniert fbld edx nicht, weißt du was da falsch ist?

    EDIT: fertig, siehe Skripte > Zufallsmuster

    Einmal editiert, zuletzt von TheShadowAE (7. Februar 2011 um 13:00)


  • Ich mein aber letzten endes landet ja doch die vollte datenmänge auf dem AB also legen wir uns 20 GB davon an :).
    Aber mal spaß bei seite klar ist sowas ne fette leistung.
    Yedoch find ich schon auch okey das man das in "großen" datein speichert.
    Ich will ja keinen 2 GHerz Qaudcore in meinem Auto haben müssen um mir Filme flüssig anschauen zu können :)

  • Die Prozessorleistung wird heutzutage eh meist nur von Sachen verbraucht die sie garnicht brauchen. (schlecht programmierte Spiele und sonstige Hintergrundprogramme). Da ist es doch angebracht endlich mal was zu entwickeln wo diese Rechenleistung sinnvoll zum Einsatz kommt.

    Das Zeug kommt (wenn das Programm flott genug läuft) nicht komplett ins Ram. Und das was rein kommt braucht genau so viel Speicher wie ein Normales Bild was man von der hd läd. Also hat man in meinem Fall einen Nachteil.

    ein Weiterer Vorteil ist, dass man animierte Texturen nutzen kann. Wenn man bei der herstellung die Parameter etwas verändert kann das zu tollen Effekten führen, die mit bitmap-Texturen nicht möglich sind.

    Es ist also auf jeden Fall wert was es ist !

  • Ich vermute, daß in diesem Sinne garkeine verwendbaren "Bitmaps" generiert werden, sondern die Shader anhand einer "Vorschrift" (wie ein Fraktal) das nächste Bild aus dem vorherigen Bild erzeugen. Im Framebuffer der Grafikkarte also. Daher kann man natürlich auch nicht vor- oder zurückspulen!
    Weiterhin ist es so, dass die Renderengine (auch bei den 4K-Demos) mit im Code steckt! Die Engine selbst ist nur 200-300Byte gross!
    Mittlerweile gibt es Diskussionen, ob "externe" API-Calls erlaubt sein sollten. Bei den Cracks herrscht aber die einhellige Meinung, dass eine Demo nicht besser würde, nur weil man 200 Bytes im Quellcode spart!

    Übrigens gute Nachrichten an die C-Coder! Heutzutage sind die meisten Demos mit C geschrieben. Auch damit kann man Bits zusammenschieben und z.B. eine Reihe floats auf je 4 Bit länge "einstampfen" :D

    Zitat von Moritz1243

    wenn man das so sieht, merkt man wie wenig man eigentich über das Programmieren weiß.

    .... jeden Tag merke ich, wie wenig ich eigentlich übers Programmieren weiss...:D

  • Wenn man so ne Demo hinbekommt schafft man alles.
    Also Andy. Das klingt nach einer Herausforderung xD

    Mit werkkzeug3 kann ich zwar lustige Texturen machen, aber ich habe keinen Plan wie man die iwo einbinden kann.
    Soo einfach ist es wohl leider doch nicht^^

  • Ich hab nen bissel experimentiert, und da ist was ganz lustiges rausgekommen:

    Spoiler anzeigen
    [autoit]

    $user32 = DllOpen("user32.dll")
    $gdi32 = DllOpen("gdi32.dll")
    $w = 400
    $h = 400

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

    Global $pi = 4 * ATan(1)

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

    $hgui = GUICreate("Kleeblatt")
    $hdc_gui = getdc($hgui)
    GUISetState()

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

    For $x = 1 To $w
    For $y = 1 To $h
    $r = Sqrt((($w / 2) - $x) ^ 2 + (($h / 2) - $y) ^ 2) / 190
    $p = atan2(($w / 2) - $x, ($h / 2) - $y)
    $l = $r / (((1 + Cos(4 * $p)) ^ 0.125) - (1 / 40 * (1 + Cos(8 * $p)) ^ 2))
    $col = Int(1 / 5 * (2 - $l) ^ 0.215 * 4 + $l ^ 14 * 1 + 3 * $r * 256) * 256
    pix($hdc_gui, $x, $y, $col)
    Next
    Next

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

    While GUIGetMsg() <> -3
    WEnd

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

    Func atan2($y, $x)
    return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>atan2

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

    Func pix($dc, $x, $y, $color) ;pixel mit farbe an koordinaten setzen
    DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>pix

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

    Func GetDC($handle)
    $dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
    Return $dc[0]
    EndFunc ;==>GetDC

    [/autoit]
  • Geiles Teil. (ist vermutlich aus dem Kleeblatt entstanden)
    Ich klau mir mal die Formel, falls die nochmal iwie verwendet werden kann :P

  • Hi,
    irgendwelche blödsinnigen Formeln eintragen und gucken was passiert macht echt Spass^^

    Spoiler anzeigen
    [autoit]

    $user32 = DllOpen("user32.dll")
    $gdi32 = DllOpen("gdi32.dll")
    $w = 400
    $h = 400

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

    Global $pi = 4 * ATan(1)

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

    $hgui = GUICreate("Kleeblatt",$w,$h)
    $hdc_gui = getdc($hgui)
    GUISetState()

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

    For $x = 1 To $w
    For $y = 1 To $h
    $ra = Sqrt((($w / 2) - $x) ^ 2 + (($h / 2) - $y) ^ 2) / 60
    $p = atan2(($w / 2) - $x, ($h / 2) - $y)
    $l = $ra / (((1 + Cos(4 * $p)) ^ 0.125) - (1 / 40 * (1 + Cos(8 * $p)) ^ 2))
    $R=int ((2+cos(5*$p)^0.155))*$y*$y/$x
    $g=Int(1 / 5 * (2 - $l) ^ 0.215 * 4 + $l ^ 14 * 1 + 3 * $ra * 256) * 256
    $b=int(sin($ra*3)^-0.4*256*cos(1+1.6*$p)*256)*256
    $col = $r+$g+$b
    pix($hdc_gui, $x, $y, $col)
    Next
    Next

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

    While GUIGetMsg() <> -3
    WEnd

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

    Func atan2($y, $x)
    return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>atan2

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

    Func pix($dc, $x, $y, $color) ;pixel mit farbe an koordinaten setzen
    DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>pix

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

    Func GetDC($handle)
    $dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
    Return $dc[0]
    EndFunc ;==>GetDC

    [/autoit]
  • Wenn ich iwas eintippe kommt immer nur Stuss dabei raus^^
    Da muss es doch einen geheimen Geheimtrick geben für so gute Bilder ! ...

  • Um an eine bestimmte "Form" zu kommen, überlagert man die Ergebnisse von Funktionen...

    Idee:autoit.de/wcf/attachment/12541/


    Umsetzung mit hoffentlich verständlicher Erklärung^^

    Spoiler anzeigen
    [autoit]

    $user32 = DllOpen("user32.dll")
    $gdi32 = DllOpen("gdi32.dll")
    $w = 400
    $h = 400

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

    Global $pi = 4 * ATan(1)

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

    $hgui = GUICreate("Kleeblatt", $w, $h)
    $hdc_gui = getdc($hgui)
    GUISetState()

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

    For $y = 1 To $h Step 1
    For $x = 1 To $w Step 1
    $abstand = Sqrt((($w / 2) - $x) ^ 2 + (($h / 2) - $y) ^ 2) ;abstand vom mittelpunkt des bildes bis zum aktuellen pixel(x,y)
    $p = atan2(($w / 2) - $x, ($h / 2) - $y) ;phi
    ;winkel phi links rum von y-achse=0 grad:
    ;I.quadrant 0 - pi/2
    ;III.quadrant pi/2 bis pi
    ;IV.quadrant -pi bis -pi/2
    ;II. quadrant -pi/2 bis 0

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

    ; 0
    ; I | II
    ; |
    ;pi/2------- minus pi/2
    ; |
    ; III | IV
    ; pi und -pi

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

    $l = Abs($p) / $pi ;abs, sonst wird der radius negativ in den rechten quadranten!
    $r = Int((13 * $l - 22 * $l ^ 2 + 10 * $l ^ 3) / (6 - 5 * $l) * 150) ;radius, gleicher winkel => gleicher radius!

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

    If $abstand < $r Then ;wenn abstand vom mittelpunkt bis zum pixel kleiner ist als der Radius
    $col = 0xFF ;dann ist das pixel innerhalb des radius und somit rot
    Else
    $col = 0xF0F000
    EndIf

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

    pix($hdc_gui, $x, $y, $col)
    Next

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

    Next

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

    While GUIGetMsg() <> -3
    WEnd

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

    Func atan2($y, $x)
    Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>atan2

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

    Func pix($dc, $x, $y, $color) ;pixel mit farbe an koordinaten setzen
    DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>pix

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

    Func GetDC($handle)
    $dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
    Return $dc[0]
    EndFunc ;==>GetDC

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Aaaah
    jetzt hab ichs gerafft^^
    Ich hab gedacht man muss eine Funktion finden die anhand der Position des Pixels iwie "Automatisch" etwas sinnvolles reinbaut. (also ohne vorher iwie den Abstand zum Mittelpunkt zu berechnen oder irgendwelche Winkel)


    Mein erstes gutes Resultat !

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <WinAPIEX.au3>
    #include <GDIPlus.au3>

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

    Opt("MustDeclareVars", 1)
    Opt("GUIOnEventMode", 1)

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

    Global Const $Size = 600
    Global Const $Breite = $Size
    Global Const $Hoehe = $Size
    Global Const $Titel = 'Mustergenerator...'
    Global Const $WS_EX_LAYERED = 0x00080000
    Global Const $WS_POPUP = 0x80000000
    Global Const $SRCCOPY = 0x00CC0020
    Global Const $BLACKNESS = 0x00000042
    Global Const $h_NTDLL_DLL = DllOpen('ntdll.dll')
    Global Const $h_MSIMG32_DLL = DllOpen('msimg32.dll')
    Global Const $gdi32 = DllOpen('gdi32.dll')
    Global Const $Stretch = 1
    Global Const $WM_NCHITTEST = 0x0084
    Global Const $HTCAPTION = 2

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

    Global $hGUI = GUICreate($Titel, $Breite * $Stretch, $Hoehe * $Stretch, _C($Breite * $Stretch, 1), _C($Hoehe * $Stretch, 0), $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0x000000, $hGUI)
    WinSetTrans($hGUI, '', 255)
    GUISetOnEvent(-3, '_Exit', $hGUI)
    GUISetState(@SW_SHOW, $hGUI)

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

    _GDIPlus_Startup()

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

    Global $hDC_GUI = _WinAPI_GetDC($hGUI)
    Global $ptr_Backbuffer, $hbmp_Backbuffer
    Global $hDC_Backbuffer = _CreateNewBmp32($Breite, $Hoehe, $ptr_Backbuffer, $hbmp_Backbuffer)
    Global $DLL_Struct = DllStructCreate('int[' & $Breite * $Hoehe & ']', $ptr_Backbuffer)
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_GUI)

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

    Global $Frame, $Struct, $ptr, $hbmp
    Global $Counter = 0
    Global $Mode = 0 ;0 = NeuesBild, 1=PerlinNoise
    Global $Neu = True

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

    OnAutoItExitRegister('_Exit')
    GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

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

    Switch $Mode
    Case 0
    _NeuesBild()
    Case 1
    Local $a = _PerlinNoise($Breite, $Hoehe, 15, 0.9, Random(1, 5000))
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    EndSwitch

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

    While Sleep(20)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $Frame, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    If _IsPressed('20') Then _Neu()
    If _IsPressed('53') Then _Save()
    WEnd

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

    Func _Neu()
    Switch $Mode
    Case 0
    _NeuesBild()
    Case 1
    _Delete_Bitmap32($Frame, $hbmp)
    Local $a = _PerlinNoise($Breite, $Hoehe, 15, 0.9, Random(1, 5000))
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    EndSwitch
    EndFunc ;==>_Neu

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

    ;##########################HIER EIGENE FORMELN EINBAUEN############################################
    ; r = Rotanteil
    ; g = Grünanteil
    ; b = Blauanteil
    ; Es muss das Hex-Format verwendet werden. Hex(blabla, 2)
    Func _Funktion($x, $y, ByRef $r1, ByRef $g1, ByRef $b1)

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

    Local $col, $r, $g, $b, $AbstandMitte, $atx, $aty, $atx2, $aty2

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

    Local Static $Counter = 0
    $Counter += 1
    If $Neu Then
    $Neu = False
    $Counter = 0
    EndIf

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

    $AbstandMitte = (($y - $Hoehe/2)^2 + ($Breite/2 - $x)^2)^0.5
    $atx = ATan2($x, $AbstandMitte)
    $aty = ATan2($y, $AbstandMitte)
    $atx2 = ATan2($Breite - $x, $AbstandMitte)
    $aty2 = ATan2($Hoehe - $y, $AbstandMitte)

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

    ;~ $r = Hex($AbstandMitte + Random(0, 4, 1) ,2)
    ;~ $g = Hex(Sin($AbstandMitte/50) * 200 + Random(0, 4, 1) , 2)
    ;~ $b = Hex(Cos($AbstandMitte/20)*200 , 2)

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

    $r += Hex(Tan($atx*5 + 2)*60, 2)
    $g += Hex(Tan($atx*5 - 2)*60, 2)
    $b += Hex(Tan($atx*5)*60, 2)

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

    $r += Hex(Tan($atx2*5 + 2)*60, 2)
    $g += Hex(Tan($atx2*5 - 2)*60, 2)
    $b += Hex(Tan($atx2*5)*60, 2)

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

    $r += Hex(Tan($aty*5 + 2)*60, 2)
    $g += Hex(Tan($aty*5 - 2)*60, 2)
    $b += Hex(Tan($aty*5)*60, 2)

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

    $r += Hex(Tan($aty2*5 + 2)*60, 2)
    $g += Hex(Tan($aty2*5 - 2)*60, 2)
    $b += Hex(Tan($aty2*5)*60, 2)

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

    If $col Then Return $col

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

    $r1 = Hex($r, 2)
    $g1 = Hex($g, 2)
    $b1 = Hex($b, 2)

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

    Return 0
    EndFunc ;==>_Funktion
    ;###################################################################################################

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

    Func _F($x)
    Return ($x ^ 2 + 5) ^ 0.5
    EndFunc ;==>_F

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

    Func _Kleeblatt($x, $y)
    Local $w = $Breite, $h = $Hoehe, $r, $g, $b, $p, $col, $l
    $r = Sqrt((($w / 2) - $x) ^ 2 + (($h / 2) - $y) ^ 2) / 150
    $p = atan2(($w / 2) - $x, ($h / 2) - $y)
    $l = $r / (((1 + Cos(4 * $p)) ^ 0.125) - (1 / 40 * (1 + Cos(8 * $p)) ^ 2))
    $col = Int(1 / 4 * (1 - $l) ^ 0.125 * (1 + $l ^ 16) * (1 + 3 * $r) * 256) * 256
    Return $col
    EndFunc ;==>_Kleeblatt

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

    Func ATan2($y, $x)
    return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>ATan2

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

    Func _Min($a, $b)
    If $a > $b Then Return $b
    Return $a
    EndFunc ;==>_Min

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

    Func Log2($x)
    Return Log($x) / Log(2) ;10 is the base
    EndFunc ;==>Log2

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

    Func _Bet($a)
    If $a > 0 Then Return $a
    Return -$a
    EndFunc ;==>_Bet

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

    Func _Zufall(ByRef $Zufallszahl)
    Local Const $a = 7141
    Local Const $b = 54773
    Local Const $c = 259200
    $Zufallszahl = Mod(($a * $Zufallszahl + $b), $c)
    If $Zufallszahl < $c / 2 Then
    Return 1
    Else
    Return 0
    EndIf
    EndFunc ;==>_Zufall

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

    Func _PerlinNoise($b, $h, $Tiefe = 5, $Helligkeit = 1, $Nummer = 1)
    If $Tiefe < 1 Then $Tiefe = 1

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

    If Int(Log2(_Min($b, $h))) - 1 <= Int($Tiefe) Then $Tiefe = Int(Log2(_Min($b, $h))) - 2 ;Überprüfung ob die Tiefe möglich ist bei der angegebenen Auflösung

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

    _Winapi_StretchBlt($hDC_Backbuffer, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $Frame, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Local $bmp = _GDIPlus_BitmapCreateFromGraphics($b, $h, $hGraphics)
    Local $hBu = _GDIPlus_ImageGetGraphicsContext($bmp)
    Local $pxGes = 0, $col, $Prozent, $px = 0

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

    For $p = 0 To $Tiefe Step 1 ;p = BildNummern
    For $x = 0 To $b / 2 ^ ($Tiefe - $p) Step 1
    For $y = 0 To $h / 2 ^ ($Tiefe - $p) Step 1
    $pxGes += 1
    Next
    Next
    Next

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

    Local $bmp2 = _GDIPlus_BitmapCloneArea($bmp, 0, 0, $b, $h)
    Local $bbuffer = _GDIPlus_ImageGetGraphicsContext($bmp2)
    Local $hBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_Backbuffer)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    Local $Erhellen = 1, $Verdunkeln = 1
    $Helligkeit = _Bet($Helligkeit)
    While $Helligkeit > 2
    $Helligkeit -= 1
    WEnd
    If $Helligkeit < 1 Then
    $Verdunkeln = $Helligkeit
    $Erhellen = 1
    ;~ ToolTip('Dunkel: ' & $Verdunkeln)
    Else
    $Erhellen = 1 - ($Helligkeit - 1)
    $Verdunkeln = 1
    ;~ ToolTip('Hell: ' & $Erhellen)
    EndIf

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

    For $p = 0 To $Tiefe Step 1 ;p = BildNummern
    For $x = 0 To $b / 2 ^ ($Tiefe - $p) Step 1
    For $y = 0 To $h / 2 ^ ($Tiefe - $p) Step 1
    $px += 1
    Switch _Zufall($Nummer)
    Case 0
    $col = '0x' & Hex((255 / 2 ^ $p) * $Erhellen, 2) & '000000'
    Case 1
    $col = '0x' & Hex((255 / 2 ^ $p) * $Verdunkeln, 2) & 'FFFFFF'
    EndSwitch
    _pix($bmp, $x, $y, $col)
    Next
    $Prozent = $px / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $Hoehe - 20, $Breite - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $Hoehe - 18, ($Breite - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $hDC_Backbuffer, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Next
    _GDIPlus_GraphicsDrawImageRectRect($bbuffer, $bmp, 0, 0, $b / 2 ^ ($Tiefe - $p), $h / 2 ^ ($Tiefe - $p), 0, 0, $b, $h)
    Next

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

    Global $_ptr, $_hbmp
    Global $_hdc = _CreateNewBmp32($b, $h, $_ptr, $_hbmp)
    Local $gra = _GDIPlus_GraphicsCreateFromHDC($_hdc)
    _GDIPlus_GraphicsDrawImage($gra, $bmp2, 0, 0)
    _GDIPlus_GraphicsDispose($gra)
    _GDIPlus_GraphicsDispose($hBu)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_GraphicsDispose($bbuffer)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BitmapDispose($bmp)
    _GDIPlus_BitmapDispose($bmp2)
    Local $a[3] = [$_hdc, $_hbmp, $_ptr]
    Return $a
    EndFunc ;==>_PerlinNoise

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

    Func _pix($hBitmap, $ix, $iy, $color)
    DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $ix, "int", $iy, "dword", $color)
    EndFunc ;==>_pix

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

    Func _NeuesBild()

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

    ;~ _GDIPlus_Startup()
    _Winapi_StretchBlt($hDC_Backbuffer, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $Frame, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Local $hBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_Backbuffer)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local $g = '88', $r = '34', $b = '99'
    Local $Prozent = 0
    Local $pxGes = $Hoehe * $Breite, $col

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

    $Frame = _CreateNewBmp32($Breite, $Hoehe, $ptr, $hbmp)
    $Struct = DllStructCreate('int[' & $Breite * $Hoehe & ']', $ptr)

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

    ;~ _Apfelm($Struct)

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

    For $i = 0 To $Hoehe Step 1
    For $j = 0 To $Breite Step 1
    $col = _Funktion($i, $j, $r, $g, $b)

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

    If $col Then
    DllStructSetData($Struct, 1, $col, $j * $Breite + $i + 1)
    Else
    DllStructSetData($Struct, 1, '0xFF' & $r & $g & $b, $j * $Breite + $i + 1)
    EndIf
    Next
    $Prozent = ($i * $Hoehe + $j) / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $Hoehe - 20, $Breite - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $Hoehe - 18, ($Breite - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $hDC_Backbuffer, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Next

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

    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    ;~ _GDIPlus_Shutdown()
    $Neu = True
    Sleep(100)

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

    EndFunc ;==>_NeuesBild

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

    Func _Save()
    Local $Pfad = FileSaveDialog('BildSpeichern', @ScriptDir & '\Muster', '(*,.png)', Default, Hex(Random(256, 16 ^ 3, 1), 3) & '.png')
    _GDIPlus_Startup()
    Local $bm = _GDIPlus_BitmapCreateFromHBITMAP($hbmp)
    _GDIPlus_ImageSaveToFile($bm, $Pfad)
    _GDIPlus_BitmapDispose($bm)
    _GDIPlus_Shutdown()
    EndFunc ;==>_Save

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

    Func _Exit()
    ConsoleWrite('Blubb')
    _WinAPI_ReleaseDC($hGUI, $hDC_GUI)
    _GDIPlus_Shutdown()
    _Delete_Bitmap32($hDC_Backbuffer, $hbmp_Backbuffer)
    _Delete_Bitmap32($Frame, $hbmp)
    DllClose($h_NTDLL_DLL)
    DllClose($h_MSIMG32_DLL)
    DllClose($gdi32)
    Exit
    EndFunc ;==>_Exit

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

    Func _Delete_Bitmap32($hDC, $hbmp)
    _WinAPI_DeleteObject($hbmp)
    _WinAPI_ReleaseDC(0, $hDC)
    EndFunc ;==>_Delete_Bitmap32

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

    Func _CreateNewBmp32($iWidth, $iHeight, ByRef $ptr, ByRef $hbmp) ;erstellt leere 32-bit-Bitmap; Rückgabe DC und ptr und handle auf die Bitmapdaten
    ;by Andy
    Local $hcdc = _WinAPI_CreateCompatibleDC(0) ;Desktop-Kompatiblen DeviceContext erstellen lassen
    Local $tBMI = DllStructCreate($tagBITMAPINFO) ;Struktur der Bitmapinfo erstellen und Daten eintragen
    DllStructSetData($tBMI, "Size", DllStructGetSize($tBMI) - 4);Structgröße abzüglich der Daten für die Palette
    DllStructSetData($tBMI, "Width", $iWidth)
    DllStructSetData($tBMI, "Height", -$iHeight) ;minus =standard = bottomup
    DllStructSetData($tBMI, "Planes", 1)
    DllStructSetData($tBMI, "BitCount", 32) ;32 Bit = 4 Bytes => AABBGGRR
    Local $adib = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', $DIB_RGB_COLORS, 'ptr*', 0, 'ptr', 0, 'uint', 0)
    $hbmp = $adib[0] ;hbitmap handle auf die Bitmap, auch per GDI+ zu verwenden
    $ptr = $adib[4] ;pointer auf den Anfang der Bitmapdaten, vom Assembler verwendet
    ;_arraydisplay($adib)
    _WinAPI_SelectObject($hcdc, $hbmp) ;objekt hbitmap in DC
    Return $hcdc ;DC der Bitmap zurückgeben
    EndFunc ;==>_CreateNewBmp32

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

    Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $hGUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
    EndFunc ;==>WM_NCHITTEST

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

    Func _C($a, $b)
    Switch $b
    Case 0 ;Y
    Return @DesktopHeight / 2 - $a / 2
    Case 1 ;X
    Return @DesktopWidth / 2 - $a / 2
    EndSwitch
    EndFunc ;==>_C

    [/autoit]

    [Blockierte Grafik: http://img6.imagebanana.com/img/rjd361ve/4BD.png]

  • hatte in der Beschreibung von phi die Quadranten nicht richtig nummeriert, sollte nun klarer sein

  • Btw., wie wäre es, wenn die c++-Spezialisten mal ein Grundgerüst dieses "inner loops" (in einer dll) schreiben würden! So dass man nur noch die 3-4 Zeilen Berechnungen einfügen muss. Das wäre dann bestimmt einfacher zu realisieren und würde mit Sicherheit auch mehr Leute ansprechen wie eine ASM-Funktion :D. Da ja Visual C++ Express kostenlos und weit verbreitet ist, würde es sich anbieten.
    So könnte man in AutoIt mit den Formeln experimentieren und nachher die fertigen Funktion(en) einfach in C übertragen und den "inner loop" aus der dll aufrufen. Das sollten auch Nicht-C++ler (so wie ich ^^) hinbekommen.

    O.K. Ich hab es mal gemacht.

    _AVIGetInfo.zip

  • Zitat

    O.K. Ich hab es mal gemacht.

    dafür gibts nen grossen [Blockierte Grafik: http://extreme.pcgameshardware.de/attachments/301375d1294506421-noblorros-gold-book-go-gold-keks.jpg:thumbup:
    Ich hab mich auch schon mal bissl fit gemacht und sehe da eigentlich Potenzial.
    Statt setpixel() kann man natürlich direkt in eine Bitmap schreiben und dann die komplette Seite blitten, das geht wesentlich schneller!
    Beim Debuggen/Disassemblen habe ich festgestellt, dass die trigonometrischen Funktionen innerhalb VC++ alle doppelt und dreifach gg Exceptions abgesichert sind

    Code
    float variable=sin(variable)

    , das kostet gegenüber einem einfachen inline

    Code
    __asm
    {
    fld variable
    fsin
    fstp variable
    }

    die 3-fache Zeit! Bei komplizierten Berechnungen mit einigen Millionen Schleifendurchgängen läppert sich das gewaltig!

    Aber schon sehr schön, Marthog, so kann man auch mal "langwierige" Berechnungen beschleunigen!

  • Aaaalso

    Um die Grafiken aufzubauen braucht man:
    Generatoren - Erzeugen z.B. einen Kreis, oder Wolken oder was weiß ich^^
    Filter - z.B. Linien zeichnen, drehen, aufhellen, kopieren usw.
    Verknüpfer - 2 Bilder Addieren, Sub, Mul usw.

    Habe mit dem Basteln auch schon angefangen. Leider ist das Ganze sehr Langsam.
    Generatoren habe ich bisher: Kleeblatt, PerlinNoise, Bunte linien
    Filter baue ich grade. Der erste der Fertig war ist Vertikale und Horizontale Linien. (habe auch Diagonale probiert, aber das ist iwie misslungen^^)
    Aufhellen, Verdunkeln usw wird demnächst noch gemacht.
    Dann kommen noch Verknüpfungen.

    Dann sollte es möglich sein ein Spiel zu machen was sehr viel Grafiken enthält, die keinen großen Speicher brauchen.
    (Allerdings hat man dann wahrscheinlich ne halbe Stunde Ladezeit xD)

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <WinAPIEX.au3>
    #include <GDIPlus.au3>
    ;~ #include <array.au3>

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

    Opt("MustDeclareVars", 1)
    Opt("GUIOnEventMode", 1)

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

    Global Const $Size = 500
    Global Const $Breite = $Size
    Global Const $Hoehe = $Size
    Global Const $Titel = 'Mustergenerator...'
    Global Const $WS_EX_LAYERED = 0x00080000
    Global Const $WS_POPUP = 0x80000000
    Global Const $SRCCOPY = 0x00CC0020
    Global Const $BLACKNESS = 0x00000042
    Global Const $h_NTDLL_DLL = DllOpen('ntdll.dll')
    Global Const $h_MSIMG32_DLL = DllOpen('msimg32.dll')
    Global Const $gdi32 = DllOpen('gdi32.dll')
    Global Const $Stretch = 1
    Global Const $WM_NCHITTEST = 0x0084
    Global Const $HTCAPTION = 2

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

    Global $hGUI = GUICreate($Titel, $Breite * $Stretch, $Hoehe * $Stretch, _C($Breite * $Stretch, 1), _C($Hoehe * $Stretch, 0), $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0x000000, $hGUI)
    WinSetTrans($hGUI, '', 255)
    GUISetOnEvent(-3, '_Exit', $hGUI)
    GUISetState(@SW_SHOW, $hGUI)

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

    _GDIPlus_Startup()

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

    Global $hDC_GUI = _WinAPI_GetDC($hGUI)
    Global $ptr_Backbuffer, $hbmp_Backbuffer
    Global $hDC_Backbuffer = _CreateNewBmp32($Breite, $Hoehe, $ptr_Backbuffer, $hbmp_Backbuffer)
    Global $DLL_Struct = DllStructCreate('int[' & $Breite * $Hoehe & ']', $ptr_Backbuffer)
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_GUI)

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

    Global $Frame, $Struct, $ptr, $hbmp
    Global $Counter = 0
    Global $Mode = 1 ;0 = NeuesBild, 1=PerlinNoise, gen1
    Global $Neu = True

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

    OnAutoItExitRegister('_Exit')
    GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

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

    Switch $Mode
    Case 0
    Local $a = _Generator_Kleeblatt($Breite, $Hoehe)
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    Case 1
    Local $a = _Generator_Perlin($Breite, $Hoehe, 15, 0.9, Random(1, 5000))
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    Case 2
    Local $a = _Generator_1($Breite, $Hoehe)
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]

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

    EndSwitch

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

    _Filter_1($hbmp, $ptr, 2)
    ;~ _Filter_1($hbmp, $ptr, 4, 1)

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

    While Sleep(20)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $Frame, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    If _IsPressed('20') Then _Neu()
    If _IsPressed('53') Then _Save()
    WEnd

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

    Func _Neu()
    Switch $Mode
    Case 0
    _Delete_Bitmap32($Frame, $hbmp)
    Local $a = _Generator_Kleeblatt($Breite, $Hoehe)
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    Case 1
    _Delete_Bitmap32($Frame, $hbmp)
    Local $a = _Generator_Perlin($Breite, $Hoehe, 15, 0.9, Random(1, 5000))
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    Case 2
    _Delete_Bitmap32($Frame, $hbmp)
    Local $a = _Generator_1($Breite, $Hoehe)
    $Frame = $a[0]
    $ptr = $a[2]
    $hbmp = $a[1]
    EndSwitch
    _Filter_1($hbmp, $ptr, 2)
    ;~ _Filter_1($hbmp, $ptr, 2, 1)
    EndFunc ;==>_Neu

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

    Func _Generator_Perlin($b, $h, $t = 5, $he = 1, $nr = 1)
    Return _PerlinNoise($b, $h, $t, $he, $nr)
    EndFunc ;==>_Generator_Perlin

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

    Func _Generator_Kleeblatt($b, $h)
    Return _NeuesBild($b, $h, 1)
    EndFunc ;==>_Generator_Kleeblatt

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

    Func _Generator_1($b, $h)
    Return _NeuesBild($b, $h, 2)
    EndFunc ;==>_Generator_1

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

    ;~ Richtung:
    ;~ 0 = Waagerecht
    ;~ 1 = Senktecht
    ;~ 2 = Diagonal lu ro
    ;~ 3 = Diagonal lo Run

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

    ;~ abs
    ;~ jede X-te Linie wird gezogen

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

    ;~ tausch
    ;~ 0 = x = x
    ;~ 1 = x = y, y = x

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

    Func _Filter_1($hbmp, $ptr, $abs = 2, $richtung = 0, $Farbe = 0xFF000000, $ersetzen = True)
    Local $tmpcol[4]
    $Farbe = Hex($Farbe, 8)
    $tmpcol[0] = Int('0x' &StringLeft($Farbe, 2))
    $tmpcol[1] = Int('0x' &StringMid($Farbe, 3, 2))
    $tmpcol[2] = Int('0x' &StringMid($Farbe, 5, 2))
    $tmpcol[3] = Int('0x' &StringMid($Farbe, 7, 2))
    ___Filter_1($hbmp, $ptr, $abs, $richtung, $tmpcol[0], $tmpcol[1], $tmpcol[2], $tmpcol[3], $ersetzen)
    EndFunc

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

    Func ___Richtung($r, ByRef $x, ByRef $y, $h, $z = 0) ;z bedeutet, dass alles wieder hergestellt wird. Bei einem einfachen Tausch ist das ohne speichern möglich.
    Local $t, $Counter = 0
    Local Static $x2, $y2
    Switch $r
    Case 1
    $t = $x
    $x = $y
    $y = $t
    Case 2
    Switch $Z
    Case 0
    $x2 = $x ;Speichern von x und y zum späteren korrekten wiederherstellen
    $y2 = $y
    $x = $x + ($y - 1)
    While $x > $h
    $x -= $h
    $Counter += 1
    WEnd
    If $x < $y-1 Then
    $x -= $Counter
    EndIf

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

    While $x < 0
    $x += ($h + 1)
    WEnd
    Case 1
    $x = $x2
    $y = $y2
    EndSwitch
    Case 3
    Switch $Z
    Case 0
    $x2 = $x ;Speichern von x und y zum späteren korrekten wiederherstellen
    $y2 = $y
    $x = $x - $y
    While $x < 0
    $x += $h
    WEnd
    ;~ $x -= 1
    Case 1
    $x = $x2
    $y = $y2
    EndSwitch
    EndSwitch
    EndFunc

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

    Func ___Filter_1($hbmp, $ptr, $abs, $richtung, $a, $r, $g, $blau, $ersetzen)
    Local $bit = _GDIPlus_BitmapCreateFromHBITMAP($hbmp)
    Local $b = _GDIPlus_ImageGetWidth($bit)
    Local $h = _GDIPlus_ImageGetHeight($bit)
    _GDIPlus_BitmapDispose($bit)
    Local $Struct = DllStructCreate('int[' & $b * $h & ']', $ptr)
    Local $tmpcol[4] ;argb
    Local $tmp2, $tmp3 ;tmp2 = komplett argb, tmp3 = Multi für den Aplhawert

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

    _Winapi_StretchBlt($hDC_Backbuffer, 0, 0, $b * $Stretch, $h * $Stretch, $Frame, 0, 0, $b, $h, $SRCCOPY)
    Local $hBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_Backbuffer)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local $Prozent = 0
    Local $pxGes = $h * $b

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

    Switch $richtung
    Case 0
    For $x = 0 To $h Step 1
    For $y = 0 To $b Step 1
    If $x / $abs = Int($x / $abs) And $y <> $b Then

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

    ___Richtung($richtung, $x, $y, $h)

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

    Switch $ersetzen
    Case True
    DllStructSetData($Struct, 1, '0x' & Hex($a,2) & Hex($r,2) & Hex($g,2) & Hex($blau,2), $x * $b + $y + 1)
    Case False
    $tmp2 = Hex(DllStructGetData($Struct, 1, $x * $b + $y + 1), 8)
    $tmpcol[0] = Int('0x' &StringLeft($tmp2, 2))
    $tmpcol[1] = Int('0x' &StringMid($tmp2, 3, 2))
    $tmpcol[2] = Int('0x' &StringMid($tmp2, 5, 2))
    $tmpcol[3] = Int('0x' &StringMid($tmp2, 7, 2))
    $tmp3 = $a / 255
    $tmpcol[1] = $tmpcol[1] + $r * $tmp3
    $tmpcol[2] = $tmpcol[2] + $g * $tmp3
    $tmpcol[3] = $tmpcol[3] + $blau * $tmp3
    For $i = 1 To 3 Step 1
    If $tmpcol[$i] > 255 Then $tmpcol[$i] = 255
    Next
    If ($x * $b + $y)< $h*$b Then

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

    DllStructSetData($Struct, 1, '0x' & Hex($tmpcol[0], 2) & Hex($tmpcol[1], 2) & Hex($tmpcol[2], 2) & Hex($tmpcol[3], 2), $x * $b + $y + 1)
    EndIf
    EndSwitch

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

    ___Richtung($richtung, $x, $y, $h, 1)

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

    EndIf

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

    Next
    $Prozent = ($x * $y + $b) / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $h - 20, $b - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $h - 18, ($b - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $b * $Stretch, $h * $Stretch, $hDC_Backbuffer, 0, 0, $b, $h, $SRCCOPY)
    Next
    Case 1

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

    For $x = 0 To $b Step 1
    For $y = 0 To $h Step 1
    If $x / $abs = Int($x / $abs) And $y <> $b Then

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

    ___Richtung($richtung, $x, $y, $h)

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

    Switch $ersetzen
    Case True
    DllStructSetData($Struct, 1, '0x' & Hex($a,2) & Hex($r,2) & Hex($g,2) & Hex($blau,2), $x * $b + $y + 1)
    Case False
    $tmp2 = Hex(DllStructGetData($Struct, 1, $x * $b + $y + 1), 8)
    $tmpcol[0] = Int('0x' &StringLeft($tmp2, 2))
    $tmpcol[1] = Int('0x' &StringMid($tmp2, 3, 2))
    $tmpcol[2] = Int('0x' &StringMid($tmp2, 5, 2))
    $tmpcol[3] = Int('0x' &StringMid($tmp2, 7, 2))
    $tmp3 = $a / 255
    $tmpcol[1] = $tmpcol[1] + $r * $tmp3
    $tmpcol[2] = $tmpcol[2] + $g * $tmp3
    $tmpcol[3] = $tmpcol[3] + $blau * $tmp3
    For $i = 1 To 3 Step 1
    If $tmpcol[$i] > 255 Then $tmpcol[$i] = 255
    Next
    If ($x * $b + $y)< $h*$b Then

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

    DllStructSetData($Struct, 1, '0x' & Hex($tmpcol[0], 2) & Hex($tmpcol[1], 2) & Hex($tmpcol[2], 2) & Hex($tmpcol[3], 2), $x * $b + $y + 1)
    EndIf
    EndSwitch

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

    ___Richtung($richtung, $x, $y, $h, 1)

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

    EndIf

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

    Next
    $Prozent = ($x * $y + $b) / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $h - 20, $b - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $h - 18, ($b - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $b * $Stretch, $h * $Stretch, $hDC_Backbuffer, 0, 0, $b, $h, $SRCCOPY)
    Next

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

    Case 2 To 3

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

    For $x = 0 To $h Step 1
    For $y = 0 To $b Step 1
    If $x / $abs = Int($x / $abs) And $y <> $b Then

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

    ___Richtung($richtung, $x, $y, $h)

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

    Switch $ersetzen
    Case True
    DllStructSetData($Struct, 1, '0x' & Hex($a,2) & Hex($r,2) & Hex($g,2) & Hex($blau,2), $x * $b + $y + 1)
    Case False
    $tmp2 = Hex(DllStructGetData($Struct, 1, $x * $b + $y + 1), 8)
    $tmpcol[0] = Int('0x' &StringLeft($tmp2, 2))
    $tmpcol[1] = Int('0x' &StringMid($tmp2, 3, 2))
    $tmpcol[2] = Int('0x' &StringMid($tmp2, 5, 2))
    $tmpcol[3] = Int('0x' &StringMid($tmp2, 7, 2))
    $tmp3 = $a / 255
    $tmpcol[1] = $tmpcol[1] + $r * $tmp3
    $tmpcol[2] = $tmpcol[2] + $g * $tmp3
    $tmpcol[3] = $tmpcol[3] + $blau * $tmp3
    For $i = 1 To 3 Step 1
    If $tmpcol[$i] > 255 Then $tmpcol[$i] = 255
    Next
    If ($x * $b + $y)< $h*$b Then

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

    DllStructSetData($Struct, 1, '0x' & Hex($tmpcol[0], 2) & Hex($tmpcol[1], 2) & Hex($tmpcol[2], 2) & Hex($tmpcol[3], 2), $x * $b + $y + 1)
    EndIf
    EndSwitch

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

    ___Richtung($richtung, $x, $y, $h, 1)

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

    EndIf

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

    Next
    $Prozent = ($x * $y + $b) / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $h - 20, $b - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $h - 18, ($b - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $b * $Stretch, $h * $Stretch, $hDC_Backbuffer, 0, 0, $b, $h, $SRCCOPY)
    Next
    EndSwitch

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

    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)

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

    $Struct = 0
    EndFunc ;==>_Filter_1

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

    ;##########################HIER EIGENE FORMELN EINBAUEN############################################
    ; r = Rotanteil
    ; g = Grünanteil
    ; b = Blauanteil
    ; Es muss das Hex-Format verwendet werden. Hex(blabla, 2)
    Func _Funktion($x, $y, ByRef $r1, ByRef $g1, ByRef $b1, ByRef $a1)

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

    Local $col, $r, $g, $b, $AbstandMitte, $atx, $aty, $atx2, $aty2

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

    Local Static $Counter = 0
    $Counter += 1
    If $Neu Then
    $Neu = False
    $Counter = 0
    EndIf

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

    $AbstandMitte = (($y - $Hoehe / 2) ^ 2 + ($Breite / 2 - $x) ^ 2) ^ 0.5
    $atx = ATan2($x, $AbstandMitte)
    $aty = ATan2($y, $AbstandMitte)
    $atx2 = ATan2($Breite - $x, $AbstandMitte)
    $aty2 = ATan2($Hoehe - $y, $AbstandMitte)

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

    ;~ $r = Hex($AbstandMitte + Random(0, 4, 1) ,2)
    ;~ $g = Hex(Sin($AbstandMitte/50) * 200 + Random(0, 4, 1) , 2)
    ;~ $b = Hex(Cos($AbstandMitte/20)*200 , 2)

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

    $r = Hex(Tan($atx * 5 + 2) * 62, 2) + Hex(Tan($atx2 * 5 + 2) * 62, 2) + Hex(Tan($aty * 5 + 2) * 62, 2) + Hex(Tan($aty2 * 5 + 2) * 62, 2)
    $g = Hex(Tan($atx * 5 - 2) * 62, 2) + Hex(Tan($atx2 * 5 - 2) * 62, 2) + Hex(Tan($aty * 5 - 2) * 62, 2) + Hex(Tan($aty2 * 5 - 2) * 62, 2)
    $b = Hex(Tan($atx * 5) * 62, 2) + Hex(Tan($atx2 * 5) * 62, 2) + Hex(Tan($aty * 5) * 62, 2) + Hex(Tan($aty2 * 5) * 62, 2)

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

    ;~ $r += Hex(Tan($atx2*5 + 2)*70, 2)
    ;~ $g += Hex(Tan($atx2*5 - 2)*70, 2)
    ;~ $b += Hex(Tan($atx2*5)*70, 2)

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

    ;~ $r += Hex(Tan($aty*5 + 2)*70, 2)
    ;~ $g += Hex(Tan($aty*5 - 2)*70, 2)
    ;~ $b += Hex(Tan($aty*5)*70, 2)

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

    ;~ $r += Hex(Tan($aty2*5 + 2)*70, 2)
    ;~ $g += Hex(Tan($aty2*5 - 2)*70, 2)
    ;~ $b += Hex(Tan($aty2*5)*70, 2)

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

    If $col Then Return $col

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

    $r1 = Hex($r, 2)
    $g1 = Hex($g, 2)
    $b1 = Hex($b, 2)
    $a1 = 'FF'

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

    Return 0
    EndFunc ;==>_Funktion
    ;###################################################################################################

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

    Func _Gen1($x, $y)
    Local $col, $r, $g, $b, $AbstandMitte, $atx, $aty, $atx2, $aty2
    $AbstandMitte = (($y - $Hoehe / 2) ^ 2 + ($Breite / 2 - $x) ^ 2) ^ 0.5
    $atx = ATan2($x, $AbstandMitte)
    $aty = ATan2($y, $AbstandMitte)
    $atx2 = ATan2($Breite - $x, $AbstandMitte)
    $aty2 = ATan2($Hoehe - $y, $AbstandMitte)
    $r = Hex(Tan($atx * 5 + 2) * 62, 2) + Hex(Tan($atx2 * 5 + 2) * 62, 2) + Hex(Tan($aty * 5 + 2) * 62, 2) + Hex(Tan($aty2 * 5 + 2) * 62, 2)
    $g = Hex(Tan($atx * 5 - 2) * 62, 2) + Hex(Tan($atx2 * 5 - 2) * 62, 2) + Hex(Tan($aty * 5 - 2) * 62, 2) + Hex(Tan($aty2 * 5 - 2) * 62, 2)
    $b = Hex(Tan($atx * 5) * 62, 2) + Hex(Tan($atx2 * 5) * 62, 2) + Hex(Tan($aty * 5) * 62, 2) + Hex(Tan($aty2 * 5) * 62, 2)
    Return '0xFF' & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
    EndFunc ;==>_Gen1

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

    Func _F($x)
    Return ($x ^ 2 + 5) ^ 0.5
    EndFunc ;==>_F

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

    Func _Kleeblatt($x, $y)
    Local $w = $Breite, $h = $Hoehe, $r, $g, $b, $p, $col, $l
    $r = Sqrt((($w / 2) - $x) ^ 2 + (($h / 2) - $y) ^ 2) / 150
    $p = atan2(($w / 2) - $x, ($h / 2) - $y)
    $l = $r / (((1 + Cos(4 * $p)) ^ 0.125) - (1 / 40 * (1 + Cos(8 * $p)) ^ 2))
    $col = Int(1 / 4 * (1 - $l) ^ 0.125 * (1 + $l ^ 16) * (1 + 3 * $r) * 256) * 256
    Return $col
    EndFunc ;==>_Kleeblatt

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

    Func ATan2($y, $x)
    return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>ATan2

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

    Func _Min($a, $b)
    If $a > $b Then Return $b
    Return $a
    EndFunc ;==>_Min

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

    Func Log2($x)
    Return Log($x) / Log(2) ;10 is the base
    EndFunc ;==>Log2

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

    Func _Bet($a)
    If $a > 0 Then Return $a
    Return -$a
    EndFunc ;==>_Bet

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

    Func _Zufall(ByRef $Zufallszahl)
    Local Const $a = 7141
    Local Const $b = 54773
    Local Const $c = 259200
    $Zufallszahl = Mod(($a * $Zufallszahl + $b), $c)
    If $Zufallszahl < $c / 2 Then
    Return 1
    Else
    Return 0
    EndIf
    EndFunc ;==>_Zufall

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

    Func _PerlinNoise($b, $h, $Tiefe, $Helligkeit, $Nummer)
    If $Tiefe < 1 Then $Tiefe = 1

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

    If Int(Log2(_Min($b, $h))) - 1 <= Int($Tiefe) Then $Tiefe = Int(Log2(_Min($b, $h))) - 2 ;Überprüfung ob die Tiefe möglich ist bei der angegebenen Auflösung

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

    _Winapi_StretchBlt($hDC_Backbuffer, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $Frame, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Local $bmp = _GDIPlus_BitmapCreateFromGraphics($b, $h, $hGraphics)
    Local $hBu = _GDIPlus_ImageGetGraphicsContext($bmp)
    Local $pxGes = 0, $col, $Prozent, $px = 0

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

    For $p = 0 To $Tiefe Step 1 ;p = BildNummern
    For $x = 0 To $b / 2 ^ ($Tiefe - $p) Step 1
    For $y = 0 To $h / 2 ^ ($Tiefe - $p) Step 1
    $pxGes += 1
    Next
    Next
    Next

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

    Local $bmp2 = _GDIPlus_BitmapCloneArea($bmp, 0, 0, $b, $h)
    Local $bbuffer = _GDIPlus_ImageGetGraphicsContext($bmp2)
    Local $hBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_Backbuffer)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

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

    Local $Erhellen = 1, $Verdunkeln = 1
    $Helligkeit = _Bet($Helligkeit)
    While $Helligkeit > 2
    $Helligkeit -= 1
    WEnd
    If $Helligkeit < 1 Then
    $Verdunkeln = $Helligkeit
    $Erhellen = 1
    ;~ ToolTip('Dunkel: ' & $Verdunkeln)
    Else
    $Erhellen = 1 - ($Helligkeit - 1)
    $Verdunkeln = 1
    ;~ ToolTip('Hell: ' & $Erhellen)
    EndIf

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

    For $p = 0 To $Tiefe Step 1 ;p = BildNummern
    For $x = 0 To $b / 2 ^ ($Tiefe - $p) Step 1
    For $y = 0 To $h / 2 ^ ($Tiefe - $p) Step 1
    $px += 1
    Switch _Zufall($Nummer)
    Case 0
    $col = '0x' & Hex((255 / 2 ^ $p) * $Erhellen, 2) & '000000'
    Case 1
    $col = '0x' & Hex((255 / 2 ^ $p) * $Verdunkeln, 2) & 'FFFFFF'
    EndSwitch
    _pix($bmp, $x, $y, $col)
    Next
    $Prozent = $px / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $Hoehe - 20, $Breite - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $Hoehe - 18, ($Breite - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $Breite * $Stretch, $Hoehe * $Stretch, $hDC_Backbuffer, 0, 0, $Breite, $Hoehe, $SRCCOPY)
    Next
    _GDIPlus_GraphicsDrawImageRectRect($bbuffer, $bmp, 0, 0, $b / 2 ^ ($Tiefe - $p), $h / 2 ^ ($Tiefe - $p), 0, 0, $b, $h)
    Next

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

    Global $_ptr, $_hbmp
    Global $_hdc = _CreateNewBmp32($b, $h, $_ptr, $_hbmp)
    Local $gra = _GDIPlus_GraphicsCreateFromHDC($_hdc)
    _GDIPlus_GraphicsDrawImage($gra, $bmp2, 0, 0)
    _GDIPlus_GraphicsDispose($gra)
    _GDIPlus_GraphicsDispose($hBu)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_GraphicsDispose($bbuffer)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BitmapDispose($bmp)
    _GDIPlus_BitmapDispose($bmp2)
    Local $a[3] = [$_hdc, $_hbmp, $_ptr]
    Return $a
    EndFunc ;==>_PerlinNoise

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

    Func _pix($hBitmap, $ix, $iy, $color)
    DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $ix, "int", $iy, "dword", $color)
    EndFunc ;==>_pix

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

    Func _NeuesBild($b, $h, $func = 0)

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

    ;~ _GDIPlus_Startup()
    _Winapi_StretchBlt($hDC_Backbuffer, 0, 0, $b * $Stretch, $h * $Stretch, $Frame, 0, 0, $b, $h, $SRCCOPY)
    Local $hBuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_Backbuffer)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Local $g = '00', $r = '00', $bl = '00', $alpha = 'FF'
    Local $Prozent = 0
    Local $pxGes = $h * $b, $col, $ptr, $hbmp
    Local $Frame = _CreateNewBmp32($b, $h, $ptr, $hbmp)
    Local $Struct = DllStructCreate('int[' & $b * $h & ']', $ptr)

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

    ;~ _Apfelm($Struct)

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

    For $i = 0 To $h Step 1
    For $j = 0 To $b Step 1
    Switch $func
    Case 0
    $col = _Funktion($i, $j, $r, $g, $bl, $alpha)
    Case 1
    $col = _Kleeblatt($j, $i)
    Case 2
    $col = _Gen1($j, $i)
    EndSwitch

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

    If $col Then
    DllStructSetData($Struct, 1, $col, $j * $b + $i + 1)
    Else
    DllStructSetData($Struct, 1, '0x' & $alpha & $r & $g & $bl, $j * $b + $i + 1)
    EndIf
    Next
    $Prozent = ($i * $h + $j) / $pxGes
    _GDIPlus_GraphicsDrawRect($hBuffer, 5, $h - 20, $b - 10, 15, $hPen)
    _GDIPlus_GraphicsFillRect($hBuffer, 7, $h - 18, ($b - 13) * $Prozent, 12, $hBrush)
    _Winapi_StretchBlt($hDC_GUI, 0, 0, $b * $Stretch, $h * $Stretch, $hDC_Backbuffer, 0, 0, $b, $h, $SRCCOPY)
    Next

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

    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    ;~ _GDIPlus_Shutdown()
    $Neu = True
    Sleep(100)

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

    Local $ret[3] = [$Frame, $hbmp, $ptr]
    Return $ret

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

    EndFunc ;==>_NeuesBild

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

    Func _Save()
    Local $Pfad = FileSaveDialog('BildSpeichern', @ScriptDir & '\Muster', '(*,.png)', Default, Hex(Random(256, 16 ^ 3, 1), 3) & '.png')
    _GDIPlus_Startup()
    Local $bm = _GDIPlus_BitmapCreateFromHBITMAP($hbmp)
    _GDIPlus_ImageSaveToFile($bm, $Pfad)
    _GDIPlus_BitmapDispose($bm)
    _GDIPlus_Shutdown()
    EndFunc ;==>_Save

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

    Func _Exit()
    ConsoleWrite('Blubb')
    _WinAPI_ReleaseDC($hGUI, $hDC_GUI)
    _GDIPlus_Shutdown()
    _Delete_Bitmap32($hDC_Backbuffer, $hbmp_Backbuffer)
    _Delete_Bitmap32($Frame, $hbmp)
    DllClose($h_NTDLL_DLL)
    DllClose($h_MSIMG32_DLL)
    DllClose($gdi32)
    Exit
    EndFunc ;==>_Exit

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

    Func _Delete_Bitmap32($hDC, $hbmp)
    _WinAPI_DeleteObject($hbmp)
    _WinAPI_ReleaseDC(0, $hDC)
    EndFunc ;==>_Delete_Bitmap32

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

    Func _CreateNewBmp32($iWidth, $iHeight, ByRef $ptr, ByRef $hbmp) ;erstellt leere 32-bit-Bitmap; Rückgabe DC und ptr und handle auf die Bitmapdaten
    ;by Andy
    Local $hcdc = _WinAPI_CreateCompatibleDC(0) ;Desktop-Kompatiblen DeviceContext erstellen lassen
    Local $tBMI = DllStructCreate($tagBITMAPINFO) ;Struktur der Bitmapinfo erstellen und Daten eintragen
    DllStructSetData($tBMI, "Size", DllStructGetSize($tBMI) - 4);Structgröße abzüglich der Daten für die Palette
    DllStructSetData($tBMI, "Width", $iWidth)
    DllStructSetData($tBMI, "Height", -$iHeight) ;minus =standard = bottomup
    DllStructSetData($tBMI, "Planes", 1)
    DllStructSetData($tBMI, "BitCount", 32) ;32 Bit = 4 Bytes => AABBGGRR
    Local $adib = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBMI), 'uint', $DIB_RGB_COLORS, 'ptr*', 0, 'ptr', 0, 'uint', 0)
    $hbmp = $adib[0] ;hbitmap handle auf die Bitmap, auch per GDI+ zu verwenden
    $ptr = $adib[4] ;pointer auf den Anfang der Bitmapdaten, vom Assembler verwendet
    ;_arraydisplay($adib)
    _WinAPI_SelectObject($hcdc, $hbmp) ;objekt hbitmap in DC
    Return $hcdc ;DC der Bitmap zurückgeben
    EndFunc ;==>_CreateNewBmp32

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

    Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $hGUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
    EndFunc ;==>WM_NCHITTEST

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

    Func _C($a, $b)
    Switch $b
    Case 0 ;Y
    Return @DesktopHeight / 2 - $a / 2
    Case 1 ;X
    Return @DesktopWidth / 2 - $a / 2
    EndSwitch
    EndFunc ;==>_C

    [/autoit]

    lg
    Mars(i)

  • Hi,
    ich hol den Thread mal aus dem Keller, hab eben im ASM-Forum einen Thread gefunden, mit einer BANDIT-Formel^^

    Mit bissl Phantasie erkennt man einen mexikanischen Banditen mit Sombrero, hab mal die Augen und den Mund ergänzt, färb das mal jemand ein....

    Spoiler anzeigen
    [autoit]

    $user32 = DllOpen("user32.dll")
    $gdi32 = DllOpen("gdi32.dll")
    $w = 640
    $h = 480

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

    Global $pi = 4 * ATan(1)

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

    $hgui = GUICreate("Bandit", $w, $h)
    $hdc_gui = getdc($hgui)
    GUISetState()

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

    $radian = ATan(1) / 45
    $radius = 125
    $col = 0;0xFF00FF0F
    For $deg1 = 0 To 360 Step 1

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

    $c1 = Cos($deg1 * $radian)
    $s1 = Sin($deg1 * $radian)

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

    $x1 = $radius * $c1
    $y1 = $radius * $s1

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

    pix($hdc_gui, $w / 2 + $x1 / 5 - 50, $h / 2 + $y1 / 10, $col);auge
    pix($hdc_gui, $w / 2 + $x1 / 5 + 50, $h / 2 + $y1 / 10, $col)

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

    pix($hdc_gui, $w / 2 + $x1 / 15 - 45, $h / 2 + $y1 / 15 + 5, $col);pupille
    pix($hdc_gui, $w / 2 + $x1 / 15 + 45, $h / 2 + $y1 / 15 + 5, $col)

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

    pix($hdc_gui, $w / 2 + $x1 / 20 - 45, $h / 2 + $y1 / 20 + 5, $col);pupille2
    pix($hdc_gui, $w / 2 + $x1 / 20 + 45, $h / 2 + $y1 / 20 + 5, $col)

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

    pix($hdc_gui, $w / 2 + $x1 / 1.4, $h / 2 + $s1*$y1 / 2 + 100, $col);mund
    pix($hdc_gui, $w / 2 + $x1 / 1.2, $h / 2 + $s1*$y1 / 2 + 90, $col);mund

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

    For $deg2 = 0 To 360 Step .5

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

    $c2 = Cos($deg2 * $radian)
    $s2 = Sin($deg2 * $radian)

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

    $x2 = $radius * $c2 * $c2 * Cos(Cos($deg2 * $s1 * $c2 * $radian) * $c1) * $c2 * $c2 / $c1 * $s1 * Cos($deg2 * $radian * $c1)
    $y2 = $radius * $s2 * $s2 * Sin(Cos($deg2 * $c1 * $s2 * $radian) * $s1) * $s2 * $s2 / $s1 * $s1 * Sin($deg2 * $radian * $s1)
    ; $col = Int($c2 * $x2 * $deg2 ^ 2 + $s2 * $y2 * $deg2 ^ 2)
    ;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $col = ' & $col & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    pix($hdc_gui, $w / 2 + $x1 + $x2, $h / 2 + $y1 + $y2, $col)
    Next
    Next

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

    While GUIGetMsg() <> -3
    WEnd

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

    Func atan2($y, $x)
    Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y))))
    EndFunc ;==>atan2

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

    Func pix($dc, $x, $y, $color) ;pixel mit farbe an koordinaten setzen
    DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>pix

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

    Func GetDC($handle)
    $dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
    Return $dc[0]
    EndFunc ;==>GetDC

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