UEZ Posted February 6, 2010 Author Share Posted February 6, 2010 (edited) Here another benchmark with 3 nearly different backbuffer methods: expandcollapse popup;Coded by UEZ 2009.12.22 #include <GDIplus.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $width = 800 Global $height = 600 Global Const $pi_div_180 = 4 * ATan(1) / 180 Global $end1, $end2, $end3, $i Global $radius = 200, $ball_size = 150, $loops = 1000 #Region variant 1 using _WinAPI_BitBlt to copy from image from memory to main window -> code by UEZ (thanks Andy for the idea)! Global $hMain_GUI = GUICreate("Main Window", $width, $height, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $hMain_GUI) Global $hDC = _WinAPI_GetWindowDC($hMain_GUI) Global $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) Global $hBMP = _WinAPI_CreateBitmap($width, $height) ;create a dummy bitmap Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) Global $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) Global $hScrDC = _WinAPI_GetDC(0) Global $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hScrDC) Global $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap) Global $hBackbuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) ;create back buffer bitmap $hBrush = _GDIPlus_BrushCreateSolid(0xFF808080) $hBrush_Clear = _GDIPlus_BrushCreateSolid(0xFF000000) $timer = TimerInit() $i = 0 For $x = 1 To $loops ;~ _WinAPI_BitBlt($hDC_backbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hDC_backbuffer, 0, 0, $BLACKNESS) _GDIPlus_GraphicsFillRect($hBackbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hBrush_Clear) _GDIPlus_GraphicsFillEllipse($hBackbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hBrush_Clear) _GDIPlus_GraphicsClear($hBackbuffer, 0xFF000000) _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFF8080) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos($i * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF80FF80) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF8080FF) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF404040) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _WinAPI_BitBlt($hDC, 0, 0, $width, $height, $hDC_backbuffer, 0, 0, 0x00CC0020) $i += 1 Next $end1 = TimerDiff($timer) ConsoleWrite("Method 1: " & Round($end1, 2) & " ms for " & $loops & " loops" & @CRLF) _WinAPI_ReleaseDC($hMain_GUI, $hDC) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_BitmapDispose($hImage) _WinAPI_DeleteObject($hBitmap) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _GDIPlus_GraphicsDispose($hBackbuffer) GUIDelete($hMain_GUI) #EndRegion #Region variant 2 using monoceres' buffering method $hMain_GUI = GUICreate("Main Window", $width, $height, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $hMain_GUI) Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hMain_GUI) Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsClear($backbuffer) $timer = TimerInit() $i = 0 For $x = 1 To $loops _GDIPlus_GraphicsFillRect($backbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hBrush_Clear) ;~ _GDIPlus_GraphicsClear($backbuffer) _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFF8080) _GDIPlus_GraphicsFillEllipse($backbuffer, -$ball_size / 2 + $width / 2 + Cos($i * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF80FF80) _GDIPlus_GraphicsFillEllipse($backbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF8080FF) _GDIPlus_GraphicsFillEllipse($backbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF404040) _GDIPlus_GraphicsFillEllipse($backbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) $i += 1 Next $end2 = TimerDiff($timer) ConsoleWrite("Method 2: " & Round($end2, 2) & " ms for " & $loops & " loops" & @CRLF) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_GraphicsDispose($backbuffer) GUIDelete($hMain_GUI) #EndRegion #Region variant 3 weaponx method? $hMain_GUI = GUICreate("Main Window", $width, $height, -1, -1, $WS_POPUP) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hMain_GUI) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphics) Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global $ScreenDc = _WinAPI_GetDC($hMain_GUI) Global $gdibitmap, $dc GUISetState(@SW_SHOW, $hMain_GUI) $timer = TimerInit() $i = 0 For $x = 1 To $loops _GDIPlus_GraphicsFillRect($hBackbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hBrush_Clear) ;~ _GDIPlus_GraphicsClear($backbuffer) _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFF8080) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos($i * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF80FF80) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF8080FF) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF404040) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) $dc = _WinAPI_CreateCompatibleDC($ScreenDc) _WinAPI_SelectObject($dc, $gdibitmap) _WinAPI_DeleteObject($gdibitmap) _WinAPI_BitBlt($ScreenDc, 0, 0, $width, $height, $dc, 0, 0, $SRCCOPY) _WinAPI_DeleteDC($dc) $i += 1 Next $end3 = TimerDiff($timer) ConsoleWrite("Method 3: " & Round($end3, 2) & " ms for " & $loops & " loops" & @CRLF) _WinAPI_ReleaseDC($hMain_GUI, $ScreenDc) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_GraphicsDispose($hGraphics) #EndRegion _GDIPlus_BrushDispose($hBrush_Clear) _GDIPlus_BrushDispose($hBrush) _GDIPlus_Shutdown() GUIDelete($hMain_GUI) Exit ;~ Func _GDIPlus_BrushSetSolidColor($hBrush, $iARGB = 0xFF000000) ;~ Local $aResult ;~ $aResult = DllCall($ghGDIPDll, "int", "GdipSetSolidFillColor", "hwnd", $hBrush, "int", $iARGB) ;~ If @error Then Return SetError(@error, @extended, 0) ;~ Return SetError($aResult[0], 0, $aResult[0] = 0) ;~ EndFunc ;==>_GDIPlus_BrushSetSolidColor Method 1 is the fastest but it has some drawbacks like using Alphablending... UEZ Edited February 6, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Beege Posted February 6, 2010 Share Posted February 6, 2010 That is Sweet! Why is Alphablending bad? Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
ProgAndy Posted February 6, 2010 Share Posted February 6, 2010 For me the second method is the fastest (XP MCE SP3)Method 1: 8491.53 ms for 1000 loopsMethod 2: 7914.35 ms for 1000 loopsMethod 3: 9834.58 ms for 1000 loops *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Beege Posted February 6, 2010 Share Posted February 6, 2010 Wow that is such a big difference. For me method 2 is by far the slowest. I'm using Window 7. Method 1: 10823.95 ms for 1000 loopsMethod 2: 55552.62 ms for 1000 loopsMethod 3: 15448.33 ms for 1000 loops Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 6, 2010 Share Posted February 6, 2010 Alpha blending isn't bad, it just costs more. Instead of strictly overwriting pixel data, it has to look at the previous value and create some mixture of the old and new if the new value is not 100% opaque. Link to comment Share on other sites More sharing options...
UEZ Posted February 6, 2010 Author Share Posted February 6, 2010 (edited) That is Sweet! Why is Alphablending bad? The issue with _WinAPI_BitBlt() that you cannot activate alpha blending or display transparent images directly! You have to find a workaround! E.g. you can use _GDIPlus_GraphicsClear($hGraphic, 0x10000000) to activate alpha blending on monoceres' method and with _WinAPI_BitBlt() you have to use a workaround like this: expandcollapse popup#include <GDIplus.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $width = 1024 Global $height = 768 Global Const $pi_div_180 = 4 * ATan(1) / 180 Global $end1, $end2, $end3, $i Global $radius = 300, $ball_size = 150, $loops = 1000 #Region variant 1 using _WinAPI_BitBlt to copy from image from memory to main window -> code by UEZ (thanks Andy for the idea)! Global $hMain_GUI = GUICreate("Main Window", $width, $height, -1, -1, $WS_POPUP) GUISetState(@SW_SHOW, $hMain_GUI) Global $hDC = _WinAPI_GetWindowDC($hMain_GUI) Global $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) Global $hBMP = _WinAPI_CreateBitmap($width, $height) ;create a dummy bitmap Global $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) Global $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) Global $hScrDC = _WinAPI_GetDC(0) Global $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hScrDC) Global $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hBitmap) Global $hBackbuffer = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) ;create back buffer bitmap $hBrush = _GDIPlus_BrushCreateSolid(0xFF808080) $hBrush_Clear = _GDIPlus_BrushCreateSolid(0x10000000) ;enable alpha blending $timer = TimerInit() $i = 0 For $x = 1 To $loops _GDIPlus_GraphicsFillRect($hBackbuffer, $width / 2 - ($radius + $ball_size / 2), $height / 2 - ($radius + $ball_size / 2), 2 * $radius + $ball_size, 2 * $radius + $ball_size, $hBrush_Clear) _GDIPlus_BrushSetSolidColor($hBrush, 0xFFFF8080) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos($i * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF80FF80) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF8080FF) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0xFF404040) _GDIPlus_GraphicsFillEllipse($hBackbuffer, -$ball_size / 2 + $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, -$ball_size / 2 + $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, $hBrush) _WinAPI_BitBlt($hDC, 0, 0, $width, $height, $hDC_backbuffer, 0, 0, $SRCCOPY) $i += 1 Sleep(1) Next $end1 = TimerDiff($timer) ConsoleWrite("Method 1: " & Round($end1, 2) & " ms for " & $loops & " loops" & @CRLF) _WinAPI_ReleaseDC($hMain_GUI, $hDC) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_BitmapDispose($hImage) _WinAPI_DeleteObject($hBitmap) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _GDIPlus_GraphicsDispose($hBackbuffer) _GDIPlus_BrushDispose($hBrush) _GDIPlus_Shutdown() GUIDelete($hMain_GUI) Exit #EndRegion If you load and display e.g. a transparent image and display it you have to do some codings to display transparent image using _WinAPI_BitBlt() method! Btw, here my results: Method 1: 5937.49 ms for 1000 loops Method 2: 9539.2 ms for 1000 loops Method 3: 8083.92 ms for 1000 loops UEZ Edited February 6, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wraithdu Posted February 6, 2010 Share Posted February 6, 2010 I know this is a little off topic, but how would you display an image with transparency over another window, like the desktop, using _WinAPI_BitBlt? I know how to do this using GDIP.au3 with _GDIPlus_GraphicsDrawImageRectRectIA with the image attribute parameter, but it's slow. Drawing a full screen image directly with transparency takes like 300ms with that method on my Win7 laptop. I'm wondering if performance would be better using a backbuffer and _WinAPI_BitBlt. But as you said there has to be a workaround with a transparent image. Can you do a simple example of drawing a jpg with 50% transparency to the desktop using _WinAPI_BitBlt? Link to comment Share on other sites More sharing options...
UEZ Posted February 6, 2010 Author Share Posted February 6, 2010 (edited) I wouldn't use _WinAPI_BitBlt() with transparent images because I know only a complicated way to do it! Just have a look here : Rotation of Graphic Object over Backround using _WinAPI_BitBlt()Sorry but I don't have enough space on my account to upload it here!It is an experimental build!You have to create a mask image and combine both images together with _WinAPI_BitBlt() and $SRCAND + $SRCINVERT parameters!Currently I didn't thought about semi transparency!UEZ Edited February 7, 2010 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wraithdu Posted February 7, 2010 Share Posted February 7, 2010 Thanks, I'll take a look soon. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 9, 2010 Share Posted February 9, 2010 Here another benchmark with 3 nearly different backbuffer methods: OMG that's slow, here's what I get (win7 x64, AutoIt 3.3.4.0 x86). DWM enabled: Method 1: 2804.65 ms for 1000 loops Method 2: 10404.05 ms for 1000 loops Method 3: 3269.97 ms for 1000 loops DWM disabled: Method 1: 1724.46 ms for 1000 loops Method 2: 5959.89 ms for 1000 loops Method 3: 3792.05 ms for 1000 loops Thank god it's simple to get the more manageable: DWM enabled: SDL_sprig: 1011.93 ms for 1000 loops SDL_gfx: 1032.44 ms for 1000 loops SDL_sge: 1445.16 ms for 1000 loops DWM disabled: SDL_sprig: 774.75 ms for 1000 loops SDL_gfx: 784.14 ms for 1000 loops SDL_sge: 910.02 ms for 1000 loops See this: expandcollapse popup#Include "SDL_sprig.au3" #Include "SDL_gfx.au3" #Include "SDL_sge.au3" #Include "SDL.au3" Global $width = 800 Global $height = 600 Global Const $pi_div_180 = 4 * ATan(1) / 180 Global $end1, $end2, $end3, $i Global $radius = 200, $ball_size = 75, $loops = 1000 EnvSet("SDL_VIDEO_WINDOW_POS", 0 & ", " & 0) _SDL_Init($_SDL_INIT_VIDEO) _SDL_Startup_sprig() _SDL_Startup_gfx() _SDL_Startup_sge() Local $iFlags = BitOR($_SDL_SWSURFACE, $_SDL_NOFRAME) ;~ $iFlags = BitOR($iFlags, $_SDL_DOUBLEBUF);Uncomment for doublebuffering? $pSurface = _SDL_GuiCreate(@ScriptName, $width, $height, 0, $iFlags) _SDL_stringRGBA($pSurface, 2, 2, "please wait a moment.", 0xFF, 0xFF, 0xFF, 0xFF) _SDL_Flip($pSurface) $timerone = TimerInit() ;Gotta make sure we're running at max capacity Do Until TimerDiff($timerone) > 6000 #Region 1 $i = 0 $timer1 = TimerInit() For $x = 1 To $loops _SDL_FillRect($pSurface, 0, 0) _SPG_EllipseFilled($pSurface, $width / 2 + Cos($i * $pi_div_180) * $radius, $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, 0xFF8080) _SPG_EllipseFilled($pSurface, $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x80FF80) _SPG_EllipseFilled($pSurface, $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x8080FF) _SPG_EllipseFilled($pSurface, $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x404040) _SDL_Flip($pSurface) $i += 1 Next $end1 = TimerDiff($timer1) ConsoleWrite("SDL_sprig: " & Round($end1, 2) & " ms for " & $loops & " loops" & @CRLF) #EndRegion #Region 2 $i = 0 $timer2 = TimerInit() For $x = 1 To $loops _SDL_FillRect($pSurface, 0, 0) _SDL_filledCircleColor($pSurface, $width / 2 + Cos($i * $pi_div_180) * $radius, $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, 0xFF8080FF) _SDL_filledCircleColor($pSurface, $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, 0x80FF80FF) _SDL_filledCircleColor($pSurface, $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, 0x8080FFFF) _SDL_filledCircleColor($pSurface, $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, 0x404040FF) _SDL_Flip($pSurface) $i += 1 Next $end2 = TimerDiff($timer2) ConsoleWrite("SDL_gfx: " & Round($end2, 2) & " ms for " & $loops & " loops" & @CRLF) #EndRegion #Region 3 $i = 0 $timer3 = TimerInit() For $x = 1 To $loops _SDL_FillRect($pSurface, 0, 0) _sge_FilledEllipse($pSurface, $width / 2 + Cos($i * $pi_div_180) * $radius, $height / 2 + Sin($i * $pi_div_180) * $radius, $ball_size, $ball_size, 0xFF8080) _sge_FilledEllipse($pSurface, $width / 2 + Cos(($i + 90) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 90) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x80FF80) _sge_FilledEllipse($pSurface, $width / 2 + Cos(($i + 180) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 180) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x8080FF) _sge_FilledEllipse($pSurface, $width / 2 + Cos(($i + 270) * $pi_div_180) * $radius, $height / 2 + Sin(($i + 270) * $pi_div_180) * $radius, $ball_size, $ball_size, 0x404040) _SDL_Flip($pSurface) $i += 1 Next $end3 = TimerDiff($timer3) ConsoleWrite("SDL_sge: " & Round($end3, 2) & " ms for " & $loops & " loops" & @CRLF) #EndRegion _SDL_Shutdown_sprig() _SDL_Shutdown_gfx() _SDL_Shutdown_sge() _SDL_Quit() My SDL udf here. Would you like an example with something else than circles? Ask me. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
UEZ Posted February 9, 2010 Author Share Posted February 9, 2010 ...My SDL udf here.The download link is dead. Please provide new one!Btw, my intension was not to use any 3rd party DLL, only build-in stuff Thanks,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 9, 2010 Share Posted February 9, 2010 The download link is dead. Please provide new one!Btw, my intension was not to use any 3rd party DLL, only build-in stuff Thanks,UEZYes lets stop all progress because we didn't see my link to post #44 right under the broken download Sure there's a few extra files, but when you get over double the speed, isn't it worth it?And like in post #62 I will probably have everything in au3 files soon, so you don't need to remember to copy dll files.I admit that the UDF seems lika a mess (it is), but then it's probably one of the biggest one-man-projects on the forum. I know it's the biggest thing I have ever done. It will take time to "iron things out", but what we already have is really awesome, and 99% of everything marked "untested" should work. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now