DrawShape example for C++ Builder
This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.
LEADRasterIO* pRasterIO= NULL;
LEADRasterFXD* pRasterFxd;
LEADRasterProcess* pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO);
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
CoCreateInstance(CLSID_LEADRasterFXD, NULL, CLSCTX_ALL, IID_ILEADRasterFXD, (void**)&pRasterFxd);
LEADRasterView1->AutoRepaint = False;
//Load an image for the main control
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("v:\\images\\image1.cmp"), 0, 0, 1);
//Load an image for the background of the shape
pRasterIO->Load (LEADRasterView2->Raster, AnsiToOLESTR("c:\\temp\\ulay1.bmp"), 0, 0, 1);
//Shape background
pRasterFxd->ShapeBackgroundStyle = FXD_BACKSTYLE_TILED_IMAGE;
pRasterFxd->BackgroundImageTop = 0;
pRasterFxd->BackgroundImageLeft = 0;
pRasterFxd->BackgroundImageWidth = LEADRasterView2->Raster->BitmapWidth;
pRasterFxd->BackgroundImageHeight = LEADRasterView2->Raster->BitmapHeight;
//Shape location
pRasterFxd->ShapeTop = 50;
pRasterFxd->ShapeLeft = 50;
pRasterFxd->ShapeWidth = LEADRasterView1->DstWidth - 50;
pRasterFxd->ShapeHeight = LEADRasterView1->DstHeight - 50;
//Shape border
pRasterFxd->ShapeBorderColor = RGB(255, 0, 0);
pRasterFxd->ShapeBorderStyle = FXD_BORDERSTYLE_SOLID;
pRasterFxd->ShapeBorderThickness = 10;
pRasterFxd->ShapeInnerBandHiliteColor = RGB(255, 255, 255);
pRasterFxd->ShapeInnerBandShadowColor = 0;
pRasterFxd->ShapeInnerBandStyle = FXD_INNERSTYLE_RAISED;
pRasterFxd->ShapeInnerBandThickness = 2;
pRasterFxd->ShapeOuterBandHiliteColor = RGB(0, 255, 0);
pRasterFxd->ShapeOuterBandShadowColor = RGB(128, 128, 128);
pRasterFxd->ShapeOuterBandStyle = FXD_OUTERSTYLE_RAISED;
pRasterFxd->ShapeOuterBandThickness = 2;
//Make the shape a permanent part of the bitmap
pRasterFxd->DrawPersistence = True;
pRasterFxd->DstLeft = 0;
pRasterFxd->DstTop = 0;
pRasterFxd->DstRight = LEADRasterView1->Raster->BitmapWidth;
pRasterFxd->DstBottom =LEADRasterView1->Raster->BitmapHeight;
pRasterFxd->SrcLeft = 0;
pRasterFxd->SrcTop = 0;
pRasterFxd->SrcRight = LEADRasterView1->Raster->BitmapWidth;
pRasterFxd->SrcBottom = LEADRasterView1->Raster->BitmapHeight;
pRasterFxd->ScaleMode = 3;
pRasterFxd->ClientSizeX = 5;
pRasterFxd->ClientSizeY = 5;
//Draw the shape
pRasterFxd->DrawShape (LEADRasterView1->Raster, 0, FXD_SHAPE_RECTANGLE, LEADRasterView2->Raster->Bitmap);
//Repaint
LEADRasterView1->AutoRepaint = True;
pRasterFxd-> Release();
pRasterProc-> Release( );
pRasterIO-> Release( );