Returns whether the destination rectangle would intersect a non-transparent portion of the image.
SDK
- macOS 10.6+
Framework
- App
Kit
Declaration
func hitTest(_ testRectDestSpace: NSRect, withDestinationRect imageRectDestSpace: NSRect, context: NSGraphics Context?, hints: [NSImage Rep.Hint Key : Any]?, flipped: Bool) -> Bool
Parameters
testRectDestSpace
The rectangle to hit test.
imageRectDestSpace
A rectangle representing the drawn size of the image.
referenceContext
A graphics context. This value can be
nil
.hints
An optional dictionary of hints that provide more context for selecting or generating a
CGImage
, and may override properties of thereference
. See Image Hint Dictionary Keys for a summary of the possible key-value pairs.Context flipped
true
if the image is flipped, otherwisefalse
.
Return Value
YES if the test
intersects with non-transparent content within the image
, otherwise NO.
Discussion
This method simulates the results of hit-testing the test rectangle as if the image was drawn in the graphics context using the provided hints and respecting the specified flippedness.