The Bitmap::GetHistogram method returns one or more histograms for specified color channels of this Bitmap object.
Status GetHistogram( IN HistogramFormat format, IN UINT NumberOfEntries, UINT *channel0, UINT *channel1, UINT *channel2, UINT *channel3 );
Element of the HistogramFormat enumeration that specifies the channels for which histograms will be created.
Integer that specifies the number of elements (of type UINT) in each of the arrays pointed to by channel0, channel1, channel2, and channel3. You must allocate memory for those arrays before you call Bitmap::GetHistogram. To determine the required number of elements, call Bitmap::GetHistogramSize.
Pointer to an array of UINTs that receives the first histogram.
Pointer to an array of UINTs that receives the second histogram if there is a second histogram. Pass NULL if there is no second histogram.
Pointer to an array of UINTs that receives the third histogram if there is a third histogram. Pass NULL if there is no third histogram.
Pointer to an array of UINTs that receives the fourth histogram if there is a fourth histogram. Pass NULL if there is no fourth histogram.
Type: Type: Status
If the method succeeds, it returns Ok, which is an element of the Status enumeration.
If the method fails, it returns one of the other elements of the Status enumeration.
The number of histograms returned depends on the HistogramFormat enumeration element passed to the format parameter. For example, if format is equal to HistogramFormatRGB, then three histograms are returned: one each for the red, green, and blue channels. In that case, channel0 points to the array that receives the red-channel histogram, channel1 points to the array that receives the green-channel histogram, and channel2 points to the array that receives the blue-channel histogram. For HistogramFormatRGB, channel3 must be set to NULL because there is no fourth histogram. For more details, see the HistogramFormat enumeration.
The following example constructs a Bitmap object from a BMP file. The code retrieves three histograms from the bitmap: one each for the red, green, and blue channels. Note the order of RGB in the name of the enumeration element HistogramFormatRGB. R is first, so it corresponds with ch0. Green is second, so it corresponds with ch1. Blue is third, so it corresponds with ch2. The final parameter passed to Bitmap::GetHistogram is NULL because there is no fourth histogram.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|
|Header||gdiplusheaders.h (include Gdiplus.h)|