Category: Images and Rendering
DrawBufferSub(bufferReference As Integer, x As Integer, y As Integer, srcX As Integer, srcY As Integer, srcWidth As Integer, srcHeight As Integer)
Void
Draws a rectangular source region from an off-screen buffer. The source rectangle is measured in pixels inside the buffer.
If the requested rectangle extends past the buffer edges, LunarBasic clips it to the valid area before drawing. If the width or height is zero or negative, nothing is drawn.
Graphics 640, 480
Dim cache As Integer
cache = CreateBuffer(128, 128)
SetBufferTarget cache
Cls
DrawFilledRect 16, 16, 96, 96
ClearBufferTarget
DrawBufferSub cache, 240, 120, 16, 16, 64, 64