Skip to content

DrawImageRect

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions

Blitz3DBlitzPlusBlitzBasic

DrawImageRect

DrawImageRect:Void image:Int32, x:Int32, y:Int32, rect_x:Int32, rect_y:Int32, rect_width:Int32, rect_height:Int32, frame:Int32=0
Parameter Mode Type Default Description
image In Int32 required The image to draw.
x In Int32 required Horizontal position on the screen of the top left corner of the part.
y In Int32 required Vertical position on the screen of the top left corner of the part.
rect_x In Int32 required Left edge of the part inside the frame.
rect_y In Int32 required Top edge of the part inside the frame.
rect_width In Int32 required Width of the part.
rect_height In Int32 required Height of the part.
frame In Int32 0 Which frame to draw. Defaults to 0.

Description

Draws only a rectangle of a frame, with the mask color left out. It can show a part of a big picture or cut a sheet into tiles. The handle of the image is not used: the top left corner of the rectangle goes to the given position.

Differences

  • Only the part that lies inside the frame is drawn. A rectangle that reaches over the edge is cut off.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local img = CreateImage(120, 120)
SetBuffer ImageBuffer(img)
For i = 0 To 5
	Color 255 - i * 40, 100 + i * 25, 60 + i * 30
	Rect i * 10, i * 10, 120 - i * 20, 120 - i * 20, 1
Next
SetBuffer BackBuffer()
Cls
DrawImage img, 20, 60
DrawImageRect img, 180, 80, 40, 40, 80, 80
Color 255, 255, 255
Rect 180 - 1, 80 - 1, 82, 82, 0
Flip
WaitKey

Media

DrawImageRect

Related Commands

CopyImage, CreateImage, DrawBlock, DrawBlockRect, DrawImage, FreeImage, ImageRectCollide, ImageRectOverlap

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally