Page 1 of 1

The benefits of using vector graphics - revisited

Posted: Tuesday 4th May 2021 6:09am
by Doctor Watson
This is a new version of an earlier post that – hopefully – will be deleted

This isn’t about posting a new problem, but why and how to use a solved one.
The problem was ‘Vector graphics support’ as you may find in the Component section.
Thanks to the solution provided by Bruce we now can easily ‘stretch’ a graphic to the size we want. And I say ‘graphic’ because ‘picture’ and ‘image’ mean different things in Gambas.
So, why using vector graphics. Simply because they are the thing to use when you want the quality of the background or content of any control that accepts graphics to stay the same, whatever size you apply to it.
I’ve made a small project to demonstrate this. Please download and run it.
Graphics-svg.zip
(114.61 KiB) Downloaded 252 times
I have used the good old Union-Jack. No, I‘m not a subject of her Majesty, but the Union Jack has something in abundance that makes ‘stretching’ (‘resizing’, ‘scaling’, …) other types of graphics hell: oblique lines.
You will see the difference when toggling from SVG to GIF.
You may want to experiment with other formats or sizes. Included are a Union-Jack in .gif and .jpg format and in Large, Medium and small sizes.
The result varies considerably depending on the size of the graphic and of the control used. Large size gif’s or jpg’s may give an acceptable result, but svg will allways be the better choise.

Re: The benefits of using vector graphics - revisited

Posted: Tuesday 4th May 2021 6:41am
by stevedee
Doctor Watson wrote: Tuesday 4th May 2021 6:09am ...I have used the good old Union-Jack. No, I‘m not a subject of her Majesty, but the Union Jack has something in abundance that makes ‘stretching’ (‘resizing’, ‘scaling’, …) other types of graphics hell: oblique lines...
Thanks for your nice, clean, code example Doc

...and good to see that the Union Jack is the right-way-up! ...assuming the flag pole is on the left