Display Image in GUI Window?

BlitzMax Forums/BlitzMax Beginners Area/Display Image in GUI Window?

BachFire(Posted 2007) [#1]
Hey smart ppl, :-)

I seem to have so many questions these times..

I'm trying to display a normal image in a window. Be it jpg bmp gif or whatever. I should use gif, but can convert if nessesary. But I really don't know how to display a simple picture. It would really help, if there were some kind of thorough manual about BlitzMax, filled to the brim with easy-to-understand examples. But I guess you get what you pay for. After all, it IS good value for the money.

Anyway, about my problem.. I have come so far myself, that I can guess it has to be done with a canvas?? Or what? Can someone provide a painfully simple example of how to do this?


Zenn Lee(Posted 2007) [#2]
You need to make a canvas then you can draw on it using
"SetGraphics CanvasGraphics(Canvas)." I'm not real good at
explaining stuff so I'll let the code do the explaining.


Global Square = LoadImage("Square.gif")
Global EditCanvas:TGadget = CreateCanvas(0,0,640,480,Window)

Function DrawCanvas()
SetGraphics CanvasGraphics(Canvas)
Cls
DrawImage Square,0,0
Flip
End Function


Hope this helps.

Oh, also this code isn't complete, it will not work if you
try and run it. You have to create a window first and do a
few other things, but I think you know how to do that stuff.


tonyg(Posted 2007) [#3]
I'm guessing you have worked through Assari's excellent MaxGUI tutorials?


Zenn Lee(Posted 2007) [#4]
Hu, never heard of it.


BachFire(Posted 2007) [#5]
@tonyg

That looks very interresting!


tonyg(Posted 2007) [#6]
@Bachfire, yep very good tutorials.
@Zenn Lee, guess we cross-posted as my post was for Bachfire.


Zenn Lee(Posted 2007) [#7]
@tonyg oops sorry:)