DrawImageSub

Category: Images and Rendering

Back to System Functions


Signature

DrawImageSub(imageReference As Integer, x As Integer, y As Integer, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer)

Returns

Void

Description

Queues a rectangular source region from a loaded image so the image hotspot is drawn at the destination position.

The source rectangle is measured in pixels. If the requested rectangle extends beyond the image bounds, LunarBasic clips it to the valid portion of the image before drawing.

If the source width or height is zero or negative, nothing is drawn.

Example

Graphics 640, 480 Dim imageRef As Integer imageRef = LoadImage("tiles.png") DrawImageSub(imageRef, 100, 120, 32, 16, 16, 16)