GetHistogram example for C++ 5.0 and later
int nBrightest,nDarkest;
CString strMsg;
ILEADRasterProcess* m_pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&m_pRasterProc);
m_pRasterProc->HistogramTableSize = 256;
m_pRasterProc->GetHistogram (m_LeadRasterView.GetRaster(), CHANNEL_RED | HIST_LOWHIGH_BITS);
nDarkest = 0;
nBrightest = 0;
for (int nIndex = 0 ;nIndex<256;++nIndex)
{
if (m_pRasterProc->GetHistogramTable(nIndex) != 0)
{
nBrightest = nIndex;
if (nDarkest == 0)
nDarkest = nIndex;
}
}
strMsg.Format(TEXT("Darkest red = %d Brightest red = %d"),nDarkest,nBrightest);
MessageBox(strMsg);
m_pRasterProc->Release();