Skip to content

ImageRectCollide

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

Blitz3DBlitzPlusBlitzBasic

ImageRectCollide

ImageRectCollide:Int32 image:Int32, x:Int32, y:Int32, frame:Int32, rect_x:Int32, rect_y:Int32, rect_width:Int32, rect_height:Int32
Parameter Mode Type Default Description
image In Int32 required The image.
x In Int32 required Horizontal position where the image is drawn.
y In Int32 required Vertical position where the image is drawn.
frame In Int32 required The frame to test.
rect_x In Int32 required Left edge of the rectangle.
rect_y In Int32 required Top edge of the rectangle.
rect_width In Int32 required Width of the rectangle.
rect_height In Int32 required Height of the rectangle.

Returns: 1 if the rectangle touches a pixel of the image, otherwise 0.

Description

Tells whether a rectangle touches any visible (not masked) pixel of a frame of an image placed at a position. It is exact, unlike ImageRectOverlap, which only compares the box of the image.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local ring = CreateImage(100, 100)
SetBuffer ImageBuffer(ring)
Color 255, 255, 0
Oval 0, 0, 100, 100, 0
SetBuffer BackBuffer()
; The middle of the ring is empty, so the box of the image is touched but not the ring.
Print ImageRectOverlap(ring, 50, 50, 90, 90, 10, 10)
Print ImageRectCollide(ring, 50, 50, 0, 90, 90, 10, 10)
Print ImageRectCollide(ring, 50, 50, 0, 50, 95, 10, 10)
WaitKey

Related Commands

ImageBuffer, ImageFrameDelay, ImageFrames, ImageHeight, ImageReady 〔BlitzLLVM〕, ImageRectOverlap, ImagesCollide, ImageWidth

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally