Jump to content
pyscripter

Native Svg parsing and painting in Windows

Recommended Posts

On 2/11/2021 at 1:01 PM, Lars Fosdal said:

Nice, Carlo. 

I use the SVG preview capability from https://docs.microsoft.com/en-us/windows/powertoys/file-explorer

I know PowerToys and by browsing the C # sources I wanted to discover which SVG library they used for rendering the images. I thought they used Direct2D like SVGIconImageList does thanks to the implementation of @pyscripter but I notice that they "ask" to Edge Browser to render the SVG image, then they "capture" the result image and pass it to Windows Explorer ... not an elegant way to do this. In fact, the icons are not transparent but have a white background, the preview is quite slow and the preview panel is truly minimalist, it only shows the icon 😉

Share this post


Link to post
14 minutes ago, Carlo Barazzetta said:

the preview is quite slow and the preview panel is truly minimalist

Really?

I find it faster and more pleasant.

Also it does not create a flashing parented form/frame + editor etc. on the preview pane every time a file is selected.

Minimalist? What should be on an svg preview pane except the image itself?

 

Edited by Attila Kovacs

Share this post


Link to post
Just now, Attila Kovacs said:

I noticed a slower preview for the thumbnails (not the preview panel), with a wrong "white" background on my "dark" Windows Explorer, instead of transparency of the image.
Minimalist, because showing the image shown by the thumbnail is not very useful ...
My preview shows the xml content of the file, very useful to see the SVG code (but you can hide the text and show only a preview of the image if you don't want to see a flashing fonrm/frame) and a preview of the image with a useful slider to change the backlight and see the image on different backgrounds (clear or dark). Now with 1.1 version you can also export an SVG image to PNGs (with different resolutions) or you can edit it using the SVG Text Editor included.

 

Share this post


Link to post

<o>

There is no thumbnail if you are in list or detail mode and it makes no sense to have the preview pane turned on if you are in icon-list mode and you can see the thumbnails. I understand that you like to turn the windows explorer into an full armed SVG workshop, I'm just saying that sometimes less is more. And it's definitely not slower. At least not on the usual SVG context.

I admit that the white background could be a showstopper on dark themes, but this is a subject for a separate thread. Dark theme with bright text is very very bad for the eyes. 

Edited by Attila Kovacs

Share this post


Link to post
32 minutes ago, Attila Kovacs said:

<o>

There is no thumbnail if you are in list or detail mode and it makes no sense to have the preview pane turned on if you are in icon-list mode and you can see the thumbnails. I understand that you like to turn the windows explorer into an full armed SVG workshop, I'm just saying that sometimes less is more. And it's definitely not slower. At least not on the usual SVG context.

I admit that the white background could be a showstopper on dark themes, but this is a subject for a separate thread. Dark theme with light text is very very bad for the eyes. 

I don't understand ... (a fully armed SVG workshop?). If you don't feel the need to be able to see all the icons in a folder at a glance (Thumbnail mode) and be able to focus on one of those and look at the code on the fly (if it's SVG "clean" and "light") and don't try to see if that icon has colors that suit whatever theme the user chooses (dark or light) maybe we don't do the same job. If you prefer to use PowerToys instead of this solution developed in Delphi no one forces you to install it. I thought we were on a Delphi blog not for C# developers 😉

Share this post


Link to post

I did not feel the need to get PowerToys' preview criticized. It has nothing to do with the language it's written in. It's all about preferences.

24 minutes ago, Carlo Barazzetta said:

and don't try to see if that icon has colors that suit whatever theme the user chooses

No. As I'm preparing the images for production and then it gets into a separate directory, and depending on the selected theme, dark or light, the colors in the SVG's are adjusted for all icons automatically on theme change. We sure not doing the same job.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×