DrawText example for C++ Builder
This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.
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;
LEADRasterView1->ScaleMode = 3;
//Load an image for the main control
LEADRasterView1->PaintSizeMode = PAINTSIZEMODE_NORMAL;
pRasterIO->Load (LEADRasterView1->Raster, AnsiToOLESTR("c:\\temp\\tmp.jpg"), 0, 0, 1);
//Load an image for the foreground of the text
pRasterIO->Load (LEADRasterView2->Raster, AnsiToOLESTR("c:\\temp\\ulay1.bmp"), 0, 0, 1);
//Text location
pRasterFxd->TextTop = 50;
pRasterFxd->TextLeft = 50;
pRasterFxd->TextWidth = LEADRasterView1->DstWidth - 50;
pRasterFxd->TextHeight = LEADRasterView1->DstHeight - 50;
//The foreground image needs to be the correct size
pRasterProc->Size (LEADRasterView2->Raster, pRasterFxd->TextWidth, pRasterFxd->TextHeight, (ResizeConstants)0);
//Text alignment and angle
pRasterFxd->TextAlign = FXD_TEXTALIGN_HCENTER_VCENTER;
pRasterFxd->TextAngle = 450; //45 degrees
//Text highlight color and style
pRasterFxd->TextHiliteColor = RGB(255, 255, 255);
pRasterFxd->TextStyle = FXD_TEXTSTYLE_DROPSHADOW;
//Text drop shadow
pRasterFxd->ShadowColor = RGB(0, 0, 0);
pRasterFxd->ShadowXDepth = 5;
pRasterFxd->ShadowYDepth = 5;
//Make the text 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;
//Draw the text
pRasterFxd->DrawText (LEADRasterView1->Raster, 0, AnsiToOLESTR("LEADTOOLS"), LEADRasterView1->Raster->Bitmap);
LEADRasterView1->ForceRepaint ();
pRasterFxd-> Release( );
pRasterProc-> Release( );
pRasterIO-> Release ( );