ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Transparent Text (Watermark)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

kandc

29 Posts

Posted - Sep 15 2014 :  11:00:49  Show Profile  Reply
Hello,

I have read that it is not possible to draw transparent text. If this is not the case, can you advise how to do it?

I thought it might be possible by first creating a separate layer, drawing the text light gray, then merging the layers, but I cannot get it to work.

I need to be able to draw a big watermark copyright, however, without it being transparent, it's difficult to read documents without the watermark being transparent.

Thanks!

w2m

USA
1990 Posts

Posted - Sep 15 2014 :  13:22:09  Show Profile  Reply
Here is one way to do it...
procedure TForm1.CreateWatermarkLayer(AString: string; AFontName: string;
AFontSize: Integer; AFontColor: TColor; ATransparency: integer; AAddShadow: boolean);
{ Create a watermark layer. }
var
  iLayer: Integer;
  iListItem: TListItem;
begin
  { All layers have the same size }
  ImageEnView1.LayersSync := True;
  { Add a new layer }
  iLayer := ImageEnView1.LayersAdd;
  { Fill the layer with White }
  ImageEnView1.Proc.Fill(TColor2TRGB(clWhite));
  { Output our text }
    ImageEnView1.Proc.TextOut(Align_Text_Horz_Center, Align_Text_Vert_Center,
      AString, AFontName, AFontSize, AFontColor, [fsBold]);
  { Make the white background transparent }
   ImageEnView1.Proc.SetTransparentColors(TColor2TRGB(clWhite), TColor2TRGB(clWhite), 0);
  { Add a shadow }
  if AAddShadow = True then
    ImageEnView1.Proc.AddSoftShadow(2, 3, 3);
  { Set the layers transparency }
  ImageEnView1.Layers[iLayer].Transparency := ATransparency;
end;

procedure TForm1.AddWatermark1Click(Sender: TObject);
var
  iWatermark: string;
  iTransparency: integer;
begin
  iWatermark := Watermark1.Text;
  iTransparency := StrToIntDef(Transparency1.Text, 75);
  CreateWatermarkLayer(iWatermark, 'Arial', 36, clBlack, iTransparency, False);
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

kandc

29 Posts

Posted - Sep 15 2014 :  13:36:19  Show Profile  Reply
Awesome, Thanks Bill. I was just missing this line:

iSource.Layers [LayerIndex].Transparency := 55;

Kevin
Go to Top of Page

xequte

38615 Posts

Posted - Jul 05 2016 :  16:55:35  Show Profile  Reply
Note: We have implemented an updated method for creation of layers from text:

http://www.imageen.com/help/TImageEnView.LayersCreateFromText.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: