DrawImageRect !

BlitzMax Forums/BlitzMax Beginners Area/DrawImageRect !

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Is there a bug with the DrawImage command when using a custom drawimagerect (with the viewport thingy) ?
Stuff like CLS works as it should, but DrawImage actually draws a column of the whole image! The *rect width is perfect, but the height doesn't work at all!

Strict

Local window:TGadget=CreateWindow("o_O",0,0,640,480)
Local canvas:Tgadget=CreateCanvas(4,4,512,256,window)

AutoImageFlags(0)
Local img:TImage=LoadImage( pick some image, like a 640x480 one orso )


Local t:Int
Local scale:Int=1

SetGraphics CanvasGraphics(canvas)
	SetScale scale,scale
	For t=1 To 1 Step 1
		DrawImageRect2 img,t*8*scale,16*scale,t*8*scale,0,8*scale,8*scale
	Next
Flip


OnEnd quit
Repeat
	WaitEvent()
	If EventID()=EVENT_WINDOWCLOSE End
Forever

Function quit()
	GCCollect()
	End
End Function

Function DrawImageRect2(img:TImage,x:Int,y:Int,pickx:Int,picky:Int,w:Int,h:Int)
	Local tempx:Int
	Local tempy:Int
	Local tempw:Int
	Local temph:Int
	
	GetViewport tempx,tempy,tempw,temph
	
	SetViewport x,y,w,h
	DrawImage img,x-pickx,y-picky
	SetClsColor 255,255,255;Cls
	SetViewport tempx,tempy,tempw,temph
End Function