Instance Method

colorizeByMappingGray:toColor:blackMapping:whiteMapping:

Colorizes a grayscale image.

Declaration

- (void)colorizeByMappingGray:(CGFloat)midPoint toColor:(NSColor *)midPointColor blackMapping:(NSColor *)shadowColor whiteMapping:(NSColor *)lightColor;

Parameters

midPoint

A float value representing the midpoint of the grayscale image.

midPointColor

A color object representing the midpoint of the color to map the image to.

shadowColor

A color object representing the black mapping to use for shadows.

lightColor

A color object representing the white mapping to be used in the image.

Discussion

This method maps the receiver such that:

  • Gray value of midPoint –> midPointColor;

  • black –> shadowColor;

  • white –> lightColor.

It works on images with 8-bit SPP, and thus supports either 8-bit gray or 24-bit color (with optional alpha).

See Also

Creating an NSBitmapImageRep Object

+ imageRepWithData:

Creates and returns an NSBitmapImageRep object initialized with the first image in the supplied data.

+ imageRepsWithData:

Creates and returns an array of initialized NSBitmapImageRep objects corresponding to the images in the supplied data.

- initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:

Initializes the receiver, a newly allocated NSBitmapImageRep object, so it can render the specified image.

- initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:

Initializes the receiver, a newly allocated NSBitmapImageRep object, so it can render the specified image.

- initWithCGImage:

Returns an NSBitmapImageRep object created from a Core Graphics image object.

- initWithCIImage:

Returns an NSBitmapImageRep object created from a Core Image object.

- initWithData:

Initializes a newly allocated NSBitmapImageRep from the provided data.

- initWithFocusedViewRect:

Initializes the receiver, a newly allocated NSBitmapImageRep object, with bitmap data read from a rendered image.

Deprecated
- initForIncrementalLoad

Initializes and returns the receiver, a newly allocated NSBitmapImageRep object, for incremental loading.