Instance Method

colorAtX:y:

Returns the color of the pixel at the specified coordinates.

Declaration

- (NSColor *)colorAtX:(NSInteger)x y:(NSInteger)y;

Parameters

x

The x-axis coordinate.

y

The y-axis coordinate.

Return Value

A color object representing the color at the specified coordinates.

Discussion

Calling this method creates a new NSColor object. The overhead of object creation means this method is best suited for infrequent color sampling. If you instead need to work with large numbers of pixels, access the bitmap data directly using the bitmapData property or the getPixel:atX:y: method for better performance.

See Also

Managing Pixel Values

- setColor:atX:y:

Changes the color of the pixel at the specified coordinates.

- setPixel:atX:y:

Sets the receiver's pixel at the specified coordinates to the specified raw pixel values.

- getPixel:atX:y:

Returns by indirection the pixel data for the specified location in the receiver.