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

Beiträge von UEZ

  • _GDIPlus_BitmapApplyFilter v0.9.6 build 2017-05-14 beta

    • UEZ
    • 3. Juli 2016 um 22:08
    Zitat von Andy

    ....und dann würdest du so aussehen wie ich

    Da fehlt nicht mehr viel. :rofl:


    Wie gesagt, da ist noch genug Raum für (ASM) Optimierungen.

    Da müsste ich erst mal die MMX / SSE Befehle richtig verstehen, damit überhaupt eine Boost erreicht werden kann. Ich glaube nicht, dass mit den Standard ASM Befehlen ich überhaupt was rausholen kann.

  • _GDIPlus_BitmapApplyFilter v0.9.6 build 2017-05-14 beta

    • UEZ
    • 3. Juli 2016 um 19:14

    Da AutoIt für Bild Effekte / Bildbearbeitung zu langsam ist, wenn die Funktion nicht in der GDIPlus DLL vorhanden sind, habe ich eine DLL mit FreeBasic programmiert, die diese Lücke schließen soll. Natürlich ist Raum für Optimierungen vorhanden!

    Folgende Filter sind implementiert:

    Code
    _GDIPlus_BitmapApplyFilter_BWJJNDithering
    _GDIPlus_BitmapApplyFilter_Cartoon1
    _GDIPlus_BitmapApplyFilter_ColorAccent
    _GDIPlus_BitmapApplyFilter_Convolution_AnotherBlur
    _GDIPlus_BitmapApplyFilter_Convolution_BoxBlur
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection1
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection2
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection3
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection4
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection5
    _GDIPlus_BitmapApplyFilter_Convolution_EdgeDetection6
    _GDIPlus_BitmapApplyFilter_Convolution_Emboss1
    _GDIPlus_BitmapApplyFilter_Convolution_Emboss45Degree
    _GDIPlus_BitmapApplyFilter_Convolution_EmbossTopLeftBottomRight
    _GDIPlus_BitmapApplyFilter_Convolution_Gaussian3x3
    _GDIPlus_BitmapApplyFilter_Convolution_Gaussian5x5_1
    _GDIPlus_BitmapApplyFilter_Convolution_Gaussian5x5_2
    _GDIPlus_BitmapApplyFilter_Convolution_GaussianBlur
    _GDIPlus_BitmapApplyFilter_Convolution_IntenseEmboss
    _GDIPlus_BitmapApplyFilter_Convolution_Kirsch
    _GDIPlus_BitmapApplyFilter_Convolution_Laplace1
    _GDIPlus_BitmapApplyFilter_Convolution_Laplace2
    _GDIPlus_BitmapApplyFilter_Convolution_Laplace3
    _GDIPlus_BitmapApplyFilter_Convolution_LaplacianOfGaussian
    _GDIPlus_BitmapApplyFilter_Convolution_ManualMatrix
    _GDIPlus_BitmapApplyFilter_Convolution_MotionBlur
    _GDIPlus_BitmapApplyFilter_Convolution_Outline3x3
    _GDIPlus_BitmapApplyFilter_Convolution_Prewitt
    _GDIPlus_BitmapApplyFilter_Convolution_Sharpen1
    _GDIPlus_BitmapApplyFilter_Convolution_Sharpen2
    _GDIPlus_BitmapApplyFilter_Convolution_Sobel
    _GDIPlus_BitmapApplyFilter_Convolution_SovelVsPrewitt
    _GDIPlus_BitmapApplyFilter_Convolution_TriangleBlur
    _GDIPlus_BitmapApplyFilter_Convolution_Unsharp
    _GDIPlus_BitmapApplyFilter_Convolution_Unsharp5x5
    _GDIPlus_BitmapApplyFilter_Dilatation
    _GDIPlus_BitmapApplyFilter_DistortionBlur
    _GDIPlus_BitmapApplyFilter_Edges
    _GDIPlus_BitmapApplyFilter_Erosion
    _GDIPlus_BitmapApplyFilter_FishEye
    _GDIPlus_BitmapApplyFilter_Indexed
    _GDIPlus_BitmapApplyFilter_Jitter
    _GDIPlus_BitmapApplyFilter_Kuwahara
    _GDIPlus_BitmapApplyFilter_Linellism
    _GDIPlus_BitmapApplyFilter_Median
    _GDIPlus_BitmapApplyFilter_Median2
    _GDIPlus_BitmapApplyFilter_OilPainting
    _GDIPlus_BitmapApplyFilter_PenSketch
    _GDIPlus_BitmapApplyFilter_PenSketch2
    _GDIPlus_BitmapApplyFilter_Pixelate
    _GDIPlus_BitmapApplyFilter_Pointillism
    _GDIPlus_BitmapApplyFilter_RadialBlur
    _GDIPlus_BitmapApplyFilter_Raster
    _GDIPlus_BitmapApplyFilter_Swirl
    _GDIPlus_BitmapApplyFilter_SymmetricNearestNeighbour
    _GDIPlus_BitmapApplyFilter_TiltShift
    _GDIPlus_BitmapApplyFilter_TimeWarp
    _GDIPlus_BitmapApplyFilter_Wave
    _GDIPlus_BitmapApplyFilter_XRay
    Alles anzeigen

    Beispiele zu den einzelnen Funktionen kann man in der Zip Dateie finden.

    Download und Screenshots hier: https://www.autoitscript.com/forum/files/fi…ilter-udf-beta/


    Die Filter in ASM zu implementieren wäre sicherlich eine Herausforderung, aber dann würden mir mit hoher Wahrscheinlichkeit die letzten Haare ausfallen... :D


    Viel Spaß beim Ausprobieren.

  • Bitte dieses Skript testen

    • UEZ
    • 26. Juni 2016 um 12:32

    Die neue Version funzt auch ohne Probleme bei mir. DL ~@1600 kb/s.

  • Bitte dieses Skript testen

    • UEZ
    • 25. Juni 2016 um 22:06

    Beim Starten kommt

    Code
    Row|Col 0|Col 1|Col 2|Col 3|Col 4|Col 5
    [0]|4|||||
    [1]|http://download.bleepingcomputer.com/Xplode/AdwCleaner.exe|AdwCleaner.exe|||1|
    [2]|http://download.iobit.com/action-center/asc920-0330.exe|Advanced_SystemCare.exe|||2|
    [3]|http://download.geo.drweb.com/pub/drweb/cureit/drweb-cureit.exe|DrWeb-CureIt.exe|||3|
    [4]|http://data-cdn.mbamupdates.com/web/JRT.exe|JRT.exe|||4|

    Am Ende kommt kein ArrayDisplay.

    Code
    Row|Col 0|Col 1|Col 2|Col 3|Col 4|Col 5
    [0]|4||182870360|182870360||
    [1]|http://download.bleepingcomputer.com/Xplode/AdwCleaner.exe|AdwCleaner.exe|3703360|3703360|Erfolg|
    [2]|http://download.iobit.com/action-center/asc920-0330.exe|Advanced_SystemCare.exe|42688424|42688424|Erfolg|
    [3]|http://download.geo.drweb.com/pub/drweb/cureit/drweb-cureit.exe|DrWeb-CureIt.exe|134867760|134867760|Erfolg|
    [4]|http://data-cdn.mbamupdates.com/web/JRT.exe|JRT.exe|1610816|1610816|Erfolg|
  • Bitte dieses Skript testen

    • UEZ
    • 25. Juni 2016 um 21:31

    Funzt bei mir ohne Probleme. Für die 178 MB kommt mir die DL Zeit etwas langsam vor.

    Deshalb anzeigen:

    • DL Speed
    • Zeit verstrichen / noch benötigt
  • Übersetzung nach FreeBasic

    • UEZ
    • 12. Juni 2016 um 18:46

    Wen's interessiert, hier einige Beispiele, um GDI+ mit Hilfe von FreeBasic zu beschleunigen: https://www.autoitscript.com/forum/topic/18…using-freebasic

  • Tipp Spiel zur EM 2016

    • UEZ
    • 9. Juni 2016 um 22:06

    Insgesamt nur 5 Teilnehmer. :(

  • Tipp Spiel zur EM 2016

    • UEZ
    • 7. Juni 2016 um 11:18

    Bald ist es soweit, also wer noch Lust hast, einfach anmelden (siehe Post#1).

  • Übersetzung nach FreeBasic

    • UEZ
    • 3. Juni 2016 um 16:53

    Das hier funzt:

    Code
    #Include Once "win\gdiplus.bi"
    Using GDIPLUS
    
    
    Extern "Windows-MS"
    
    
    Sub Boost(ByVal hCanvas as GpGraphics Ptr, ByVal tData As Any Ptr, _
    			 iCountX As UInteger, iCountY As UInteger, _
    			 fX As Single, fY As Single, fZ As Single, fW As Single, fH As Single, fScale As Single) Export
    
    	Dim As UInteger c, iUBound, iSingle
    	Dim As Single Ptr pX, pY, pZ, pfX, pfY, pFZ
    	Dim As UInteger Ptr pPen
    
    	Dim As Single fCosRotX, fSinRotX, fCosRotY, fSinRotY, fCosRotZ, fSinRotZ, f1, f2, f3, f4, f5, f6, fXPos, fYPos, fZPos, fZPerspCorrection, fZDeepCorrection
    
    	iUBound = iCountX * iCountY + iCountX + iCountY + 1
    	iSingle = SizeOf(Single)
    	fZDeepCorrection = 1000.0
    
    	For c = 0 To iUbound - 1
    
    			pX = tData '+ 0 * iUBound + 0 * iSingle
    			pY = tData + 1 * iUBound * iSingle
    			pZ = tData + 2 * iUBound * iSingle
    			pfX = tData + 3 * iUBound * iSingle
    			pfY = tData + 4 * iUBound * iSingle
    			pfZ = tData + 5 * iUBound * iSingle
    			pPen = tData + 6 * iUBound * iSingle
    
    
    
    			fCosRotX = Cos(fX)
    			fSinRotX = Sin(fX)
    			fCosRotY = Cos(fY)
    			fSinRotY = Sin(fY)
    			fCosRotZ = Cos(fZ)
    			fSinRotZ = Sin(fZ)
    
    			f1 = fCosRotY * pX[c]
    			f2 = fSinRotX * pY[c]
    			f3 = fCosRotX * pZ[c]
    			f4 = fCosRotX * pY[c]
    			f5 = fSinRotX * pZ[c]
    			f6 = f1 - fSinRotY * (f2 + f3)
    			fXPos = (fCosRotZ * f6 - fSinRotZ * (f4 - f5)) * fScale
    			fYPos = (fSinRotZ * f6 + fCosRotZ * (f4 - f5)) * fScale
    			fZPos = (fSinRotY * pX[c] + fCosRotY * (f2 + f3)) * fScale
    			fZPerspCorrection = 1 / (fZPos / fZDeepCorrection + 1)
    			pfX[c] = fXPos * fZPerspCorrection + fW
    			pfY[c] = fYPos * fZPerspCorrection + fH
    			pfZ[c] = fZPos
    
    
    			If c > 0 Then
    				GdipDrawLine(hCanvas, pPen[c], pfX[c - 1], pfY[c - 1], pfX[c], pfY[c])
    			EndIf
    
    
    	Next
    
    
    End Sub
    
    
    End Extern
    Alles anzeigen

    Dateien

    Rutt_Etra_Izer_FX_Boosted.zip 518,96 kB – 582 Downloads
  • Übersetzung nach FreeBasic

    • UEZ
    • 3. Juni 2016 um 09:10

    Bitte sehr. :D

    Es scheint, dass die Pointer nicht stimmen!

    Edit:

    Code
    #Include Once "win\gdiplus.bi"
    Using GDIPLUS
    
    
    Extern "Windows-MS"
    
    
    /'	Local $iDim = $iCountX * $iCountY + $iCountX + $iCountY + 1
    	Local Const $tagData = "struct;float x[" & $iDim & "];float y[" & $iDim & "];float z[" & $iDim & "];float fX[" & $iDim & "];float fY[" & $iDim & "];
    									float fZ[" & $iDim & "];int pen[" & $iDim & "];endstruct"
    '/
    Sub Translate3Dto2D(tData as Any Ptr, iPos As UInteger, _
    						  fRotX As Single, fRotY As Single, fRotZ As Single, fCenterX  As Single = 0, fCenterY As Single = 0.0, _
    						  fScale As Single = 1.0, fZDeepCorrection As Single = 500.0, iCountX As UInteger, iCountY As UInteger)
    	Dim As Single fCosRotX, fSinRotX, fCosRotY, fSinRotY, fCosRotZ, fSinRotZ, f1, f2, f3, f4, f5, f6, fXPos, fYPos, fZPos, fZPerspCorrection
    	Dim As Single Ptr pX, pY, pZ, pfX, pfY, pfZ
    	Dim As UInteger iSingle, iUBound
    	iUBound = iCountX * iCountY + iCountX + iCountY + 1
    
    
    	iSingle = SizeOf(Single)
    	pX = tData
    	pY = tData + 1 * iUBound + iSingle
    	pZ = tData + 2 * iUBound + iSingle
    	pfX = tData + 3 * iUBound + iSingle
    	pfY = tData + 4 * iUBound + iSingle
    	pfZ = tData + 5 * iUBound + iSingle
    
    
    	fCosRotX = Cos(fRotX)
    	fSinRotX = Sin(fRotX)
    	fCosRotY = Cos(fRotY)
    	fSinRotY = Sin(fRotY)
    	fCosRotZ = Cos(fRotZ)
    	fSinRotZ = Sin(fRotZ)
    
    
    	f1 = fCosRotY * pX[iPos]
    	f2 = fSinRotX * pY[iPos]
    	f3 = fCosRotX * pZ[iPos]
    	f4 = fCosRotX * pY[iPos]
    	f5 = fSinRotX * pZ[iPos]
    	f6 = f1 - fSinRotY * (f2 + f3)
    	fXPos = (fCosRotZ * f6 - fSinRotZ * (f4 - f5)) * fScale
    	fYPos = (fSinRotZ * f6 + fCosRotZ * (f4 - f5)) * fScale
    	fZPos = (fSinRotY * pX[iPos] + fCosRotY * (f2 + f3)) * fScale
    	fZPerspCorrection = 1 / (fZPos / fZDeepCorrection + 1)
    	pfX[iPos] = fXPos * fZPerspCorrection + fCenterX
    	pfY[iPos] = fYPos * fZPerspCorrection + fCenterY
    	pfZ[iPos] = fZPos
    End Sub
    
    
    Sub Boost(ByVal hCanvas as GpGraphics Ptr, tData As Any Ptr, _
    			 iCountX As UInteger, iCountY As UInteger, _
    			 fX As Single, fY As Single, fZ As Single, fW As Single, fH As Single, fScale As Single) Export
    	Dim As UInteger c, iUBound, iSingle
    	Dim As Single Ptr pX, pY, pZ, pfX, pfY, pFZ
    	Dim As UInteger Ptr pPen
    	iUBound = iCountX * iCountY + iCountX + iCountY + 1
    	iSingle = SizeOf(Single)
    	For c = 0 To iUbound - 1
    			Translate3Dto2D(tData, c, fX, fY, fZ, fW, fH, fScale, 1000, iCountX, iCountY)
    
    
    			pX = tData '+ 0 * iUBound + 0 * iSingle
    			pY = tData + 1 * iUBound * iSingle
    			pZ = tData + 2 * iUBound * iSingle
    			pfX = tData + 3 * iUBound * iSingle
    			pfY = tData + 4 * iUBound * iSingle
    			pfZ = tData + 5 * iUBound * iSingle
    			pPen = tData + 6 * iUBound * iSingle
    			If c > 0 Then
    				GdipDrawLine(hCanvas, pPen[c], pfX[c - 1], pfY[c - 1], pfX[c], pfY[c])
    			EndIf
    
    
    	Next
    
    
    End Sub
    
    
    End Extern
    Alles anzeigen

    Dies hier kackt nicht ab, aber Bildschirm bleibt dunkel. :(

    Dateien

    Rutt_Etra_Izer_FX.zip 251,88 kB – 589 Downloads
  • Übersetzung nach FreeBasic

    • UEZ
    • 2. Juni 2016 um 22:00

    Kackt mit einer Speicherschutzverletzung ab:

    AutoIt:

    AutoIt
    ;~ 		For $c = 1 To $iCountX * $iCountY + $iCountX + $iCountY + 1
    ;~ 			Translate3Dto2D($tData, $c, $fX, $fY, $fZ, $iW / 2, $iH / 2, 2.75)
    ;~ 			If $c > 1 Then
    ;~ 				DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $oCanvas.Gfx, "handle", $tData.Pen(($c)), _
    ;~ 									   "float", $tData.fX(($c - 1)), "float", $tData.fY(($c - 1)), _
    ;~ 									   "float", $tData.fX(($c)), "float", $tData.fY(($c)))
    ;~ 			EndIf
    ;~ 		Next
    
    
    		;Sub Boost(ByVal hCanvas As GpGraphics Ptr, ByVal tData As Any Ptr, iCountX As UInteger, iCountY As UInteger, _
    		;	 fX As Single, fY As Single, fZ As Single, fW As Single, fH As Single, fScale As Single)
    		DllCall($hDLL, "none", "Boost", "ptr", $oCanvas.Gfx, "struct*", $tData, "uint", $iCountX, "uint", $iCountY, _
    										"float", $fX, "float", $fY, "float", $fZ, "float", $iW / 2, "float", $iH / 2, "float", 2.75)
    Alles anzeigen


    FreeBasic:

    Code
    #Include Once "win\gdiplus.bi"
    Using GDIPLUS
    
    
    Extern "Windows-MS"
    
    
    /'	Local $iDim = $iCountX * $iCountY + $iCountX + $iCountY + 1
    	Local Const $tagData = "struct;float x[" & $iDim & "];float y[" & $iDim & "];float z[" & $iDim & "];float fX[" & $iDim & "];float fY[" & $iDim & "];
    									float fZ[" & $iDim & "];int pen[" & $iDim & "];endstruct"
    '/
    Sub Translate3Dto2D(tData as Any Ptr, iPos As Integer, _
    						  fRotX As Single, fRotY As Single, fRotZ As Single, fCenterX  As Single = 0, fCenterY As Single = 0.0, _
    						  fScale As Single = 1.0, fZDeepCorrection As Single = 500.0)
    
    	Dim As Single fCosRotX, fSinRotX, fCosRotY, fSinRotY, fCosRotZ, fSinRotZ, f1, f2, f3, f4, f5, f6, fXPos, fYPos, fZPos, fZPerspCorrection
    
    	Dim As Single Ptr pX, pY, pZ, pfX, pfY, pfZ
    
    
    	pX = tData
    	pY = tData + (iPos * 4)
    	pZ = tData + (iPos * 8)
    	pfX = tData + (iPos * 12)
    	pfY = tData + (iPos * 16)
    	pfZ = tData + (iPos * 20)
    
    
    	fCosRotX = Cos(fRotX)
    	fSinRotX = Sin(fRotX)
    	fCosRotY = Cos(fRotY)
    	fSinRotY = Sin(fRotY)
    	fCosRotZ = Cos(fRotZ)
    	fSinRotZ = Sin(fRotZ)
    
    
    	f1 = fCosRotY * pX[iPos]
    	f2 = fSinRotX * pY[iPos]
    	f3 = fCosRotX * pZ[iPos]
    	f4 = fCosRotX * pY[iPos]
    	f5 = fSinRotX * pZ[iPos]
    	f6 = f1 - fSinRotY * (f2 + f3)
    	fXPos = (fCosRotZ * f6 - fSinRotZ * (f4 - f5)) * fScale
    	fYPos = (fSinRotZ * f6 + fCosRotZ * (f4 - f5)) * fScale
    	fZPos = (fSinRotY * pX[iPos] + fCosRotY * (f2 + f3)) * fScale
    	fZPerspCorrection = 1 / (fZPos / fZDeepCorrection + 1)
    	pfX[iPos] = fXPos * fZPerspCorrection + fCenterX
    	pfY[iPos] = fYPos * fZPerspCorrection + fCenterY
    	pfZ[iPos] = fZPos
    End Sub
    
    
    Sub Boost(ByVal hCanvas as GpGraphics Ptr, tData As Any Ptr, iCountX As UInteger, iCountY As UInteger, _
    			 fX As Single, fY As Single, fZ As Single, fW As Single, fH As Single, fScale As Single) Export
    
    	Dim As Integer c, iUBound
    	Dim As Single Ptr pfX, pfY
    	Dim As Integer Ptr pPen
    
    	iUBound = iCountX * iCountY + iCountX + iCountY
    
    	For c = 0 To iUbound
    		Translate3Dto2D(tData, c, fX, fY, fZ, fW, fH, fScale)
    		If c > 0 Then
    			pfX = tData + (c * 12)
    			pfY = tData + (c * 16)
    			pPen = tData + (c * 24)
    			GdipDrawLine(hCanvas, pPen[c], pfX[c - 1], pfY[c - 1], pfX[c], pfY[c])  
    		EndIf
    	Next
    
    
    End Sub
    
    
    End Extern
    Alles anzeigen


    Scheint an GdipDrawLine(hCanvas, hPen, pfX[c - 1], pfY[c - 1], pfX[c], pfY[c]) zu liegen!?


    @eukalyptus: kannst du den Fehler sehen?

  • Übersetzung nach FreeBasic

    • UEZ
    • 2. Juni 2016 um 16:29

    Hmm, wie speichere ich am besten die Daten nun in AutoIt ab? Struct in Struct?

  • Übersetzung nach FreeBasic

    • UEZ
    • 2. Juni 2016 um 15:02

    @eukalyptus: ich probiere es mal selbstständig, ansonsten melde ich mich hier wieder. ^^

  • Übersetzung nach FreeBasic

    • UEZ
    • 2. Juni 2016 um 09:21

    @eukalyptus: Vielen Dank. :thumbup:

    Wie zu erwarten hat Translate3Dto2D in FreeBasic natürlich nichts gebracht, aber darum ging es mir ehe nicht, sondern FB zu lernen.

    Nächster Schritt ist nun die Schleifen in Freebasic zu implementieren:

    AutoIt
    For $iY = 0 To $iCountY
    			For $iX = 1 To $iCountX
    ;~ 				Translate3Dto2D($aData[$iY], $iX, $fX, $fY, $fZ, $iW / 2, $iH / 2, 2.75)
    				DllCall($hDLL, "none", "Translate3Dto2D", _
    				"struct*", DllStructGetPtr($aData[$iY], "x"), _
    				"struct*", DllStructGetPtr($aData[$iY], "y"), _
    				"struct*", DllStructGetPtr($aData[$iY], "z"), _
    				"struct*", DllStructGetPtr($aData[$iY], "fX"), _
    				"struct*", DllStructGetPtr($aData[$iY], "fY"), _
    				"struct*", DllStructGetPtr($aData[$iY], "fZ"), _
    				"struct*", DllStructGetPtr($aData[$iY], "pen"), _
    				"uint", $iX - 1, _
    				"float", $fX, "float", $fY, "float", $fZ, "float", $iW / 2, "float", $iH / 2, "float", 2.75, "float", 1000.0)
    				If $iX > 1 Then
    					DllCall($__g_hGDIPDll, "int", "GdipDrawLine", "handle", $oCanvas.Gfx, "handle", $aData[$iY].Pen(($iX)), _
    										   "float", $aData[$iY].fX(($iX - 1)), "float", $aData[$iY].fY(($iX - 1)), _
    										   "float", $aData[$iY].fX(($iX)), "float", $aData[$iY].fY(($iX)))
    				EndIf
    			Next
    		Next
    Alles anzeigen

    Nun muss ich eine Array nach FreeBasic übergeben und dort die Schleife ausführen. Mal sehen, wie schneller dies wird, falls ich FB dazu bekomme, dies zu tun, was ich will.

    Geht das überhaupt ein Array (keine Struct!) zu übergeben?

  • Übersetzung nach FreeBasic

    • UEZ
    • 1. Juni 2016 um 10:56
    Zitat von Xorianator

    @UEZ dann würdest du dir aber doppelt Arbeit machen. Wenn du den Algorithmus gleich "optimal" entwirfst, dann musst du ja nur den portieren. Wenn du jetzt aber sowohl A als auch B zwei Mal schreibst, dann schreibst du A einmal zu viel.

    Das macht erst mal nichts, denn, wie gesagt, geht es mir primär um FreeBasic, dann um die Optimierung. Dass es zu doppelten Arbeiten dadurch kommt, ist mir erst mal egal.

    ^^

  • Übersetzung nach FreeBasic

    • UEZ
    • 1. Juni 2016 um 10:03

    Ich wollte eigentlich erst mal wissen, was FreeBasic bei gleichen Bedingungen schafft, bevor ich mich sukzessiv an die Optimierung mache, z.B. über Direkte Lineare Transformation.

    Andy: Dass GDI+ Funktionsaufrufe nicht die Schnellsten sind, ist klar, aber unter den gleichen Bedingungen ist FreeBasic auf meiner Kiste ca. 23x schneller.

    Ein klassisches Beispiel im Anhang: zufällige Farben in eine Bitmap schreiben, die 400x300 groß (klein) ist.


    GDI+ Test 01.au3:

    AutoIt
    #include <GDIPlus.au3>
    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    _GDIPlus_Startup()
    Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit
    Global Const $iW = 400, $iH = 300, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Test"
    Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi
    AutoItSetOption("GUIOnEventMode", 1)
    GDIPlus_Test()
    AutoItSetOption("GUIOnEventMode", 0)
    _GDIPlus_Shutdown()
    Func GDIPlus_Test()
    	$bExit = False
    	$hGUI = GUICreate($sTitle, $iW, $iH) ;, 0, 0, $WS_POPUP)
    	GUISetState(@SW_SHOW, $hGUI)
    ;~ 	GUISetCursor(16, 1)
    	;create canvas elements
    	Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    	Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    	Local Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    	_GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    	_GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    	Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _
    				$hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _
    				$hFormat_FPS = _GDIPlus_StringFormatCreate(), _
    				$hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _
    				$hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 10), _
    				$tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16)
    	$iFPS = 0
    	GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About")
    	AdlibRegister("CalcFPS", 1000)
    	Local $fTimer, $iX, $iY
    	Do
    		$fTimer = TimerInit()
    		For $iY = 0 To $iH
    			For $iX = 0 To $iW
    				DllCall($__g_hGDIPDll, "int", "GdipBitmapSetPixel", "handle", $hBitmap, "int", $iX, "int", $iY, "uint", 0xFF000000 + Random(0, 0xFFFFFF, 1))
    			Next
    		Next
    		ConsoleWrite(TimerDiff($fTimer) & @CRLF)
    		_GDIPlus_GraphicsDrawStringEx($hGfx, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text
    		_GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap, 0, 0, $iW, $iH)
    		$iFPS += 1
    		If $bExit Then ExitLoop
    	Until Not Sleep(10)
    	AdlibUnRegister("CalcFPS")
    	;release resources
    	_GDIPlus_FontDispose($hFont_FPS)
    	_GDIPlus_FontFamilyDispose($hFamily_FPS)
    	_GDIPlus_StringFormatDispose($hFormat_FPS)
    	_GDIPlus_BrushDispose($hBrush_Clr)
    	_GDIPlus_BrushDispose($hBrush_FPS)
    	_GDIPlus_GraphicsDispose($hCanvas)
    	GUIDelete($hGUI)
    EndFunc   ;==>GDIPlus_Test
    Func _Exit_About()
    	$bExit = True
    EndFunc   ;==>_Exit_About
    Func CalcFPS() ;display FPS
    	$iShowFPS = $iFPS
    	$iFPS = 0
    EndFunc   ;==>CalcFPS
    Alles anzeigen


    GDI+ Test 01.bas:

    Code
    #Include Once "win\gdiplus.bi"
    Using GDIPLUS
    
    
    Extern "Windows-MS"
    
    
    Declare Function GetRandom(As Integer, As Integer) As Integer
    
    
    'Returns a random number between low and high
    Function GetRandom(iLowerbound As Integer, iUpperbound As Integer) As Integer
    	GetRandom = Int((iUpperbound - iLowerbound + 1) * Rnd + iLowerbound)
    End Function
    
    
    Sub RandomPattern(ByVal hBitmap As GpImage Ptr, iW As UInteger, iH As UInteger, iRndLow As Integer = 0, iRndHigh As Integer = &hFFFFFF, iAlpha As UInteger = &hFF000000) Export
    	Dim As Integer iX, iY, iColor 
    	For iY = 0 To iH
    		For iX = 0 To iW
    			iColor = iAlpha + GetRandom(iRndLow, iRndHigh)
    			GdipBitmapSetPixel(hBitmap, iX, iY, iColor)
    		Next 
    	Next
    End Sub
    
    
    End Extern
    Alles anzeigen


    Primär geht es mir erst mal um die Implementierung in FreeBasic!

    Dateien

    GDI+ Test 01.zip 11,47 kB – 643 Downloads
  • Übersetzung nach FreeBasic

    • UEZ
    • 31. Mai 2016 um 18:21

    Vielen Dank Aspirin Junkie, aber meine letzte Mathe Vorlesung liegt im letzten Jahrtausend zurück, aber ich versuche die DLT zu verstehen und entsprechend anzuwenden.

    Nichtsdestotrotz stößt AutoIt bei solchen Operationen schnell an seine Grenzen, sodass das Einsetzen von 3rd Party Code, z.B. Assembler oder ext. DLLs sich i.d.R. nicht vermeiden lässt, wenn man die FPS erhöhen will.

  • Übersetzung nach FreeBasic

    • UEZ
    • 31. Mai 2016 um 15:46

    Ich möchte folgende Funktion nach FreeBasic übersetzen, aber ich bekomme eine Speicherschutzverletzung.

    AutoIt
    Func Translate3Dto2D(ByRef $tStruct, $iPos, $fRotX, $fRotY, $fRotZ, $fCenterX = 0, $fCenterY = 0, $fScale = 1, $fZDeepCorrection = 500)
    	Local Const $fCosRotX = Cos($fRotX), $fSinRotX = Sin($fRotX), _
    				$fCosRotY = Cos($fRotY), $fSinRotY = Sin($fRotY), _
    				$fCosRotZ = Cos($fRotZ), $fSinRotZ = Sin($fRotZ), _
    				$f1 = $fCosRotY * $tStruct.x(($iPos)), _
    				$f2 = $fSinRotX * $tStruct.y(($iPos)), _
    				$f3 = $fCosRotX * $tStruct.z(($iPos)), _
    				$f4 = $fCosRotX * $tStruct.y(($iPos)), _
    				$f5 = $fSinRotX * $tStruct.z(($iPos)), _
    				$f6 = $f1 - $fSinRotY * ($f2 + $f3), _
    				$fXPos = ($fCosRotZ * $f6 - $fSinRotZ * ($f4 - $f5)) * $fScale, _
    				$fYPos = ($fSinRotZ * $f6 + $fCosRotZ * ($f4 - $f5)) * $fScale, _
    				$fZPos = ($fSinRotY * $tStruct.x(($iPos)) + $fCosRotY * ($f2 + $f3)) * $fScale, _
    				$fZPerspCorrection = 1 / ($fZPos / $fZDeepCorrection + 1)
    	$tStruct.fX(($iPos)) = $fXPos * $fZPerspCorrection + $fCenterX
    	$tStruct.fY(($iPos)) = $fYPos * $fZPerspCorrection + $fCenterY
    	$tStruct.fZ(($iPos)) = $fZPos
    EndFunc   ;==>Translate3Dto2D
    Alles anzeigen


    Die Struct wird über eine andere Funktion erstellt und ist dynamisch.

    AutoIt
    Local Const $iCountX = Int($aDim[0] / $iStep), $iCountY = Int($aDim[1] / $iStep)
    	Local Const $tagData = "struct;float x[" & $iCountX & "];float y[" & $iCountX & "];float z[" & $iCountX & "];float fX[" & $iCountX & "];float fY[" & $iCountX & "];float fZ[" & $iCountX & "];uint pen[" & $iCountX & "];endstruct"


    Hier der fehlerhafter FreeBasic Code:

    Code
    /'
    Type tagData
    	x (1 To 10000) As Single
    	y (1 To 10000) As Single
    	z (1 To 10000) As Single
    	fX (1 To 10000) As Single
    	fY (1 To 10000) As Single
    	fZ (1 To 10000) As Single
    	pen As UInteger
    End Type
    '/
    
    
    Extern "Windows-MS"
    
    
    Sub Translate3Dto2D(tStruct As Ptr, iPos As Integer, fRotX As Single, fRotY As Single, fRotZ As Single, fCenterX  As Single = 0, fCenterY As Single = 0.0, fScale As Single = 1.0, fZDeepCorrection As Single = 500.0) Export
    	Dim As Single fCosRotX, fSinRotX, fCosRotY, fSinRotY, fCosRotZ, fSinRotZ, f1, f2, f3, f4, f5, f6, fXPos, fYPos, fZPos, fZPerspCorrection
    	fCosRotX = Cos(fRotX)
    	fSinRotX = Sin(fRotX)
    	fCosRotY = Cos(fRotY)
    	fSinRotY = Sin(fRotY)
    	fCosRotZ = Cos(fRotZ)
    	fSinRotZ = Sin(fRotZ)
    	/'
    	f1 = fCosRotY * tStruct->x(iPos)
    	f2 = fSinRotX * tStruct->y(iPos)
    	f3 = fCosRotX * tStruct->z(iPos)
    	f4 = fCosRotX * tStruct->y(iPos)
    	f5 = fSinRotX * tStruct->z(iPos)
    	f6 = f1 - fSinRotY * (f2 + f3)
    	fXPos = (fCosRotZ * f6 - fSinRotZ * (f4 - f5)) * fScale
    	fYPos = (fSinRotZ * f6 + fCosRotZ * (f4 - f5)) * fScale
    	fZPos = (fSinRotY * tStruct->x(iPos) + fCosRotY * (f2 + f3)) * fScale
    	fZPerspCorrection = 1 / (fZPos / fZDeepCorrection + 1)
    	tStruct->fX(iPos) = fXPos * fZPerspCorrection + fCenterX
    	tStruct->fY(iPos) = fYPos * fZPerspCorrection + fCenterY
    	tStruct->fZ(iPos) = fZPos
    	'/
    End Sub
    
    
    End Extern
    Alles anzeigen


    Im Prinzip will ich die Schleife per freeBasic beschleunigen!


    Meine Lösung siehe Post#20. Vielen Dank an @eukalyptus für die Hilfestellungen! :thumbup:


    Vielen Dank.

    Dateien

    test05.zip 175,85 kB – 633 Downloads
  • [GDI+/GDI/Sonstiges] VSync nachrüsten mit D2D

    • UEZ
    • 24. Mai 2016 um 09:51

    Irgendwie gefällt mir das VSync von GDI+ nicht richtig, wenn ich Beispiele z.B. in JS mir ansehe, wo die Animationen echt butterweich abgespielt werden.

    Irgendwie ist immer ein leichtes zucken drinne...

    Beispiel:

    AutoIt
    ;coded by UEZ build 2016-04-08
    #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico")
    #AutoIt3Wrapper_Run_Au3Stripper=y
    #Au3Stripper_Parameters=/so /pe /rm
    #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3"
    
    
    #include <GDIPlus.au3>
    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    
    
    _GDIPlus_Startup()
    Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $i, $__t_VSYNC
    Global Const $iW = 800, $iH = 600, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ 3D Object Rotation v1.0"
    Global Const $fRad = ACos(-1) / 180
    Global Const $iAmountDots = 8, $fDist = 125
    Global $tCoords = DllStructCreate("struct;float x[" & $iAmountDots & "];float y[" & $iAmountDots & "];float z[" & $iAmountDots & "];float fX[" & $iAmountDots & "];float fY[" & $iAmountDots & "];float fZ[" & $iAmountDots & "];endstruct")
    ;create dots for cube
    $tCoords.x((1)) = -$fDist
    $tCoords.y((1)) = -$fDist
    $tCoords.z((1)) = -$fDist
    $tCoords.x((2)) = $fDist
    $tCoords.y((2)) = -$fDist
    $tCoords.z((2)) = -$fDist
    $tCoords.x((3)) = $fDist
    $tCoords.y((3)) = $fDist
    $tCoords.z((3)) = -$fDist
    $tCoords.x((4)) = -$fDist
    $tCoords.y((4)) = $fDist
    $tCoords.z((4)) = -$fDist
    
    
    $tCoords.x((5)) = -$fDist
    $tCoords.y((5)) = -$fDist
    $tCoords.z((5)) = $fDist
    $tCoords.x((6)) = $fDist
    $tCoords.y((6)) = -$fDist
    $tCoords.z((6)) = $fDist
    $tCoords.x((7)) = $fDist
    $tCoords.y((7)) = $fDist
    $tCoords.z((7)) = $fDist
    $tCoords.x((8)) = -$fDist
    $tCoords.y((8)) = $fDist
    $tCoords.z((8)) = $fDist
    
    
    AutoItSetOption("GUIOnEventMode", 1)
    
    
    _VSync_Startup()
    
    
    GDIPlus_3DRotation()
    
    
    _VSync_Shutdown()
    
    
    AutoItSetOption("GUIOnEventMode", 0)
    _GDIPlus_Shutdown()
    
    
    
    
    Func GDIPlus_3DRotation()
    	$bExit = False
    	$hGUI = GUICreate($sTitle, $iW, $iH) ;, -1, -1, $WS_POPUP)
    	GUISetState(@SW_SHOW, $hGUI)
    
    
    	;create canvas elements
    	Local Const $hDC = _WinAPI_GetDC($hGUI)
    	Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH)
    	Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
    	Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap)
    	Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
    	_GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    	_GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
    
    
    	Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _
    				$hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _
    				$hBrush_Dots = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _
    				$hPen_Line = _GDIPlus_PenCreate(0xFFFFFFFF, 1), _
    				$hFormat_FPS = _GDIPlus_StringFormatCreate(), _
    				$hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _
    				$hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _
    				$tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16)
    
    
    	$iFPS = 0
    	GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About")
    	AdlibRegister("CalcFPS", 1000)
    
    
    	Local $i, $fRotX = 0, $fRotY = 0
    
    
    	Do
    		DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _
    				"float", $iW, "float", $iH) ;erase canvas background
    
    
    		For $i = 1 To $iAmountDots
    			Translate3Dto2D($tCoords, $i, $fRotX, $fRotY, $fRotY - $fRotX, $iWh, $iHh)
    			_GDIPlus_GraphicsFillEllipse($hCanvas, $tCoords.fX(($i)) - 4, $tCoords.fY(($i)) - 4, 8, 8, $hBrush_Dots)
    		Next
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((1)), $tCoords.fY((1)), $tCoords.fX((2)), $tCoords.fY((2)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((2)), $tCoords.fY((2)), $tCoords.fX((3)), $tCoords.fY((3)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((3)), $tCoords.fY((3)), $tCoords.fX((4)), $tCoords.fY((4)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((4)), $tCoords.fY((4)), $tCoords.fX((1)), $tCoords.fY((1)), $hPen_Line)
    
    
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((5)), $tCoords.fY((5)), $tCoords.fX((6)), $tCoords.fY((6)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((6)), $tCoords.fY((6)), $tCoords.fX((7)), $tCoords.fY((7)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((7)), $tCoords.fY((7)), $tCoords.fX((8)), $tCoords.fY((8)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((8)), $tCoords.fY((8)), $tCoords.fX((5)), $tCoords.fY((5)), $hPen_Line)
    
    
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((1)), $tCoords.fY((1)), $tCoords.fX((5)), $tCoords.fY((5)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((2)), $tCoords.fY((2)), $tCoords.fX((6)), $tCoords.fY((6)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((4)), $tCoords.fY((4)), $tCoords.fX((8)), $tCoords.fY((8)), $hPen_Line)
    		_GDIPlus_GraphicsDrawLine($hCanvas, $tCoords.fX((3)), $tCoords.fY((3)), $tCoords.fX((7)), $tCoords.fY((7)), $hPen_Line)
    
    
    		$fRotX += 0.01
    		$fRotY += 0.02
    
    
    		_GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text
    		_WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI
    
    
    		$iFPS += 1
    		If $bExit Then ExitLoop
    	Until Not _VSync_Wait()
    
    
    	AdlibUnRegister("CalcFPS")
    	;release resources
    	_GDIPlus_FontDispose($hFont_FPS)
    	_GDIPlus_FontFamilyDispose($hFamily_FPS)
    	_GDIPlus_StringFormatDispose($hFormat_FPS)
    	_GDIPlus_BrushDispose($hBrush_Clr)
    	_GDIPlus_BrushDispose($hBrush_FPS)
    	_GDIPlus_BrushDispose($hBrush_Dots)
    	_GDIPlus_PenDispose($hPen_Line)
    	_GDIPlus_GraphicsDispose($hCanvas)
    	_WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
    	_WinAPI_DeleteDC($hDC_backbuffer)
    	_WinAPI_DeleteObject($hHBitmap)
    	_WinAPI_ReleaseDC($hGUI, $hDC)
    	GUIDelete($hGUI)
    EndFunc   ;==>GDIPlus_3DRotation
    
    
    Func Translate3Dto2D(ByRef $tStruct, $iPos, $fRotX, $fRotY, $fRotZ, $fCenterX = 0, $fCenterY = 0, $fZDeepCorrection = 512)
    	Local Const $fCosRotX = Cos($fRotX), $fSinRotX = Sin($fRotX), _
    				$fCosRotY = Cos($fRotY), $fSinRotY = Sin($fRotY), _
    				$fCosRotZ = Cos($fRotZ), $fSinRotZ = Sin($fRotZ)
    	Local Const $fXPos = $fCosRotZ * ($fCosRotY * $tStruct.x(($iPos)) - $fSinRotY * ($fSinRotX * $tStruct.y(($iPos)) + $fCosRotX * $tStruct.z(($iPos)))) - $fSinRotZ * ($fCosRotX * $tStruct.y(($iPos)) - $fSinRotX * $tStruct.z(($iPos)))
    	Local Const $fYPos = $fSinRotZ * ($fCosRotY * $tStruct.x(($iPos)) - $fSinRotY * ($fSinRotX * $tStruct.y(($iPos)) + $fCosRotX * $tStruct.z(($iPos)))) + $fCosRotZ * ($fCosRotX * $tStruct.y(($iPos)) - $fSinRotX * $tStruct.z(($iPos)))
    	Local Const $fZPos = $fSinRotY * $tStruct.x(($iPos)) + $fCosRotY * ($fSinRotX * $tStruct.y(($iPos)) + $fCosRotX * $tStruct.z(($iPos)))
    	Local Const $fZPerspCorrection = 1 / ($fZPos / $fZDeepCorrection + 1)
    	$tStruct.fX(($iPos)) = $fXPos * $fZPerspCorrection + $fCenterX
    	$tStruct.fY(($iPos)) = $fYPos * $fZPerspCorrection + $fCenterY
    EndFunc   ;==>Translate3Dto2D
    
    
    Func _Exit_About()
    	$bExit = True
    EndFunc   ;==>_Exit_About
    
    
    Func CalcFPS() ;display FPS
    	$iShowFPS = $iFPS
    	$iFPS = 0
    EndFunc   ;==>CalcFPS
    
    
    Func _VSync_Startup()
    	If IsDllStruct($__t_VSYNC) Then Return True
    	$__t_VSYNC = DllStructCreate("struct; handle Dll; hwnd Gui; ptr Fac; ptr Tar; endstruct; ")
    	$__t_VSYNC.Dll = DllOpen('d2d1.dll') ; Direct2D Dll
    	If @error Or Not $__t_VSYNC.Dll Then Return SetError(1, 1, False)
    	$__t_VSYNC.Gui = GUICreate("VSync", 1, 1, 0, 0, 0x80000000) ; GUI mit der Größe 1x1px oben links im Bildschirm, unsichtbar
    	Local $tIID_ID2D1Factory = DllStructCreate("struct; ulong Data1; ushort Data2; ushort Data3; byte Data4[8]; endstruct; ")
    	DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", "{06152247-6f50-465a-9245-118bfd3b6007}", "struct*", $tIID_ID2D1Factory)
    	Local $aResult = DllCall($__t_VSYNC.Dll, "int", "D2D1CreateFactory", "uint", 0, "struct*", $tIID_ID2D1Factory, "uint*", 0, "ptr*", 0)
    	If @error Or $aResult[0] Or Not $aResult[4] Then
    		_VSync_Shutdown()
    		Return SetError(1, 2, False)
    	EndIf
    	$__t_VSYNC.Fac = $aResult[4]
    	Local $pHwndRenderTarget, $tRenderTargetProperties = DllStructCreate("struct; uint Type; uint PixelFormat; uint AlphaMode; float DpiX; float DpiY; uint Usage; uint MinLevel; endstruct; ")
    	Local $tHWNDRenderTargetProperties = DllStructCreate("struct; hwnd Hwnd; uint Width; uint Height; uint PresentOptions; endstruct; ")
    	$tHWNDRenderTargetProperties.Hwnd = $__t_VSYNC.Gui
    	$tHWNDRenderTargetProperties.Width = 1
    	$tHWNDRenderTargetProperties.Height = 1
    	Local $tObj = DllStructCreate("struct; ptr VTBL; endstruct; ", $__t_VSYNC.Fac)
    	Local $tCall = DllStructCreate("struct; ptr[15]; endstruct; ", $tObj.VTBL)
    	$aResult = DllCallAddress("int", DllStructGetData($tCall, 1, 15), "struct*", $__t_VSYNC.Fac, "struct*", $tRenderTargetProperties, "struct*", $tHWNDRenderTargetProperties, "ptr*", 0)
    	If @error Or $aResult[0] Or Not $aResult[4] Then
    		_VSync_Shutdown()
    		Return SetError(1, 3, False)
    	EndIf
    	$__t_VSYNC.Tar = $aResult[4]
    	Return $__t_VSYNC
    EndFunc   ;==>_VSync_Startup
    Func _VSync_Shutdown()
    	If Not IsDllStruct($__t_VSYNC) Then Return SetError(1, 1, False)
    	Local $tObj, $tCall, $aResult
    	If $__t_VSYNC.Tar Then
    		$tObj = DllStructCreate("struct; ptr VTBL; endstruct; ", $__t_VSYNC.Tar)
    		$tCall = DllStructCreate("struct; ptr[3]; endstruct; ", $tObj.VTBL)
    		$aResult = DllCallAddress("int", DllStructGetData($tCall, 1, 3), "struct*", $__t_VSYNC.Tar) ;Release
    	EndIf
    	If $__t_VSYNC.Fac Then
    		$tObj = DllStructCreate("struct; ptr VTBL; endstruct; ", $__t_VSYNC.Fac)
    		$tCall = DllStructCreate("struct; ptr[3]; endstruct; ", $tObj.VTBL)
    		$aResult = DllCallAddress("int", DllStructGetData($tCall, 1, 3), "struct*", $__t_VSYNC.Fac) ;Release
    	EndIf
    	GUIDelete($__t_VSYNC.Gui)
    	DllClose($__t_VSYNC.Dll)
    	$__t_VSYNC = Null
    	Return True
    EndFunc   ;==>_VSync_Shutdown
    Func _VSync_Wait()
    	If Not IsDllStruct($__t_VSYNC) Then Return SetError(1, 1, False)
    	Local $tObj = DllStructCreate("struct; ptr VTBL; endstruct; ", $__t_VSYNC.Tar)
    	Local $tCall = DllStructCreate("struct; ptr[50]; endstruct; ", $tObj.VTBL)
    	DllCallAddress("int", DllStructGetData($tCall, 1, 49), "struct*", $__t_VSYNC.Tar) ;BeginDraw
    	DllCallAddress("int", DllStructGetData($tCall, 1, 50), "struct*", $__t_VSYNC.Tar, "uint64*", 0, "uint64*", 0) ;EndDraw
    	Return True
    EndFunc   ;==>_VSync_Wait
    Alles anzeigen
  • Kicktipp Bundesliga 2015/2016

    • UEZ
    • 14. Mai 2016 um 17:29

    Herzlichen Glückwunsch an HDJW für den Tipp Sieg Bundesliga 2015/2016.



    :thumbup:

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™