Type Boolean
Object DisplayObject
Library display.*
Revision Release 2024.3703
Keywords image mask, masking, clipping, bit mask
See also object.isHitTestable


Limits touch events to the masked portion of the object. This property can be read or set.

By default this property is true, meaning touch events for the object only occur on the masked portion of the object. Setting this property to false generates touch events when a touch occurs on any portion of the object.

Currently, for an image mask created by graphics.newMask(), the touch sensitive area corresponds to the image bounds, i.e. it is rectangular regardless of the image contents.


-- Create and position image to be masked
local image = display.newImageRect( "image.png", 768, 1024 )
image:translate( display.contentCenterX, display.contentCenterY )
-- Create mask and apply to image
local mask = graphics.newMask( "circlemask.png" )
image:setMask( mask )
-- Touch events on the image will be masked to the mask bounds
-- (always rectangular for an image, regardless of the image contents)
image.isHitTestMasked = true
-- Transform mask
image.maskScaleX, image.maskScaleY = 2,2