Closed DavidRosen closed 1 year ago
Hey, I think it wouldn't be very complicated to add it (on mac OS at least), see this for a similar request:
https://github.com/jonathanBieler/SimpleDirectMediaLayer.jl/issues/29
Basically I can help you with it if you are willing to test it out.
Okay sure, I can test it out. I use Windows 10.
Alright, I'll try to do it this week.
Edit, actually there's no binaries available for windows (as far as I can tell), so that would be complicated. The solution is to build and distribute the binaries ourself (using BinaryBuilder.jl) but that's probably a bit of work (I never did it). Mac OS and linux would be fine though.
Short of using SDL_gfx, is it possible that I might gain some performance by using FillRect() instead of RenderFillRect()?
I couldn't figure out how to invoke FillRect() correctly. This is what I tried: win = SDL2.CreateWindow("bench", Int32(16), Int32(16), Int32(size), Int32(size) , SDL2.WINDOW_SHOWN) pix_fmt=SDL2.GetWindowPixelFormat(win) color=SDL2.MapRGB(pix_fmt,UInt8(0),UInt8(255),UInt8(0)) .... rec=SDL2.Rect(y,x,widthcell-1,widthcell-1) SDL2.FillRect(renderer,Ref(rec),color)
It seems like FillRect
is a SDL function (as opposed to SDL2), which can still be used but you have to manage texture, surface and renderer, which I don't fully understand, see:
https://stackoverflow.com/questions/21890627/drawing-a-rectangle-with-sdl2
To get the pix_format as an object (instead of UInt32) I think you have to do:
px_format = SDL2.AllocFormat(SDL2.GetWindowPixelFormat(win))
The binaries for SDL_gfx have now been built for all platforms https://github.com/JuliaRegistries/General/pull/8487
Once someone builds the wrappers, this can be integrated.
Thank you for making this package!!
I'm doing an informal speed comparison of Python with Julia for graphics, and Python is "winning" because it can use the SDL_gfx add-on library for SDL. I'm finding that SDL_gfx can draw a rectangle around 4 times as fast as plain SDL.
Any chance of adding SDL_gfx?
Cheers and thanks again.