max gui canvas stretching

BlitzMax Forums/BlitzMax Beginners Area/max gui canvas stretching

Eikon(Posted 2006) [#1]
Can you not stretch a canvas like you could in B+? I am setting the layout with Canvas.SetLayout 1, 1, 1, 1 and it becomes all garbled with the render remaining unscaled. I am using the D3D7Max2DDriver.


EOF(Posted 2006) [#2]
edit:

I used this method (for displaying images which fit in the window) but I'm sure there is a better alternative ..

(NOTE: The canvas is also set to 1,1,1,1 layout)
If EventID()=EVENT_GADGETPAINT
	SetGraphics CanvasGraphics(canvas)
	SetViewport 0,0,canvas.Width,canvas.Height
	Cls
	Local sx#=Float(canvas.ClientWidth())/Float(img.Width)
	Local sy#=Float(canvas.ClientHeight())/Float(img.Height)
	SetScale sx,sy
	DrawImage img,0,0
	Flip
EndIf



Full example:



Eikon(Posted 2006) [#3]
I can't believe this isn't handled automatically. Thanks for your help.


po(Posted 2006) [#4]
I have the exact same problem.