Instance Method


Encodes the transform function to a command buffer using a compute command encoder. The transform function computes the equalization lookup table.


- (void)encodeTransformToCommandBuffer:(id<MTLCommandBuffer>)commandBuffer sourceTexture:(id<MTLTexture>)source histogram:(id<MTLBuffer>)histogram histogramOffset:(NSUInteger)histogramOffset;



A valid command buffer.


A valid texture containing the source image for the filter.


A valid buffer containing the histogram results for an image. This filter will use these histogram results to generate the cumulative histogram for equalizing the image. The histogram results per channel are stored together. The number of channels for which histogram results are stored is determined by the number of channels in the image. If the histogramForAlpha value of the histogramInfo property is NO and the source image is RGBA, then only histogram results for RGB channels are stored.


The byte offset into the histogram buffer where the histogram starts. Must conform to alignment requirements for the offset parameter of the setBuffer:offset:atIndex: method.


The transform function will not begin to execute until after the command buffer has been enqueued and committed. This step will need to be repeated with the new MPSKernel object if the copyWithZone:device: or copyWithZone: method is called. The transform is stored as internal state to the object. You still need to call the encodeToCommandBuffer:sourceTexture:destinationTexture: afterward to apply the transform to produce a result texture.

See Also


- initWithDevice:histogramInfo:

Initializes a histogram with specific information.