Anyone familiar with wxSVG? I can't figure out how to center the image of a wxSVGCtrl. It always renders in the top-left corner. I've found some documentation here: http://wxsvg.sourcearchive.com/document ... GCtrl.html
I thought that if I could get hold of the underlying wxBitmap I could center it on its parent, but the bitmap image (m_buffer) is protected and I can't access it. And I don't see any public functions that would allow me to access it.
I've tried accesing the wxSVGDocument as well. But I can't see anything from there that would allow me to center the image.
----- Edit
What is it that I need to center? The wxSVGDocument, the wxBitmap, the wxSVGMatrix, ...?
[wxSVG] Centering an Image Topic is solved
[wxSVG] Centering an Image
Last edited by Deluge on Fri Jun 21, 2019 8:21 am, edited 2 times in total.
Re: [wxSVG] Centering an Image
This is very old. But I recently started working on an old project & found an answer. The method that I used for centering an SVG image with wxSVG is to create a wxSVGDocument then render it to a wxImage & load it into a wxStaticBitmap:
Then I can position the wxStaticBitmap how I want.
Code: Select all
wxString filename = "example.svg";
wxSVGDocument* svgdoc = new wxSVGDocument();
svgdoc->Load(filename);
wxImage image = svgdoc->Render();
wxStaticBitmap* bitmap = new wxStaticBitmap();
bitmap->SetBitmap(wxBitmap(image));