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
 How to rotate iekMEMO Object?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

exchangeviews

India
39 Posts

Posted - Jun 26 2013 :  07:09:29  Show Profile  Reply
Hi all, I am using following code to rotate the iekMEMO object but no luck. Please help me in rotating the Memo Text.

ImageEnVect.MouseInteractVt := ImageEnVect.MouseInteractVt + [miObjectSelect];
ImageEnVect.UseCentralGrip := False;
ImageEnVect.ObjKind[-1] := iekMEMO;
ImageEnVect.ObjLeft[-1] := 0;
ImageEnVect.ObjTop[-1] := 0;
ImageEnVect.ObjWidth[-1] := 200;
ImageEnVect.ObjHeight[-1] := 80;
ImageEnVect.ObjPenColor[-1]:= clRed;
ImageEnVect.ObjGripPen.Style := psClear;
ImageEnVect.ObjBrushColor[-1] := clYellow;
ImageEnVect.ObjMemoBorderStyle[-1]:= psClear;
ImageEnVect.ObjMemoCharsBrushStyle[-1]:=bsClear;
ImageEnVect.ObjGripBrush.Style := bsClear;
ImageEnVect.ObjText[-1] := 'Hello World!';
ImageEnVect.ObjTransparency[-1] := 255;
ImageEnVect.ObjFontAngle[-1]:=45;
FontDialog.Font.Name := 'Verdana';
FontDialog.Font.Size := 25;
FontDialog.Font.Color := clRed;
ImageEnVect.SetObjFont(-1, FontDialog.Font);
ImageEnVect.ObjTextEditable[-1]:=False;
ImageEnVect.AddNewObject;

Thanks in advance.

w2m

USA
1990 Posts

Posted - Jun 26 2013 :  10:25:53  Show Profile  Reply
I think only a iekText object can be rotated.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

exchangeviews

India
39 Posts

Posted - Jun 26 2013 :  22:33:12  Show Profile  Reply
Actually I wish to create a multiline watermarking over selected image with rotation option. I have seen several commercial watermark software are providing the same with success but when I am trying to do the same it is unsuccessful. Anyone please help me in getting this work. or tell me the way to put multiline rotated watermark which is typed in TMemo.

I am using ImageEn4.1.4 and delphi 2009. I saw a thread about LayersCreateFromText (http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1028) but unable to use. unable to find in Help too. If layer is solution, please guide me how to do the same.

Thanks in advance.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 27 2013 :  06:26:28  Show Profile  Reply
You can add a Layer, do a Canvas.Textout and rotate the layer. As I said before, you can not use a iekMemo. Why were you unable to use LayersCreateFromText?

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

exchangeviews

India
39 Posts

Posted - Jun 29 2013 :  04:17:35  Show Profile  Reply
Thanks William. I used layers and it is working great with rotation. Now the problem is how to put multiline text typed in TMemo. If I textout multiline text, it shows a single line text above layer with 2 square boxes at line break position instead of breaking line.
ImageEnView1.LayersAdd;
ImageEnView1.Bitmap.Canvas.Font.Name:='Verdana';
ImageEnView1.Bitmap.Canvas.Font.Size:=45;
ImageEnView1.Bitmap.Canvas.Font.Color:=clYellow;
ImageEnView1.Bitmap.Canvas.TextOut(0,0,Memo1.Text);

How to enable line break for second line text? Thanks in advance. Please help.



Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 29 2013 :  08:14:57  Show Profile  Reply
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
Go to Top of Page

exchangeviews

India
39 Posts

Posted - Jun 30 2013 :  07:03:12  Show Profile  Reply
This is superb. Thanks william for your help. I am wondering if i can edit the textout on text change (Memo1Change(Sender: TObject)). If I call this function on change event, it creates a new layer on each key press.

The way i am able to do same is by deleting the exiting layer & calling the same function on every key press. Is this correct way of doing? Any trick else? thanks.

ImageEnView1.LayersRemove(ImageEnView1.LayersCurrent);
CreateMultiLineTextLayer(Memo1, 'Verdana', 45, clYellow);
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 30 2013 :  11:52:53  Show Profile  Reply
The text is actually drawn on the image, so the text is can not be modified once it is added to the image... so you have to remove the layer and replace it with a new one like you posted.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

exchangeviews

India
39 Posts

Posted - Jul 01 2013 :  08:14:25  Show Profile  Reply
Thanks for your reply.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: