Primary reason is to allow SVG images in HTML pages, with the added bonus of multi-resolution png files being bundled together for better scaling on high DPI displays.
I also added a toolbar to the html/test sample just to make it easier to move forward/back including disabling/enabling the buttons depending on whether any history was available.
https://github.com/wxWidgets/wxWidgets/pull/26474
(4 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Turning this into a draft -- seeing a discrepancy between what lunasvg should be displaying versus what is actually displaying...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
Looks good, thanks!
I'd just like to avoid duplicating the code reading SVGs from stream, could you please do this? TIA!
> bool readImg = true;
- if ( m_windowIface &&
- (input->GetLocation().Matches(wxT("*.gif")) ||
- input->GetLocation().Matches(wxT("*.GIF"))) )
+ wxString loc = input->GetLocation();
+
+ // SVG image path
+ if ( loc.Matches("*.svg") || loc.Matches("*.SVG") )
+ {
+#ifdef wxHAS_SVG
+ // Read the entire stream into a buffer for SVG
+ wxMemoryBuffer svgBuf;
+ for ( ;; )
+ {
+ char tmp[4096];
We have just seen in #26461 that using 64KiB buffer is much faster than using 4KiB, so I think we should change the size here too. Or maybe just use Read(std::vector<char>& buffer) overload once the other PR is merged.
> + // SVG image path
+ if ( loc.Matches("*.svg") || loc.Matches("*.SVG") )
+ {
+#ifdef wxHAS_SVG
+ // Read the entire stream into a buffer for SVG
+ wxMemoryBuffer svgBuf;
+ for ( ;; )
+ {
+ char tmp[4096];
+ s->Read(tmp, WXSIZEOF(tmp));
+ const size_t n = s->LastRead();
+ if ( n == 0 )
+ break;
+ svgBuf.AppendData(tmp, n);
+ }
+ wxBitmapBundle svgBundle = wxBitmapBundle::FromSVG(
Or maybe add FromSVG() overload taking a stream?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()