GRAPHICS command misbehaving

BlitzMax Forums/BlitzMax Beginners Area/GRAPHICS command misbehaving

Ian Lett(Posted 2006) [#1]
hello all :

consider this code:
Strict

Graphics 640,480,32

Local bobimage:Timage=LoadImage("light.png")
Local logo:Timage=LoadImage("b-max.png")


While Not KeyDown(Key_Escape)
Cls
DrawImage logo,10,10
DrawImage bobimage,MouseX(),MouseY()
Flip
Wend

(using the graphics form the samples dir, this works fine , both images draw ok with masking working fine

now try :

Strict

Local bobimage:Timage=LoadImage("light.png")
Local logo:Timage=LoadImage("b-max.png")


Graphics 640,480,32


While Not KeyDown(Key_Escape)
Cls
DrawImage logo,10,10
DrawImage bobimage,MouseX(),MouseY()
Flip
Wend

and the masking falls to bits all images have a black square border round them, and no matter what combination of blends and load image peramiters i try it still fails to draw the black areas as transparent, am i missing somthing os is the postion of the graphics statement in code that important to the way images are drawn

any help mot greatfuly receved

Rgards Ian


TomToad(Posted 2006) [#2]
It's usually best to use the Graphics command before doing anything with graphics, including loading images. I believe that after the images are loaded, you can call graphics again, to change resolution or refresh rate or simular, without the need to reload the images.


VP(Posted 2006) [#3]
Calling Graphics after loading images never used to work very well in B3D. Perhaps the same is true here?

I would hazard a guess that the TImage's get corrupted or invalidated during a Graphics call.


Ian Lett(Posted 2006) [#4]
thaks for that, i was not aware you could recall the graphics command more than one

regards