Beiträge von UEZ
-
-
minx: hast du gerreg.au3 auch in einer leserlichen Version da?
Cooles Ding.


Jetzt würde mich noch die Erklärungen der einzelnen "Chapters" interessieren.
Und was ist Kodek?
Gruß,
UEZ -
Hier die Portierung des Diamond-Square Algorithmuses von C#.
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
;http://en.wikipedia.org/wiki/Diamond-square_algorithm
;converted from http://www.smokycogs.com/blog/plasma-fractals/
#include <GDIPlus.au3>_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]
Global $iW = 512, $iH = 512, $bPreview = False, $f = ($iW > $iH) ? $iW / $iH : $iH / $iW, $iRecursion = 0, $fPerc
Global $hGUI = GUICreate("Cloud Generator using Diamond-Square Algorithm", $iW, $iH, -1, -1)
Global $iPic = GUICtrlCreatePic("", 0, 0, $iW, $iH)
Global $iLabel = GUICtrlCreateLabel("Please wait...", 1, $iH - 12, $iW, 12)
GUICtrlSetBkColor(-1, -2)
GUISetState()Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH), $hBmp_GDI
[/autoit] [autoit][/autoit] [autoit]
AdlibRegister("Show_Perc", 250)
Local $s, $t = TimerInit()
Generate($iW, $iH, 3)
$s = TimerDiff($t)
AdlibUnRegister("Show_Perc")
ConsoleWrite($s & " ms / Recursion calls: " & $iRecursion & " / Pixels set: " & $iW * $iH & " / Speed: ~" & Round($iW * $iH / $s * 1000, 2) & " px/s" & @CRLF)
$hBmp_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172, 0x0000, $hBmp_GDI))
_WinAPI_DeleteObject($hBmp_GDI)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_Shutdown()Do
[/autoit] [autoit][/autoit] [autoit]
Until GUIGetMsg() = -3Func Show_Perc()
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetData($iLabel, "Please wait..." & (StringFormat("%.2f %", $iRecursion / ($f * ($iW * $iH) / 3) * 100)))
EndFuncFunc DivideGrid($x, $y, $width, $height, $c1, $c2, $c3, $c4, $gBigSize, $gRoughness)
[/autoit] [autoit][/autoit] [autoit]
Local $Edge1, $Edge2, $Edge3, $Edge4, $Middle
Local $newWidth = $width / 2
Local $newHeight = $height / 2
If ($width > 1) Or ($height > 1) Then
$iRecursion += 1
$Middle = (($c1 + $c2 + $c3 + $c4) / 4) + Displace($newWidth + $newHeight, $gBigSize, $gRoughness); Randomly displace the midpoint!
$Edge1 = (($c1 + $c2) / 2) ; Calculate the edges by averaging the two corners of each edge.
$Edge2 = (($c2 + $c3) / 2) ;
$Edge3 = (($c3 + $c4) / 2) ;
$Edge4 = (($c4 + $c1) / 2) ;
;Make sure that the midpoint doesn't accidentally "randomly displaced" past the boundaries!
$Middle= Rectify($Middle) ;
$Edge1 = Rectify($Edge1) ;
$Edge2 = Rectify($Edge2) ;
$Edge3 = Rectify($Edge3) ;
$Edge4 = Rectify($Edge4) ;
;Do the operation over again for each of the four new grids.
DivideGrid($x, $y, $newWidth, $newHeight, $c1, $Edge1, $Middle, $Edge4, $gBigSize, $gRoughness);
DivideGrid($x + $newWidth, $y, $width - $newWidth, $newHeight, $Edge1, $c2, $Edge2, $Middle, $gBigSize, $gRoughness);
DivideGrid($x + $newWidth, $y + $newHeight, $width - $newWidth, $height - $newHeight, $Middle, $Edge2, $c3, $Edge3, $gBigSize, $gRoughness);
DivideGrid($x, $y + $newHeight, $newWidth, $height - $newHeight, $Edge4, $Middle, $Edge3, $c4, $gBigSize, $gRoughness);
Else ; This is the "base case," where each grid piece is less than the size of a pixel.
; The four corners of the grid piece will be averaged and drawn as a single pixel.
Local $c = ($c1 + $c2 + $c3 + $c4) / 4
Local $r = Int(0xFF - 0xFF * $c), $g = Int(0xFF - 0xFF * $c), $b = Int(0xFF - 0xFF * $c / 2)
Local $color = "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $x, "int", $y, "uint", $color)
;~ _GDIPlus_BitmapSetPixel($hBitmap, $x, $y, $color)
If ($width = 2) Then
DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $x + 1, "int", $y, "uint", $color)
;~ _GDIPlus_BitmapSetPixel($hBitmap, $x + 1, $y, $color)
ElseIf ($height = 2) Then
DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $x, "int", $y + 1, "uint", $color)
;~ _GDIPlus_BitmapSetPixel($hBitmap, $x, $y + 1, $color)
ElseIf ($width = 2) And ($height = 2) Then
DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $x + 1, "int", $y + 1, "uint", $color)
;~ _GDIPlus_BitmapSetPixel($hBitmap, $x + 1, $y + 1, $color)
EndIf
If $bPreview Then
$hBmp_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172, 0x0000, $hBmp_GDI))
_WinAPI_DeleteObject($hBmp_GDI)
EndIf
EndIf
EndFuncFunc Generate($iWidth, $iHeight, $iRoughness)
[/autoit] [autoit][/autoit] [autoit]
DivideGrid(0, 0, $iWidth, $iHeight, Random(0, 0.99999), Random(0, 0.99999), Random(0, 0.99999), Random(0, 0.99999), $iWidth + $iHeight, $iRoughness)
Return True
EndFuncFunc Rectify($iNum)
[/autoit] [autoit][/autoit] [autoit]
If $iNum < 0 Then Return $iNum = 0
If $iNum > 1 Then Return $iNum = 1
;~ $iNum = ($iNum < 0) ? 0 : $iNum
;~ $iNum = ($iNum > 1.0) ? 1 : $iNum
Return $iNum
EndFuncFunc Displace($SmallSize, $gBigSize, $gRoughness)
[/autoit]
Return (Random(0, 1) - 0.5) * $SmallSize / $gBigSize * $gRoughness
EndFuncHier kann man schön die Grenzen von AutoIt sehen, was die Geschwindigkeit angeht. Mein Notebook schaft ca. 15000 Pixels pro Sekunde.
Gruß,
UEZ -
Die Szene ist eigentlich eine fast "brotlose Kunst". Wenn ich mir z.B. die 64kb Gewinner Demo anschauen, dann ziehe ich den Hut!.
Mercury 64kb winner @ revision 2014
So was in 64kb unterzubringen ist echte Kunst, mal ganz abgesehen von den Programmierkünsten. Oder die 8kb Demo von Loonies ist auch beeindruckend! ->The Bridge
PC Demo Sieger cocoon: Observatory
Gruß,
UEZ -
Du kannst auch die Windows API dazu benutzen: http://www.autoitscript.com/forum/topic/11…fldrdll-library
Gruß,
UEZ -
-
Alles Gute zum 33.
Gruß,
UEZ -
In der aktuellen AutoIt sollten die GDI+ Funktionen beschrieben sein.
CreatBitmapFromScan0 erstellt einfach eine leere Bitmap, nicht mehr, nicht weniger.
Gruß,
UEZ -
Probiere es mal damit:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <ButtonConstants.au3>
#include <GdiPlus.au3>
#Include <Array.au3>
#include <EditConstants.au3>;~ #include <_GUIBox.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <Misc.au3>_GDIPlus_Startup() ;Gdi+ starten
[/autoit] [autoit][/autoit] [autoit]
;------------------------------------------------------------
Global $vXs,$vXe,$vYs,$vYe,$vSpalte,$vZeile,$vStarX,$vEndX,$vStarY,$vEndY,$vDurchlauf,$vMaxDurchlauf,$vBereichX,$vBereichY,$vmI,$vmD
Global $vBreiteGrafik, $vHoeheGrafik, $vStartGrafikX, $vStartGrafikY, $vSteppX, $vSteppY
Global $Ratio1, $Ratio2, $Ratio3, $aMPos[4],$vRatio
Global $vDisplayBreite, $vDisplayHoeheGlobal $nMsg,$hGraphic,$hPinsel,$vInteration,$aFarben[0],$vFarbanzahl,$vStop,$hBitmap,$hBuffer,$vStepp,$hKopie,$dc
[/autoit] [autoit][/autoit] [autoit]$user32 = DllOpen("user32.dll")
[/autoit] [autoit][/autoit] [autoit]
$gdi32 = DllOpen("gdi32.dll")$vDisplayBreite=@DesktopWidth-20;
[/autoit] [autoit][/autoit] [autoit]
$vDisplayHoehe=@DesktopHeight-20;
$vStartGrafikX=10
$vStartGrafikY=10$hWBild = GUICreate("Fraktal",$vDisplayBreite,$vDisplayHoehe-20, -1, 0)
[/autoit] [autoit][/autoit] [autoit]
$dc = GetDC(WinGetHandle($hWBild))
$hBitmap_Save = _GDIPlus_BitmapCreateFromScan0($vDisplayBreite,$vDisplayHoehe-20)
$hWDaten=GUICreate("FFP - Datenfenster",$vDisplayBreite,150,-1,@DesktopHeight-170,-1,-1,$hWBild); Eingabe der Eckdaten zur Berechnung
[/autoit] [autoit][/autoit] [autoit]
GUICtrlCreateGroup("Werte für die X - und Y - Achse",5,4,236,113)
GUICtrlCreateLabel("Startwert:",37,19)
GUICtrlCreateLabel("Endwert:",140,19)
GUICtrlCreateLabel("X:",12,39)
$vStartX=GUICtrlCreateInput("-2.50", 28, 35, 100, 20)
$vEndX=GUICtrlCreateInput("+1.00", 131, 35, 100, 20)
GUICtrlCreateLabel("Y:",13,61)
$vStartY=GUICtrlCreateInput("-1.40", 28, 58, 100, 20)
$vEndY=GUICtrlCreateInput("+1.40", 131, 58, 100, 20)
$lBreiteX_Achse=GUICtrlCreateLabel("Wert X-Achse: ",12,81,200,12)
$lBreiteY_Achse=GUICtrlCreateLabel("Wert Y-Achse: ",12,97,200,12)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; Eingabe der Eckdaten zur Berechnung
GUICtrlCreateGroup("",250,4,180,62)
GUICtrlCreateLabel("max. Durchläufe:",275,19)
$vMaxDurchlauf=GUICtrlCreateInput("100", 360, 17, 60, 20)
GUICtrlCreateLabel("Höchstwert Iteration:",259,41)
$vMaxIteration=GUICtrlCreateInput("1000", 360, 39, 60, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
GUICtrlCreateGroup("Farbraster",250,70,180,39)
GUICtrlCreateLabel("Faktor:",296,85)
$vZoom=GUICtrlCreateInput("23", 360, 83, 60, 20)
$updown = GUICtrlCreateUpdown($vZoom)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; Gruppe Grafikgröße in Pixel
GUICtrlCreateGroup("Grafikgröße - waagerecht x senkrecht",440,4,200,62)
$vInputBeiteGrafik=GUICtrlCreateInput($vDisplayBreite, 470, 30, 60, 20) ;$vDisplayBreite
$vBeiteGrafikTMP=GUICtrlCreateUpdown($vInputBeiteGrafik)
GUICtrlCreateLabel("X",537,31)
$vInputHoeheGrafik=GUICtrlCreateInput($vDisplayHoehe, 550, 30, 60, 20)
$vHoeheGrafikTMP=GUICtrlCreateUpdown($vInputHoeheGrafik)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; Gruppe Seitenverhältnis
GUICtrlCreateGroup("Seitenverhältnis der Grafik",440,70,200,39)
$bRatio1 = GUICtrlCreateRadio("4 : 3", 450, 85, 50, 20) ; = 0.75 oder 1.33333
$bRatio2 = GUICtrlCreateRadio("16 : 9", 520, 85, 50, 20) ; = 0.5625 oder 1.777778
$bRatio3 = GUICtrlCreateRadio("ohne", 590, 85, 45, 20)
GUICtrlSetState($bRatio3, $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; ----------------------------------------------------------------------------
GUICtrlCreateGroup("Auswahl der Farbpalette",650,4,130,105)
$bPalette1 = GUICtrlCreateRadio("Farbpalette 1", 670, 30, 100, 20)
$bPalette2 = GUICtrlCreateRadio("Farbpalette 2", 670, 52, 100, 20)
$bPalette3 = GUICtrlCreateRadio("Farbpalette 3", 670, 74, 100, 20)
GUICtrlSetState($bPalette1, $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; Gruppe Prozessbar
$vGruppeProzess=GUICtrlCreateGroup("Fortschritt",$vDisplayBreite-220,79,210,30)
$vProgressbar = GUICtrlCreateProgress($vDisplayBreite-216, 92, 200, 10, $PBS_SMOOTH)
GUICtrlSetColor(-1, 32250)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Gruppe schliessen
; ------------------------------ Fußzeile ---------------------------------------------------;----------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
$bFoto=GUICtrlCreateButton("Bild speichern",$vDisplayBreite-220,8,100,20)
$bStart=GUICtrlCreateButton("Start",$vDisplayBreite-110,35,100,40,$BS_DEFPUSHBUTTON)
$bAbbrechen=GUICtrlCreateButton("Beenden",$vDisplayBreite-220,35,100,40)
GUISetState(@SW_SHOW,$hWBild)
WinActivate("Fraktal")
GUISetBkColor(0X000000)
GUISetState(@SW_SHOW,$hWDaten)GUISwitch($hWDaten)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
;~ $nMsg=GUIGetMsg()
$aMsg = GUIGetMsg(1)
If $aMsg[1]=$hWBild Then
Switch $aMsg[0]
Case $GUI_EVENT_PRIMARYDOWN
;~ $aRubberGBox=_GBoxCreate("",2,0xFF0000)
$aMPos[0]=MouseGetPos(0)
$aMPos[1]=MouseGetPos(1)
while _IsPressed("01",$user32)
$aMPos[2]=MouseGetPos(0)
$aMPos[3]=MouseGetPos(1)
;~ MsgBox(0,"$vRatio",$vRatio)
;~ $aMPos[3]=$aMPos[1]+($aMPos[2]-$aMPos[0])*0.75;~ $vRatioTMP=($aMPos[2]-$aMPos[0])*$vRatio
[/autoit] [autoit][/autoit] [autoit]
;~ ToolTip("Position: "&$aMPos[0]&"x"&$aMPos[1]&" - - "&$aMPos[2]&"x"&$aMPos[3]&" R: "&$vRatio)
;~ _GBoxShowAt($aRubberGBox,$aMPos[0],$aMPos[1],$aMPos[2],$aMPos[3])
Sleep(10)
WEnd
KoordinatenNeu()
;~ _GBoxDestroy($aRubberGBox)
EndSwitch
ElseIf $aMsg[1]=$hWDaten Then
Switch $aMsg[0]
Case $bFoto
Fraktal_speichern()
Case $bStart ;46
Start()
Case $bAbbrechen
Abbrechen()
Case $bRatio1
$vRatio=Verhaeltniss(1)
Case $bRatio2
$vRatio=Verhaeltniss(2)
Case $bRatio3
$vRatio=Verhaeltniss(3)
EndSwitch
EndIf
WEnd; ---------------------------------------------------------------------------------------------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
Func Start()
EingabeAuslesen()
GUICtrlSetData($bStart,"STOP")
GUICtrlSetBkColor($bStart,0x777777)
GUICtrlSetData($lBreiteX_Achse,"Wert X-Achse: "&StringFormat("%.18f",$vBereichX))
GUICtrlSetData($lBreiteY_Achse,"Wert Y-Achse: "&StringFormat("%.18f",$vBereichY))
GUISetState(@SW_SHOW,$hWBild)
WinActivate("Fraktal")
GUISetBkColor(0X000000)
GUISetState(@SW_SHOW,$hWDaten)FarbTab_anlegen($vStepp)
[/autoit] [autoit][/autoit] [autoit]
HotKeySet("{ESC}","CheckMaus")
WinSetTitle($hWDaten,"","FFP - Datenfenster - - - 'ESC' stopt die Berechnung")
Modul1()
EndFuncFunc KoordinatenNeu()
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetData($vStartX, $vXs+$vSteppX*($aMPos[0]-20))
GUICtrlSetData($vEndX,$vXs+$vSteppX*($aMPos[2]-20))
GUICtrlSetData($vStartY, $vYs+$vSteppY*($aMPos[1]-35))
GUICtrlSetData($vEndY,$vYs+$vSteppY*($aMPos[3]-35))
EndFuncFunc Modul1() ;Formel Apfelbrot original
[/autoit] [autoit][/autoit] [autoit]$vBeginn=TimerInit()
[/autoit] [autoit][/autoit] [autoit]
$vStop=0
$vYi=$vYs
;~ MsgBox(0,"","Breite von "&$vStartGrafikX&" - "&$vBreiteGrafik+$vStartGrafikX)
For $vZeile=$vStartGrafikY to $vHoeheGrafik ; Pixel auf Y-Achse durchtackern
GUICtrlSetData($vProgressbar, $vZeile*100/($vHoeheGrafik))
GUICtrlSetData($vGruppeProzess,"Berechnet: "&StringFormat("%.2f",$vZeile*100/($vHoeheGrafik))&"%")
$vYi=$vYi+$vSteppY
$vXi=$vXs
For $vSpalte=$vStartGrafikX to $vBreiteGrafik ; Pixel auf der X-Achse
$vXi=$vXi+$vSteppX
;Berechnung des Fraktals
$vDurchlauf=0
$vInteration=0
$vXt=0
$vYt=0
$vP=0
While $vP=0
$vX_tmp=$vXt*$vXt-$vYt*$vYt+$vXi
$vYt=2*$vXt*$vYt+$vYi
$vXt=$vX_tmp
$vDurchlauf+=1
;~ $vInteration=$vXt*$vXt+$vYt*$vYt
If ($vXt*$vXt+$vYt*$vYt)>$vmI Or $vDurchlauf>$vmD Then ExitLoop
WEnd
setPixel($dc,$vSpalte,$vZeile,Farbwert($vDurchlauf,$vmD)) ; DLL Funktion
if $vStop=1 Then
$vSpalte=$vBreiteGrafik+$vStartGrafikX
$vZeile=$vHoeheGrafik+$vStartGrafikY
EndIf
Next
Next
Fraktal_speichern()
GUICtrlSetData($bStart,"Start")
;~ MsgBox(0,"Rechenzeit","Dauer: "&Minute(timerdiff($vBeginn)))
EndFuncFunc CheckMaus()
[/autoit] [autoit][/autoit] [autoit]
;~ Opt("GUIOnEventMode",0)
$vStop=1
WinSetTitle($hWDaten,"","FFP - Datenfenster - - - Mit 'ESC' Berechnung gestoppt !")
GUICtrlSetData($bStart,"Start")
EndFuncFunc Fraktal_speichern()
[/autoit] [autoit][/autoit] [autoit]
$vDateiName=@ScriptDir&"\Bilder\Test_1.jpg"
ConsoleWrite($vDateiName)
If _GDIPlus_ImageSaveToFile($hBitmap_Save,$vDateiName)Then ;Test: _"&@YEAR&@MON&@MDAY&"-"&@HOUR&":"&@MIN&":"&@SEC&"
MsgBox(0,"Speichern ....","Bild wurde erfolgreich gespeichert !!! "&@error,3)
Else
MsgBox(0,"Error",@error)
EndIf
EndFuncFunc Farbwert($vDurchlauf,$vmD)
[/autoit] [autoit][/autoit] [autoit]
;~ ConsoleWrite ("Farbe: "&$vColor&" - ")
if $vDurchlauf>$vmD Then
$vColor=0x000000
Else
$vColor="0x"&$aFarben[int(Int($vDurchlauf*100/$vmD)*($vFarbanzahl-1)/100)]
EndIf
Return $vColor
EndFuncFunc FarbTab_anlegen($vStepp)
[/autoit] [autoit][/autoit] [autoit]
Switch $vStepp
Case 1,2,4,8,16,32,64,128
$vFarbanzahl=Int(256/$vStepp)^3
Case Else
$vFarbanzahl=Int(256/$vStepp+1)^3
EndSwitch
ToolTip("Generiere Farbtabelle mit "&$vFarbanzahl&"Farben")
Dim $aFarben[$vFarbanzahl]
;~ ConsoleWrite("Array-Farbzahl: "&$vFarbanzahl&@CR&@CR)
$vNr=0
For $vR=0 To 255 Step $vStepp
For $vG=0 To 255 Step $vStepp
For $vB=0 To 255 Step $vStepp
$aFarben[$vNr]=Hex($vR,2)&Hex($vG,2)&Hex($vB,2)
$vNr+=1
Next
Next
Next
ToolTip("")
;~ _ArrayDisplay($aFarben)
EndFuncFunc Abbrechen()
[/autoit] [autoit][/autoit] [autoit]
;~ _GDIPlus_BrushDispose($hPinsel)
;~ _GDIPlus_PenDispose($hPinsel)
_GDIPlus_BitmapDispose($hBitmap_Save)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hBitmap)
_GDIPlus_GraphicsDispose($hKopie)
_GDIPlus_GraphicsDispose($hBuffer)
_GDIPlus_Shutdown()
DllClose($user32)
DllClose($gdi32)
_GDIPlus_Shutdown()
Exit
EndFuncFunc Verhaeltniss($vRatio)
[/autoit] [autoit][/autoit] [autoit]
Select
Case $vRatio=1
GUICtrlSetStyle($vInputHoeheGrafik,$ES_READONLY)
GUICtrlSetData($vInputHoeheGrafik,int(StringReplace(GUICtrlRead($vInputBeiteGrafik),".","")/4*3))
$vRatio=1/4*3
Case $vRatio=2
GUICtrlSetStyle($vInputHoeheGrafik,$ES_READONLY)
GUICtrlSetData($vInputHoeheGrafik,int(StringReplace(GUICtrlRead($vInputBeiteGrafik),".","")/16*9))
$vRatio=1/16*9
; Code folgt noch
Case $vRatio=3
GUICtrlSetStyle($vInputHoeheGrafik,$GUI_SS_DEFAULT_INPUT)
$vRatio=1/GUICtrlRead($vInputBeiteGrafik)*GUICtrlRead($vInputHoeheGrafik)
EndSelect
;~
Return $vRatio
EndFuncFunc EingabeAuslesen()
[/autoit] [autoit][/autoit] [autoit]
$vXs=GUICtrlRead($vStartX) ;Startwert für X
$vXe=GUICtrlRead($vEndX) ;Endwert für X
$vYs=GUICtrlRead($vStartY) ;Startwert für Y
$vYe=GUICtrlRead($vEndY) ;Endwert für Y
$vmD=GUICtrlRead($vMaxDurchlauf) ;maxAnzahl der Dürchläufe
$vmI=GUICtrlRead($vMaxIteration) ;MaxWert Iteration
$vStepp=GUICtrlRead($vZoom) ;Farbfaktor auslesen
$vBreiteGrafik=GUICtrlRead($vInputBeiteGrafik) ; Grafikbreite auslesen
$vHoeheGrafik=GUICtrlRead($vInputHoeheGrafik) ;Grafikhöhe auslesen
$vPalette1=BitAND(GUICtrlRead($bPalette1), $GUI_CHECKED) ;Wleche Palette ist aktiv
$vPalette2=BitAND(GUICtrlRead($bPalette2), $GUI_CHECKED)
$vPalette3=BitAND(GUICtrlRead($bPalette3), $GUI_CHECKED)
; Wertebereich ermitteln
If $vXs<0 and $vXe<0 Then $vBereichX=($vXs+$vXe*-1)*-1
If $vXs<0 and $vXe>0 Then $vBereichX=$vXs*-1+$vXe
If $vXs>0 and $vXe>0 Then $vBereichX=$vXe-$vXs
If $vYs<0 and $vYe<0 Then $vBereichY=($vYs+$vYe*-1)*-1
If $vYs<0 and $vYe>0 Then $vBereichY=$vYs*-1+$vYe
If $vYs>0 and $vYe>0 Then $vBereichY=$vYe-$vYs
$vSteppX=$vBereichX/$vBreiteGrafik ;Schritweite für X errechnen
$vSteppY=$vBereichY/$vHoeheGrafik ;Schritweite für Y errechnen
EndFuncFunc setpixel($dc, $x, $y, $color) ;pixel mit farbe an koordinaten setzen
[/autoit] [autoit][/autoit] [autoit]
DllCall($gdi32, "long", "SetPixel", "long", $dc, "long", $x, "long", $y, "long", $color)
_GDIPlus_BitmapSetPixel($hBitmap_Save, $x, $y, 0xFF000000 + $color)
EndFunc ;==>pixFunc GetDC($handle)
[/autoit] [autoit][/autoit] [autoit]
$dc = DllCall($user32, "int", "GetDC", "hwnd", $handle)
Return $dc[0]
EndFunc ;==>GetDCFunc Minute($zLZ)
[/autoit]
$tM=-1
$th=-1
$zLZ=int($zLZ/1000)
for $tI=$zLZ to 0 step -60 ;Minuten ausrechnen
$tM+=1
Next
If $tM>59 Then
for $tI=$tM to 0 step -60 ;Stunden ausrechnen
$th+=1
Next
EndIf
If $tM<1 Then
$zLZ=$zLZ&" Sekunden"
ElseIf $tM>=1 And $th<1 Then
$zLZ=$tM&"."&StringFormat("%02s",$zLZ-$tM*60)&" Minuten"
ElseIf $tM>=1 And $th>=1 Then
$zLZ=$th&"."&$tM-$th*60&"."&StringFormat("%02s",$zLZ-$tM*60)&" Stunden"
EndIf
Return $zLZ
EndFuncIch habe die Funktionen aus _GUIBox.au3 auskommentiert...
Gruß,
UEZ -
Ein nicht lauffähiges Skript ist nicht besonders hilfreich, aber hier einige Hinweise:
_GDIPlus_GraphicsDrawRect($hGraphic, $aMPos[0], $aMPos[1],MouseGetPos(0)-$aMPos[0],MouseGetPos(1)-$aMPos[1],$hPinsel) schreibt direkt in den Graphic Handle und nicht in die Bitmap, somit bekommst du "nur" leere Bitmaps. D.h. du musst ein Graphic Context erstellen und deine Graphic Operationen in den Graphic Context schreiben, so dass diese in die Bitmap gewrappt wird.
Um direkt in die Bitmap einen Pixel zu setzen, kannst du auch _GDIPlus_BitmapSetPixel() benutzen. Damit würdest du dir die Konvertierung zwischen GDI und GDI+ sparen.
Gruß,
UEZ -
Schaue dir einfach mal diese UDF an: Active Directory Funktionen - Neue Version 1.4.1.0 freigegeben!
Gruß,
UEZ -
Probiere es mal damit (nicht getestet):
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Startup()
;Das ganze ist ein Geburtstagskalender, der mir an dem heutigen Tag die Info und ein Bild, von
;dem jenigen anzeigt, der Geburtstag hat. Über ein Datumsfeld kann man gezielt zu einem bestimmten
;Datum springen. Hier ein Teil des Codes...
;GUICtrlCreatePng springt in die Funktion GUICtrlCreatePng.. übergibt Filepath und "IniFileLine7", das ist ein Leeres Jpg
;um vorhergehende Bilder zu löschen .
func start()While 1
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()
Select
case $msg = $cal
;~ Hier wird das Label zurückgesetzt
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,30,80,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,320,80,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,610,80,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,30,200,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,320,200,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,610,200,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,30,320,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,320,320,98)
GUICtrlCreatePng(0,$filepath_pic&$IniFileLine7,610,320,98)
GUICtrlSetData ($Label, "")
GUICtrlSetData ($Label1, "")
GUICtrlSetData ($Label2, "")
GUICtrlSetData ($Label3, "")
GUICtrlSetData ($Label4, "")
GUICtrlSetData ($Label5, "")
GUICtrlSetData ($Label6, "")
GUICtrlSetData ($Label7, "")
GUICtrlSetData ($Label8, "")
GUICtrlSetData ($Label9, "")
connect()
case $msg = $GUI_EVENT_CLOSE
Exit
case $msg = $beenden
Exit
;~ Bilderpfad für vergrößerte Bilder
case $msg = $Pict1
$bigpic_var= $Picture1
GUICtrlCreatePng1($Pict1,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict2
$bigpic_var= $Picture2
GUICtrlCreatePng1($Pict2,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict3
$bigpic_var= $Picture3
GUICtrlCreatePng1($Pict3,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict4
$bigpic_var= $Picture4
GUICtrlCreatePng1($Pict4,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict5
$bigpic_var= $Picture5
GUICtrlCreatePng1($Pict5,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict6
$bigpic_var= $Picture6
GUICtrlCreatePng1($Pict6,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict7
$bigpic_var= $Picture7
GUICtrlCreatePng1($Pict7,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict8
$bigpic_var= $Picture8
GUICtrlCreatePng1($Pict8,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $Pict9
$bigpic_var= $Picture9
GUICtrlCreatePng1($Pict9,$filepath_pic&$bigpic_var,30,80,$IniFileLine4)
case $msg = $help
$x = $x + 1
Help()
case $msg = $dropdown_name
NameSelect()
case $msg = $mzi
SplashTextOn ("Kontakt", "M" & @LF & "Beter"&@LF& "urg.cat"&@LF&@LF&"Dieses Fenster schließt sich automatisch!", 250,100, @DesktopWidth/2-125, @DesktopHeight/2-100,5, "calibri", 10)
sleep(3000)
SplashOff()
EndSelect
WEnd
EndFunc;~ Bilder (klein) erstellen
[/autoit] [autoit][/autoit] [autoit]
Func GUICtrlCreatePng($iCtrl, $filepath_pic, $iPNG_Left = 0, $iPNG_Top = 0, $factor=0)
Local $hImagePNG = _GDIPlus_ImageLoadFromFile($filepath_pic)
Global $iPNG_Width = _GDIPlus_ImageGetWidth($hImagePNG)
Global $iPNG_Height = _GDIPlus_ImageGetHeight($hImagePNG)
Local $iPNG_faktor= $iPNG_Width/$factor
Local $hBmp = _GDIPlus_ImageResize($hImagePNG, $iPNG_Width/$iPNG_faktor,$iPNG_Height/$iPNG_faktor) ;GDI+ Bitmap
Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) ;GDI Bitmap!
If $iCtrl Then GUICtrlSendMsg($iCtrl, 0x0172, 0, $hHBitmap)
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_ImageDispose($hImagePNG)EndFunc ;==>GUICtrlCreatePng
[/autoit]Du kannst auch _GDIPlus_ImageScale() zum Skalieren benutzen, wenn du das Bild faktorisiert ändern möchtest.
Gruß,
UEZ -
Echt coole Effekte

Ich sehe, dass du jetzt die Strukt und somit Punkt Notation bevorzugst. Ist einfacher zu überblicken - sollte ich mir auch angewöhnen.

Gruß,
UEZ -
Brick,
vielleicht solltest du den vollständigen Code posten, damit wir korrigieren können. Nur Fragmente bringen nicht viel!
Gruß,
UEZ -
Probiere es mal damit:
[autoit]
[/autoit]
Local $hBmp = _GDIPlus_ImageResize($hImagePNG, 300,500) ;GDI+ Bitmap
Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp) ;GDI Bitmap!
Local $iPNG_faktor= $iPNG_Width/300
Local $iPNG_Height_res= $iPNG_Height/$iPNG_faktor
Local $iPNG_Width_res = $iPNG_Width/$iPNG_faktor
Local $cPNG_PIC = GUICtrlCreatePic("", $iPNG_Left, $iPNG_Top, $iPNG_Width_res, $iPNG_Height_res)
GUICtrlSendMsg($cPNG_PIC, 0x0172, 0, $hHBitmap)
_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_ImageDispose($hImagePNG)Gruß,
UEZ -
Die Zeile
[autoit]
[/autoit]
Local $hBmp = _GDIPlus_ImageResize(_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImagePNG), 300,500)
mach so keinen Sinn, denn du übergibst der Funktion GDIPlus_ImageResize() ein GDI Handle und kein GDI+ Handle!Also das Bild vorher skalieren, in ein GDI Bild umwandeln und zum Pic Control schicken.
Gruß,
UEZ -
Einfach nur cooooooooooool

Gruß,
UEZ -
Probiere es mal damit:
[autoit]
[/autoit][autoit][/autoit][autoit]
#include <Clipboard.au3>
#include <Screencapture.au3>$hHBmp = _ScreenCapture_Capture("", 0, 0, 100, 100)
[/autoit][autoit][/autoit][autoit]
$hClipboard_Bitmap = _WinAPI_CopyImage($hHBmp, 0, 0, 0, BitOR($LR_COPYDELETEORG, $LR_COPYRETURNORG))_ClipBoard_Open(0)
[/autoit]
_ClipBoard_Empty()
_ClipBoard_SetDataEx($hClipboard_Bitmap, $CF_BITMAP)
_ClipBoard_Close()
_WinAPI_DeleteObject($hClipboard_Bitmap)
_WinAPI_DeleteObject($hHBmp)Gruß,
UEZ -
Du musst das Bild, das du per Screenshot erstellt hast, in ein Clipboard Format umwandeln.
Die Umwandlung mit einem GDI Bild, nicht GDI+, geht über die Funktion _WinAPI_CopyImage(), das du mit _ClipBoard_SetDataEx() in den Zwischenspeicher kopieren kannst.
Gruß,
UEZ -
Eukalyptus,
[Blockierte Grafik: http://i854.photobucket.com/albums/ab101/DirtyGirlMovies/mrbean.jpg]
Bleib' uns noch lange erhalten und beglück uns mit deinen tollen (GDI+) Skripten!
Gruß,
UEZ