DrawText example for Delphi
This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.
var
sRet: Smallint;
RasterIO: LEADRasterIO;
RasterFxd: LEADRasterFXD;
RasterProc: LEADRasterProcess;
begin
RasterIO:= CreateComObject (CLASS_LEADRasterIO) as LEADRasterIO;
RasterFxd:= CreateComObject (CLASS_LEADRasterFXD) as LEADRasterFXD;
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
LEADRasterView1.AutoRepaint := False;
LEADRasterView1.ScaleMode := 3;
//Load an image for the main control
LEADRasterView1.PaintSizeMode := PAINTSIZEMODE_NORMAL;
RasterIO.Load (LEADRasterView1.Raster, 'c:\temp\golf.jpg', 0, 0, 1);
//Load an image for the foreground of the text
RasterIO.Load (LEADRasterView2.Raster, 'c:\temp\ulay1.bmp', 0, 0, 1);
//Text location
RasterFxd.TextTop := 50;
RasterFxd.TextLeft := 50;
RasterFxd.TextWidth := LEADRasterView1.DstWidth - 50;
RasterFxd.TextHeight := LEADRasterView1.DstHeight - 50;
//The foreground image needs to be the correct size.
RasterProc.Size (LEADRasterView2.Raster, RasterFxd.TextWidth, RasterFxd.TextHeight, 0);
//Text alignment and angle
RasterFxd.TextAlign := FXD_TEXTALIGN_HCENTER_VCENTER;
RasterFxd.TextAngle := 450; //45 degrees
//Text highlight color and style
RasterFxd.TextHiliteColor := RGB(255, 255, 255);
RasterFxd.TextHiliteColor:= FXD_TEXTSTYLE_DROPSHADOW;
//Text drop shadow
RasterFxd.ShadowColor := RGB(0, 0, 0);
RasterFxd.ShadowXDepth := 5;
RasterFxd.ShadowYDepth := 5;
//Make the text a permanent part of the bitmap
RasterFxd.DrawPersistence := True;
RasterFxd.DstLeft := 0;
RasterFxd.DstTop := 0;
RasterFxd.DstRight := Trunc(LEADRasterView1.Raster.BitmapWidth);
RasterFxd.DstBottom := Trunc(LEADRasterView1.Raster.BitmapHeight);
RasterFxd.SrcLeft := 0;
RasterFxd.SrcTop := 0;
RasterFxd.SrcRight := Trunc(LEADRasterView1.Raster.BitmapWidth);
RasterFxd.SrcBottom := Trunc(LEADRasterView1.Raster.BitmapHeight);
RasterFxd.ScaleMode:= 3;
//Draw the text
RasterFxd.DrawText (LEADRasterView1.Raster, 0, 'LEADTOOLS', LEADRasterView1.Raster.Bitmap);
LEADRasterView1.ForceRepaint (sRet);
end;