The benefits of using vector graphics - revisited

Post your Gambas programming questions here.
Post Reply
Doctor Watson
Posts: 84
Joined: Wednesday 22nd August 2018 7:55am

The benefits of using vector graphics - revisited

Post 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 240 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.
Old african saying:
You eat an elephant one small bite at a time.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: The benefits of using vector graphics - revisited

Post 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
Post Reply