The benefits of using vector graphics

Post

Posted
Rating:
#1 (In Topic #645)
Regular
Doctor Watson is in the usergroup ‘Regular’
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.
In the following example I’ll be using ‘Union-Jack.svg’. You can download the original here:
https://www.freepik.com/free-vector/illustration-uk-flag_2807791.htm.
After unpacking there will be a file 18166.eps. Edit it with a programme like Inkscape and save the result as Union-Jack.svg.
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 replacing ‘Union-Jack.svg’ with any other format of Union Jack (.bmp, .jpg, …).
Take a new Form and put on it PictureBox1 and Button1.
Make Button1 small - Width 60 , Height 30
Enter these few lines of code in it’s class.

Code (gambas)

  1. ' Gambas class file
  2. Private MyGraphic As Picture
  3.  
  4. Public Sub Form_Open()
  5.  
  6.   MyGraphic = Picture.Load(Application.path & "/Union-Jack.svg")
  7.  
  8.   PictureBox1.Picture = MyGraphic.Image.Stretch(PictureBox1.W, PictureBox1.H).Picture
  9.   Button1.Picture = MyGraphic.Image.Stretch(Button1.W, Button1.H).Picture
  10.   Me.width = Screen.W
  11.   Me.height = Screen.H
  12.   Me.Picture = MyGraphic.Image.Stretch(Me.W, Me.H).Picture
  13.  
  14.  
Have a nice weekend

 Old african saying:
You eat an elephant one small bite at a time.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Which file are you renaming? There is no .svg file there?
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
Doctor Watson is in the usergroup ‘Regular’
Well, I mean the one you download at https://www.freepik.com/free-vector/illustration-uk-flag_2807791.htm. After unpacking and opening 18166.eps you can edit and save it as Union-Jack.svg. Meanwhile I have modified this post. I hope it will be clearer now.
It would be a lot easier if I could just attach my Union-Jack.svg to the post, but as I found out before, this forum doesn’t seem to allow that. Why that is, I have no clue.

 Old african saying:
You eat an elephant one small bite at a time.
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’

Doctor Watson said

Well, I mean the one you download at https://www.freepik.com/free-vector/illustration-uk-flag_2807791.htm. After unpacking and opening 18166.eps you can edit and save it as Union-Jack.svg. Meanwhile I have modified this post. I hope it will be clearer now.
It would be a lot easier if I could just attach my Union-Jack.svg to the post, but as I found out before, this forum doesn’t seem to allow that. Why that is, I have no clue.

Just archive it , attachments can be zip tar etc :)
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Guru
cogier is in the usergroup ‘Guru’
It would be a lot easier if I could just attach my Union-Jack.svg to the post, but as I found out before, this forum doesn’t seem to allow that. Why that is, I have no clue.

As Bruce said just compress the file then you can upload it. I converted it to .svg online, so it got well compressed.
Attachment

You may also be interested in the PictureBox Mode commands. Have a look here.
Online now: No Back to the top

Post

Posted
Rating:
#6
Regular
Doctor Watson is in the usergroup ‘Regular’
 Hi Bruce and Cogier.
Thanks for the assistance.
Wouldn’t it be better to delete this post and I would post a new one where visitors will just read what this is realy about?
Cogier : PictureBox mode commands may indeed come in handy
Cheers

 Old african saying:
You eat an elephant one small bite at a time.
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’

Doctor Watson said

Hi Bruce and Cogier.
Thanks for the assistance.
Wouldn’t it be better to delete this post and I would post a new one where visitors will just read what this is realy about?
Cogier : PictureBox mode commands may indeed come in handy
Cheers

but then people might not see how to upload svg files.
;)
Online now: No Back to the top

Post

Posted
Rating:
#8
Regular
Doctor Watson is in the usergroup ‘Regular’
Hi Bruce

It would indeed be usefull to let users know how to upload certain file types.
Just put it in a post fore the Beginners (like self  :?: )
Meanwhile I’m working on a small project to make the svg issue more clear for everyone.

 Old african saying:
You eat an elephant one small bite at a time.
Online now: No Back to the top

Post

Posted
Rating:
#9
Regular
Doctor Watson is in the usergroup ‘Regular’
Hi Cogier
I’ve just finished a new version of this this topic, including a nice (  8-) ) project to demonstrate the .svg issue. I suppose that as a site admin you can delete this topic, so I can post it’s replacement. It could be confuzing to visitors if both versions stay online.

 Old african saying:
You eat an elephant one small bite at a time.
Online now: No Back to the top
1 guest and 0 members have just viewed this.