.TH "MPSImageHistogram" 3 "Mon Jul 9 2018" "Version MetalPerformanceShaders-119.3" "MetalPerformanceShaders.framework" \" -*- nroff -*- .ad l .nh .SH NAME MPSImageHistogram .SH SYNOPSIS .br .PP .PP \fC#import \fP .PP Inherits \fBMPSKernel\fP\&. .SS "Instance Methods" .in +1c .ti -1c .RI "(nonnull instancetype) \- \fBinitWithDevice:histogramInfo:\fP" .br .ti -1c .RI "(nullable instancetype) \- \fBinitWithCoder:device:\fP" .br .ti -1c .RI "(void) \- \fBencodeToCommandBuffer:sourceTexture:histogram:histogramOffset:\fP" .br .ti -1c .RI "(size_t) \- \fBhistogramSizeForSourceFormat:\fP" .br .in -1c .SS "Properties" .in +1c .ti -1c .RI "MTLRegion \fBclipRectSource\fP" .br .ti -1c .RI "BOOL \fBzeroHistogram\fP" .br .ti -1c .RI "vector_float4 \fBminPixelThresholdValue\fP" .br .ti -1c .RI "\fBMPSImageHistogramInfo\fP \fBhistogramInfo\fP" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP The \fBMPSImageHistogram\fP computes the histogram of an image\&. .SH "Method Documentation" .PP .SS "\- (void) encodeToCommandBuffer: (nonnull id< MTLCommandBuffer >) commandBuffer(nonnull id< MTLTexture >) source(nonnull id< MTLBuffer >) histogram(NSUInteger) histogramOffset" Encode the filter to a command buffer using a MTLComputeCommandEncoder\&. The filter will not begin to execute until after the command buffer has been enqueued and committed\&. .PP \fBParameters:\fP .RS 4 \fIcommandBuffer\fP \fBA\fP valid MTLCommandBuffer\&. .br \fIsource\fP \fBA\fP valid MTLTexture containing the source image for the filter .br \fIhistogram\fP \fBA\fP valid MTLBuffer to receive the histogram results\&. .br \fIhistogramOffset\fP Byte offset into histogram buffer at which to write the histogram results\&. Must be a multiple of 32 bytes\&. The histogram results / 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 histogramInfo\&.histogramForAlpha is false and the source image is RGBA then only histogram results for RGB channels are stored\&. .RE .PP The histogram results are stored in the histogram buffer as follows: .IP "\(bu" 2 histogram results for the R channel for all bins followed by .IP "\(bu" 2 histogram results for the G channel for all bins followed by .IP "\(bu" 2 histogram results for the B channel for all bins followed by .IP "\(bu" 2 histogram results for the \fBA\fP channel for all bins .PP .SS "\- (size_t) histogramSizeForSourceFormat: (MTLPixelFormat) sourceFormat" The amount of space in the output MTLBuffer the histogram will take up\&. This convenience function calculates the minimum amount of space needed in the output histogram for the results\&. The MTLBuffer should be at least this length, longer if histogramOffset is non-zero\&. .PP \fBParameters:\fP .RS 4 \fIsourceFormat\fP The MTLPixelFormat of the source image\&. This is the source parameter of -encodeToCommandBuffer: sourceTexture:histogram:histogramOffset .RE .PP \fBReturns:\fP .RS 4 The number of bytes needed to store the result histograms\&. .RE .PP .SS "\- (nullable instancetype) \fBinitWithCoder:\fP (NSCoder *__nonnull) aDecoder(nonnull id< MTLDevice >) device" \fBNSSecureCoding\fP compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly\&. To avoid that problem, use initWithCoder:device instead\&. .PP \fBParameters:\fP .RS 4 \fIaDecoder\fP The NSCoder subclass with your serialized \fBMPSKernel\fP .br \fIdevice\fP The MTLDevice on which to make the \fBMPSKernel\fP .RE .PP \fBReturns:\fP .RS 4 \fBA\fP new \fBMPSKernel\fP object, or nil if failure\&. .RE .PP .PP Reimplemented from \fBMPSKernel\fP\&. .SS "\- (nonnull instancetype) \fBinitWithDevice:\fP (nonnull id< MTLDevice >) device(const \fBMPSImageHistogramInfo\fP *__nonnull) histogramInfo" Specifies information to compute the histogram for channels of an image\&. .PP \fBParameters:\fP .RS 4 \fIdevice\fP The device the filter will run on .br \fIhistogramInfo\fP Pointer to the MPSHistogramInfo struct .RE .PP \fBReturns:\fP .RS 4 \fBA\fP valid \fBMPSImageHistogram\fP object or nil, if failure\&. .RE .PP .SH "Property Documentation" .PP .SS "\- clipRectSource\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The source rectangle to use when reading data\&. \fBA\fP MTLRegion that indicates which part of the source to read\&. If the clipRectSource does not lie completely within the source image, the intersection of the image bounds and clipRectSource will be used\&. The clipRectSource replaces the \fBMPSUnaryImageKernel\fP offset parameter for this filter\&. The latter is ignored\&. Default: MPSRectNoClip, use the entire source texture\&. .SS "\- histogramInfo\fC [read]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" Return a structure describing the histogram content Returns a \fBMPSImageHistogramInfo\fP structure describing the format of the histogram\&. .SS "\- minPixelThresholdValue\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" The minimum pixel threshold value The histogram entries will be incremented only if pixel value is >= minPixelThresholdValue\&. The minPixelThresholdValue is a floating-point value\&. For unsigned normalized textures, the minPixelThresholdValue should be a value between 0\&.0f and 1\&.0f (for eg\&. MTLPixelFormatRGBA8Unorm)\&. For signed normalized textures, the minPixelThresholdValue should be a value between -1\&.0f and 1\&.0f (for eg\&. MTLPixelFormatRGBA8Snorm)\&. Default: vector_float4(0\&.0f)\&. .SS "\- zeroHistogram\fC [read]\fP, \fC [write]\fP, \fC [nonatomic]\fP, \fC [assign]\fP" Zero-initalize the histogram results Indicates that the memory region in which the histogram results are to be written in the histogram buffer are to be zero-initialized or not\&. Default: YES\&. .SH "Author" .PP Generated automatically by Doxygen for MetalPerformanceShaders\&.framework from the source code\&.