Page 2 of 2
Re: Vector graphics support ?
Posted: Wednesday 21st April 2021 3:10pm
by PJBlack
have had the same problem with picturebox ... picture inverse und form black on black ... problem was solved by creating a new form ...
Re: Vector graphics support ?
Posted: Thursday 22nd April 2021 11:58am
by Doctor Watson
Hi PJBlack
I already tried that and even a whole new project.
Same - negative - result.
To all : I'll be away for a couple of days.
Re: Vector graphics support ?
Posted: Friday 23rd April 2021 9:26am
by BruceSteers
I also have issues using Image but not using Picture
' Gambas class file
Private MyGraphic As Picture
Public Sub Form_Open()
MyGraphic = Picture.Load(Application.path & "/GB_FLAG.svg") 'or take any other graphic
PictureBox1.Picture = MyGraphic.Image.Stretch(PictureBox1.W, PictureBox1.H).Picture
Button1.Picture = MyGraphic.Image.Stretch(Button1.W, Button1.H).Picture
End
Re: Vector graphics support ?
Posted: Friday 23rd April 2021 9:33am
by BruceSteers
There's a big difference between an Image and a Picture that is hard to explain.
I see it like if I have a Picture and I look at it then i have an "Image" of that "Picture" in my head
But the "picture" is the real thing while the "image" is not
Or maybe I can get an "Image" of something in my head and make a "Picture" from it. but the "Image" is not real only the "Picture" is once drawn.
hmm , like i say , it's hard to explain.
Suffice to say , Use the "Picture" property/class for final image rendering and the "Image" property to manipulate (colour/stretch/etc)
Re: Vector graphics support ?
Posted: Sunday 25th April 2021 8:11am
by Doctor Watson
Congratulations Bruce! That one needed some thinking over indeed.
There is unfortunately almost nothing to be found on how to use ‘stretch’ in the Gambas documentation, certainly no example code.
Now that the right way of using the ‘stretch’ property has been found, I’d like to explain why I wanted to be able to use vector graphics. I’ll put it in a post in the General section, so perhaps others may benefit.
P.S. I just came across what looks to me like the best Gambas manual till now. It’s in German, but the authors are working on an English translation. Certainly well worth it to pay a visit.
https://gambas-buch.de/dwen/doku.php?id=start. It has some examples on ‘stretch’.
Have a nice weekend.
Re: Vector graphics support ?
Posted: Thursday 24th March 2022 1:07am
by Askjerry
I was playing with SVG in Gambas and the images look stunning. I can create nice gradients and such that always look nice.
Code: Select all
Gambas class file
Public Sub Form_Open()
Dim pic As Picture
pic = Image.Load("./pg.svg").Stretch(PictureBox1.w, PictureBox1.h).Picture
PictureBox1.Picture = pic
End
Public Sub PictureBox1_MouseDown()
Me.Close()
End
In this example (
sent to me) the file
pg.svg is loaded and stretched to the size of the picturebox automatically. This works out very well for stationary SVG... but playing around in HTML a long time ago I discovered that if I named something like "pointer" in the drawing... I could then assign it an angular rotation or movement and do all sorts of things with it. I'm wondering now if once an image is loaded... can I somehow manipulate the object? If so... I can make some incredible gauges and displays.
Check these out... steal the code... see what you can do with it... but if you get something to work in Gambas... please share!
http://askjerry.info/SVG/
Jerry
Re: Vector graphics support ?
Posted: Thursday 24th March 2022 2:51pm
by cogier
Try the code below, then resize the form. I think the
PictureBox.Mode command is quite powerful and under used. I wrote the help for it
here.
PictureBox1 As PictureBox
Public Sub Form_Open()
With Me
.Height = 400
.Width = 500
.Padding = 5
.Arrangement = Arrange.Vertical
.Center
End With
With PictureBox1 = New PictureBox(Me) As "PictureBox1"
.Expand = True
.Alignment = Align.Center
.Mode = PictureBox.Contain
.Picture = Picture["./pg.svg"]
End With
End
Public Sub PictureBox1_MouseDown()
Me.Close()
End
Regarding a 'gauge' have a look at the code
here.
Tip: - When adding Gambas code on this site use the
gb button for results similar to the above.