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

  • Ü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 – 468 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 – 519 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 – 498 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:

  • AVI Compose Video UDF

    • UEZ
    • 13. Mai 2016 um 22:11

    Vielen Dank. Werde es bei der nächsten Gelegenheit testen... :thumbup:

  • Tipp Spiel zur EM 2016

    • UEZ
    • 13. Mai 2016 um 11:13

    Wer Lust hat mitzumachen, einfach unter https://www.kicktipp.de/autoit-em16 anmelden und loslegen. :rock:

    Am 10.06.2016 geht's los.


    Ich würde mich auf zahlreiche Teilnehmer sehr freuen!


    Edit:

    Resultat: gewonnen hat Techmix - herzlichen Glückwunsch!

    EM2016_Resultat.png

    Ich hoffe, dass beim nächsten Mal mehr mittippen!

  • AVI Compose Video UDF

    • UEZ
    • 11. Mai 2016 um 21:49

    Super coooooool. :klatschen:

    Gibt es auch einen Frame Extractor? Könnte man benutzen, um z.B. GIF von Videos zu erzeugen.
    Kann man auch einen Video/Audio Codec benutzen?

    Das Test Video wird mit Media Player Classic gespiegelt angezeigt. WMP sieht's normal aus.

  • Treeview m. Checkbox - Un/Check durch Leertaste verhindern

    • UEZ
    • 2. Mai 2016 um 19:50

    Probiere es mal mit

    AutoIt
    If $vKey = 32 Then _GUICtrlTreeView_SetChecked($hTreeview, _GUICtrlTreeView_GetSelection($hTreeview), Not _GUICtrlTreeView_GetChecked($hTreeview, _GUICtrlTreeView_GetSelection($hTreeview))) ; Leertaste >> kein Normalverhalten gewünscht (Checkbox soll nicht reagieren)
  • [GDI+] _GDIplus_BitmapMove

    • UEZ
    • 28. April 2016 um 20:42
    Zitat von Mars

    Ein wunderbares Beispiel für "Viele Wege führen nach Rom". Hier wird die Bitmap als Textur genutzt und anschließend verschoben abgebildet. Dabei ist ein sehr großer Unterschied zur Mars Variante

    Ein Vorteil hat diese Textur Version noch: du kannst ganz einfach das Bild spiegeln! Dazu den WrapMode Parameter in der Funktion _GDIPlus_TextureCreate angeben.

    Default ist 0.

  • [GDI+] _GDIplus_BitmapMove

    • UEZ
    • 28. April 2016 um 18:56
    Zitat von Andy

    Nicht zu vernachlässigen, dass D2D nicht einige Prozent schneller ist, sondern im vorliegenden Beispiel Faktor 3-5!

    Das sehe ich nicht so, denn man muss fair bleiben und alle Calls in die Berechnung einbeziehen.

    D2D:

    AutoIt
    While Not $bExit
    	$iTimer = TimerInit()
    
    
    	_ED2D_BitmapMove($hIMG, $hIMG2, 5 * Sin(TimerDiff($t) / 1000) + 3 * Cos(TimerDiff($t) / 3000), 5 * Cos(TimerDiff($t) / 1000) + 3 * Sin(TimerDiff($t) / 7000))
    	$hBUF.BeginDraw()
    	$hBUF.DrawBitmap($hIMG, Rect4F(0, 0, 512, 512), 1, 1, Rect4F(-1, -1, -1, -1))
    	$hBUF.EndDraw(0, 0)
    	_ED2D_RenderTargetDrawBitmapOnHWND($hBMP)
    
    
    	$iTime = (TimerDiff($iTimer) + $iTime * 19) / 20
    	If TimerDiff($iFrameTimer) > 1000 Then
    		WinSetTitle($hGUI, '', 'BitmapMove: ' & Round($iTime, 1) & ' ms')
    		$iFrameTimer = TimerInit()
    	EndIf
    WEnd
    Alles anzeigen


    GDI+:

    AutoIt
    While Sleep(10) And Not $bExit
    	$iTimer = TimerInit()
    
    
    	_GDIPlus_BitmapMove($hIMG, 5 * Sin(TimerDiff($t) / 1000) + 3 * Cos(TimerDiff($t) / 3000), 5 * Cos(TimerDiff($t) / 1000) + 3 * Sin(TimerDiff($t) / 7000))
    	_GDIPlus_GraphicsDrawImage($hGFX, $hIMG, 0, 0)
    
    
    	$iTime = (TimerDiff($iTimer) + $iTime * 19) / 20
    	If TimerDiff($iFrameTimer) > 1000 Then
    		WinSetTitle($hGUI, '', 'BitmapMove: ' & Round($iTime, 1) & ' ms')
    		$iFrameTimer = TimerInit()
    	EndIf
    WEnd
    Alles anzeigen

    GDI/GDI+ Textur:

    AutoIt
    While Sleep(10) And Not $bExit
    	$iTimer = TimerInit()
    
    
    	DllCall($__g_hGDIPDll, 	'int', 'GdipTranslateTextureTransform', 'handle', $hTXT, _
    							'float', 5 * Sin(TimerDiff($t) / 1000) + 3 * Cos(TimerDiff($t) / 3000), _
    							'float', 5 * Cos(TimerDiff($t) / 1000) + 3 * Sin(TimerDiff($t) / 7000), _
    							'int', 0)
    	DllCall($__g_hGDIPDll, 'int', 'GdipFillRectangle', 'handle', $hGFX, 'handle', $hTXT, 'float', 0, 'float', 0, 'float', $iW, 'float', $iH)
    	DllCall('gdi32.dll', 'bool', 'BitBlt', 'handle', $hDC, 'int', 0, 'int', 0, 'int', $iW, 'int', $iH, 'handle', $hDC_backbuffer, 'int', 0, 'int', 0, 'dword', $SRCCOPY)
    
    
    	$iTime = (TimerDiff($iTimer) + $iTime * 19) / 20
    	If TimerDiff($iFrameTimer) > 1000 Then
    		WinSetTitle($hGUI, '', 'BitmapMove: ' & Round($iTime, 1) & ' ms')
    		$iFrameTimer = TimerInit()
    	EndIf
    WEnd
    Alles anzeigen

    Meine Resultate:
    D2D: ~16.6ms
    GDI+: ~12ms
    GDI/GDI+: ~7.6ms

  • [GDI+] _GDIplus_BitmapMove

    • UEZ
    • 28. April 2016 um 14:11

    Hier eine GDI+/GDI Version, die für diesen Zweck sehr schnell ist, aber immer noch ruckelt, aber nicht mehr so stark.

    AutoIt
    #include-once
    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>
    
    
    ; #BEISPIEL# ====================================================================================================================
    ; Author ........: Mars
    ; Modified ......: UEZ
    ; ===============================================================================================================================
    
    
    Opt('GUIOnEventMode', 1)
    _GDIPlus_Startup()
    
    
    Global $bExit = False, $iW = 512, $iH = 512
    Global $hGUI = GUICreate('Test', $iW, $iH)
    
    
    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 $hGFX = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
    
    
    ;~ Global $hGFX = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    Global $hIMG = _GDIPlus_ImageLoadFromFile('Mona.jpg')
    Global $hTXT = _GDIPlus_TextureCreate($hIMG)
    Global $t = TimerInit(), $iTimer, $iTime, $iFrameTimer = TimerInit()
    
    
    GUISetOnEvent(-3, 'EVENT', $hGUI)
    GUISetState(@SW_SHOW, $hGUI)
    
    
    While Sleep(10) And Not $bExit
    	$iTimer = TimerInit()
    
    
    	DllCall($__g_hGDIPDll, 	'int', 'GdipTranslateTextureTransform', 'handle', $hTXT, _
    							'float', 5 * Sin(TimerDiff($t) / 1000) + 3 * Cos(TimerDiff($t) / 3000), _
    							'float', 5 * Cos(TimerDiff($t) / 1000) + 3 * Sin(TimerDiff($t) / 7000), _
    							'int', 0)
    	DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGFX, "handle", $hTXT, "float", 0, "float", 0, "float", $iW, "float", $iH)
    	DllCall('gdi32.dll', 'bool', 'BitBlt', 'handle', $hDC, 'int', 0, 'int', 0, 'int', $iW, 'int', $iH, 'handle', $hDC_backbuffer, 'int', 0, 'int', 0, 'dword', $SRCCOPY)
    
    
    	$iTime = (TimerDiff($iTimer) + $iTime * 19) / 20
    	If TimerDiff($iFrameTimer) > 1000 Then
    		WinSetTitle($hGUI, '', 'BitmapMove: ' & Round($iTime, 1) & ' ms')
    		$iFrameTimer = TimerInit()
    	EndIf
    WEnd
    
    
    _GDIPlus_BrushDispose($hTXT)
    _GDIPlus_ImageDispose($hIMG)
    _GDIPlus_GraphicsDispose($hGFX)
    _WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
    _WinAPI_DeleteDC($hDC_backbuffer)
    _WinAPI_DeleteObject($hHBitmap)
    _WinAPI_ReleaseDC($hGUI, $hDC)
    _GDIPlus_Shutdown()
    GUIDelete()
    
    
    Func EVENT()
    	Switch @GUI_CtrlId
    		Case -3
    			$bExit = True
    	EndSwitch
    EndFunc
    Alles anzeigen

    Ich sollte auch mehr in D2D machen, weil einfach besser als GDI+...

  • [GDI+] _GDIplus_BitmapMove

    • UEZ
    • 28. April 2016 um 11:21

    Ich bewundere immer wieder, wie butterweich die Animationen in JS, D2D, etc. sind und warum das nicht in GDI+ möglich ist. Wenn man GDI+ mit GDI verheiratet, dann kommt man in die Richtung...

  • Treeview - Un/Check eines Item mit allen SubItem (rekursiv)

    • UEZ
    • 26. April 2016 um 12:12

    Kann man 3state für Checkboxen in Treeviews verwenden?

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™