Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » SVG for tool icon
SVG for tool icon [message #58554] Wed, 15 June 2022 17:31 Go to next message
Sayem is currently offline  Sayem
Messages: 20
Registered: May 2022
Promising Member
How can I use SVG icons in U++ cause the current icon looks pixelated. Can I import SVG icons for tool icons?
Re: SVG for tool icon [message #58556 is a reply to message #58554] Sat, 18 June 2022 09:40 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1077
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Sayem,

Here is example of using SVG. You could play with it compiling examples/SVGView. In order to load SVG you need to use RenderSVGImage function provided by Painter package. It will create image for you for a given size. This image can be used to set icon for example in the toolbar. In order to do not call RenderSVGImage too many times, I highly recommend to cache your images in memory.

Here is code responsible from loading SVG, the parameters are size and path to SVG file:
Size sz = Size(64, 64);
Image img = RenderSVGImage(sz, svg);


Klugier


U++ - one framework to rule them all.
Re: SVG for tool icon [message #58560 is a reply to message #58556] Sun, 19 June 2022 05:31 Go to previous message
Sayem is currently offline  Sayem
Messages: 20
Registered: May 2022
Promising Member
Thank you for the help. I was experimenting with the SVG viewer before but could not understand how to put it to tool icon. This helps a lot
Previous Topic: The right way to use CoDo with GuiLock?
Next Topic: U++: Why Archive Data?
Goto Forum:
  


Current Time: Tue Jun 25 21:44:42 CEST 2024

Total time taken to generate the page: 0.01193 seconds