Which header files do I include for rendering SVGs with wxSVG? Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
I'mHereToBeHelped
Earned a small fee
Earned a small fee
Posts: 20
Joined: Wed Jun 01, 2022 5:49 pm

Which header files do I include for rendering SVGs with wxSVG?

Post by I'mHereToBeHelped »

I recently downloaded wxSVG and have been trying to find out what header files to include to run this code without error. It doesn't show me any syntax errors since I've included the
SVG doc header file:

Code: Select all

#include "wxSVG/SVGDocument.h" 
. The rest I'll need help with since there's so little documentation to go off, any help is appreciated.

Code: Select all

wxString FileName = "edit.svg";
    wxSVGDocument* SVGDoc = new wxSVGDocument(); SVGDoc->Load(FileName);
    wxImage EditImage = SVGDoc->Render();
    
    wxStaticBitmap* bitmap = new wxStaticBitmap();
    bitmap->SetBitmap(wxBitmap(EditImage));
 
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Which header files do I include for rendering SVGs with wxSVG?

Post by doublemax »

Code: Select all

#include "wxSVG/svg.h" 
Should be enough.

BTW: Since wx 3.1.6 wxWidgets does include the nanosvg renderer. It does not support all SVG features, but maybe it's sufficient for your purpose. Unfortunately it's only accessible through wxBitmapBundle:
https://docs.wxwidgets.org/trunk/classw ... f2d8ff611b
Use the source, Luke!
Post Reply