CorrelationList2 Example for C++ 5.0 and later

ILEADRaster * pRaster1, * pRaster2;
ILEADRaster *pRasterList = NULL;
ILEADRasterIO *pRasterIO;

int nRet;

CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster1);
CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster2);
CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRasterList);
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);

theApp.m_pRasterIO->Load(pRaster1, TEXT("c:\\LetterA.cmp"), 0, 1, 1);
theApp.m_pRasterIO->Load(pRaster2, TEXT("c:\\LetterR.cmp"), 0, 1, 1);

nRet = pRasterIO->Load(m_ltRasView.GetRaster(), "c:\\clean.tif", 0, 1, 1);

pRasterList->InsertBitmapListItem(-1, pRaster1->GetBitmap());
pRasterList->InsertBitmapListItem(-1, pRaster2->GetBitmap());

m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED);

theApp.m_pRasterProcess->CorrelationListMaxPoints = 50;
nRet = theApp.m_pRasterProcess->CorrelationList2(m_ltRasView.GetRaster(),1, 1, 90, pRasterList);

int nNumOfPoints = theApp.m_pRasterProcess->CorrelationListCount;
if (nRet == 0 && nNumOfPoints)
{
   for(int i = 0; i < nNumOfPoints; i++)
   {
      float x = (float)theApp.m_pRasterProcess->GetCorrelationListX(i);
      float y = (float)theApp.m_pRasterProcess->GetCorrelationListY(i);

      if(i)
      {
         m_ltRasView.GetRaster().SetRgnRect(x, y, pRaster1->GetBitmapWidth(), pRaster1->GetBitmapHeight(), L_RGN_OR);
      }
      else
      {
         m_ltRasView.GetRaster().SetRgnRect(x, y, pRaster1->GetBitmapWidth(), pRaster1->GetBitmapHeight(), L_RGN_SET);
      }
   }
}

pRasterList->Release();
pRaster1->Release();
pRaster2->Release();
pRasterIO->Release();