Code archives/Graphics/Another drawimagerect

This code has been declared by its author to be Public Domain code.

Download source code

Another drawimagerect by tonyg2006
Very simple drawimagerect function using standard Bmax commands so OK with GL/DX and takes rotates, blends etc.
Seems fast enough to use in non-debug mode unless you're planning on hundreds per cycle.
Graphics 640,480
SeedRnd MilliSecs()
image:TImage=LoadImage("max.png")
While Not KeyHit(key_escape)
  Cls
  tg_drawimagerect(image,Rand(0,640),Rand(0,480),0,0,200,100)
  Flip
Wend
Function tg_drawimagerect(image:TImage,x:Int,y:Int,xs:Int,ys:Int,width:Int,height:Int)
    DrawImage LoadImage(PixmapWindow(LockImage(image),xs,ys,width,height)),x,y
End Function

Comments

Grey Alien2006
bug: xy doesn't exist. Should be ys.


tonyg2006
...changed. At least somebody tried it.


Grey Alien2006
lol, yep. I was worried about my viewport version not being compatible with all PCs.


Code Archives Forum