Combining Images with Regions (C++ Builder 6.0)
1. |
Start C++ Builder 6. |
|
2. |
If you didn’t install LEAD Raster View Control, install it as follows: |
|
|
On the Component pull-down menu, use the Import ActiveX Control… and select the LEAD Raster View Control (14.5). Press install, and then compile and install the package dclusr.bpk. |
|
3. |
Add 2 of the LEAD Raster View controls to your form. Size and position the controls, as you want them to appear at run time. |
|
4. |
If you didn’t import LEAD Raster IO before, import it as follows: |
|
|
On the Project pull-down menu, use the Import Type library… and select the LEAD Raster IO Object Library (14.5). Press install, and then compile and install the package dclusr.bpk. |
|
5. |
If you didn’t import LEAD Raster Process before, import it as follows: |
|
|
On the Project pull-down menu, use the Import Type library… and select the LEAD Raster Process Object Library (14.5). Press Install, and then compile and install the package dclusr.bpk. |
|
6. |
From the ActiveX controls tab, add 2 of the LEAD Raster IO controls and 1 LEAD Raster Process control to your form. |
|
7. |
Add 2 buttons to your form and name them as follows: |
|
|
Name |
Caption |
|
btnLoad |
Load Images |
|
btnCombine |
Combine |
8. |
Handle the btnLoad button's OnClick event, and code the btnLoadClick procedure as follows: |
void __fastcall TForm1::btnLoadClick(TObject *Sender)
{
LEADRasterIO1->Load ( LEADRasterView1->Raster, AnsiToOLESTR("r:\\images\\image1.cmp"), 0, 1, 1 ) ;
LEADRasterIO2->Load ( LEADRasterView2->Raster, AnsiToOLESTR("r:\\images\\image2.cmp"), 0, 1, 1 ) ;
}
9. |
Handle the btnCombine button's OnClick event, and code the btnCombineClick procedure as follows: |
void __fastcall TForm1::btnCombineClick(TObject *Sender)
{
int nDstLeft;
int nDstTop;
int nSrcLeft;
int nSrcTop;
int nDstWidth;
int nDstHeight;
TRect rClientArea;
::GetClientRect ( LEADRasterView1->Handle, &rClientArea );
LEADRasterView1->Raster->SetRgnRect( (int)(rClientArea.right/8),
(int)(rClientArea.bottom/8),
(int)(rClientArea.right/2),
(int)(rClientArea.bottom/2),
L_RGN_SET);
nDstLeft = (int)(LEADRasterView1->Raster->BitmapWidth /8 );
nDstTop = (int)(LEADRasterView1->Raster->BitmapHeight /8 );
nDstWidth = (int)(LEADRasterView1->Raster->BitmapWidth );
nDstHeight= (int)(LEADRasterView1->Raster->BitmapHeight );
nSrcLeft = 0;
nSrcTop = 0;
LEADRasterProcess1->Combine( LEADRasterView1->Raster, nDstLeft, nDstTop, nDstWidth, nDstHeight, LEADRasterView2->Raster, nSrcLeft, nSrcTop, CB_OP_ADD + CB_DST_0);
}
10. |
Run your program to test it. |