procedure TForm1.CreateMultiLineTextLayer(AMemo: TMemo; AFontName: string; AFontSize: integer; AFontColor: TColor);
{ Create a layer with antialias text from a multiline memo with TIECanvas. }
var
iLayer: Integer;
iIECanvas1: TIECanvas;
i: Integer;
h: Integer;
iLine: string;
begin
{ Add a new layer }
iLayer := ImageEnView1.LayersAdd;
{ Fill the new layer with White }
ImageEnView1.Proc.Fill(CreateRGB(255, 255, 255));
{ Create a TIECanvas }
iIECanvas1 := TIECanvas.Create(ImageEnView1.Layers[ImageEnView1.LayersCurrent].Bitmap.Canvas, True, True);
{ Set the canvas font properties}
iIECanvas1.Font.Name := AFontName;
iIECanvas1.Font.Size := AFontSize;
iIECanvas1.Font.Color := AFontColor;
{ Get the height of the font from the text in the memo }
h := ImageEnView1.Layers[ImageEnView1.LayersCurrent].Bitmap.Canvas.TextHeight(AMemo.Text);
{ Draw each line in the memo to the canvas }
iLine := '';
for i := 0 to AMemo.Lines.Count - 1 do
begin
iLine := AMemo.Lines[i];
iIECanvas1.TextOut2(0, i * h, iLine);
end;
{ Free the TIECanvas }
iIECanvas1.Free;
{ Make the white background transparent }
ImageEnView1.Proc.SetTransparentColors(CreateRGB(255, 255, 255), CreateRGB(255, 255, 255), 0);
{ Add a shadow }
ImageEnView1.Proc.AddSoftShadow(2, 3, 3);
Text1.Down := False;
end;
Example
CreateMultiLineTextLayer(Memo1, 'Verdana', 45, clYellow);

533.78 KB
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html