Re: Drawing a lot of SVG images is slow
Quentin Cosendey <[email protected]> Wed, 2 Apr 2025 18:05:51 +0200
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Hello, QC> What should I do to use D2D instead of GDI ? EJ> wxGraphicsContext *gc = wxGraphicsRenderer::GetDirect2DRenderer()->CreateContext(...); wxGraphicsRenderer::GetDirect2DRenderer() doesn't exists for me. GameWindow.cpp: In member function 'void GameWindow::OnPaint(wxPaintEvent&)': GameWindow.cpp:943:21: error: 'GetDirect2DRenderer' is not a member of 'wxGraphicsRenderer' 943 | wxGraphicsRenderer::GetDirect2DRenderer() ->CreateContext(dc) Do I need to do something special to have it ? QC>Isn't there a more direct way to draw SVG images ? Leo> According to Brave Search, yes: Leo> https://github.com/micahpearlman/MonkVG Leo> I think that one sounds like what you need. It doesn't mention wx compatibility, but since it runs on top of OpenGL, I imagine it can be made compatible without much tinkering. I don't use OpenGL at all, so I don't know if it's doable with WXWidgets, but I'll have a look at that library, at least maybe to get ideas. Thank you. Thank you very much. Best regards. Le 02.04.2025 à 08:00, 'Eric Jensen' via wx-users a écrit : > Hello Quentin, > > Wednesday, April 2, 2025, 6:36:27 AM, you wrote: > > > VZ>> Also, under Windows, using D2D-based wxGraphicsContext could be much faster than using the default GDI+-based one or GDI. > QC> What should I do to use D2D instead of GDI ? > wxGraphicsContext *gc = wxGraphicsRenderer::GetDirect2DRenderer()->CreateContext(...); > > VZ>> You could try using LunaSVG, but normally SVG rasterizing performance shouldn't count anyhow, as the bitmaps should be cached. Drawing 1000 bitmaps is not going to be fast neither, unfortunately, so if you can find a way to precombine them, consider doing this. > QC> I'll have a look at LunaSVG. Combining is maybe the key point, I'll also try to find a way to improve that as well. > Rendering the SVG each time will always be significantly slower than drawing a pre-rendered bitmap. > > Eric > > > -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/wx-users/e7b819a9-22da-4045-b266-a7c8b0b854c8%40bluewin.ch.