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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Add Text, Rotate and place it at a specific locati

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Aug 25 2017 : 09:42:10
Hello,

I am using following code to Add Text to a Layer, Rotate it and place it towards the right edge in the Center of the main image:

procedure TfrmScanAndPrint.DoStampImage(ieTemp: TImageEnView);
var
  i: integer;
  j: integer;
  iLayer: integer;
  iSpacing: integer;
  iText: string;
  iRows: integer;
begin
  Screen.Cursor := crHourGlass;
  try
    ieTemp.DeSelect;
    ieTemp.LayersCreateFromText('Duplicate Copy...','Tahoma',14,clRed,[fsBold],false,1,0,0,True);
    ieTemp.LayersRotateAll(90, True, True);

    ieTemp.CurrentLayer.PosX := ieTemp.Layers[0].Width - ieTemp.CurrentLayer.Width - 5;
    ieTemp.CurrentLayer.PosY := ieTemp.Layers[0].PosX + ieTemp.CurrentLayer.Height + 5;

    ieTemp.LayersAlign(ilaAlignHorizontalCenters);
    ieTemp.LayersAlign(ilaAlignVerticalCenters);

    ieTemp.Update;

    ieTemp.LayersMergeAll;

  finally
    Screen.Cursor := crDefault;
  end;
end;


But this is not the right way I can tell. Actually I was trying to align the layers to get exact/perfect adjustment for the text.

I am attaching an image as per which I want final output, but here the text should always be in center and rotated and in vertical center irrespective of image height.



TIA




Yogi Yang
4   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Sep 04 2017 : 00:54:55
Bill,

Thanks for the code sample. As usual your code works like a charm.

Sorry for my late reply as I was busy with another project.

TIA


Yogi Yang
w2m Posted - Aug 25 2017 : 11:23:14
How is this?


procedure TForm1.AddText1Click(Sender: TObject);
begin
  Screen.Cursor := crHourGlass;
  try
    ImageEnView1.DeSelect;
    ImageEnView1.LayersCreateFromText('Duplicate Copy...', 'Tahoma', 42, clRed,
      [fsBold], false, 1, 0, 0, True);
    ImageEnView1.LayersRotateAll(90, True, True);
    ImageEnView1.CurrentLayer.PosX := ImageEnView1.Layers[0].Width -
      ImageEnView1.IEBitmap.IECanvas.TextWidth('Duplicate Copy...');
    ImageEnView1.CurrentLayer.PosY := ImageEnView1.Layers[0].Height div 2 -
      ImageEnView1.IEBitmap.IECanvas.TextWidth('Duplicate Copy...') * 2;
    ImageEnView1.LayersAlign(ilaAlignHorizontalCenters);
    ImageEnView1.LayersAlign(ilaAlignVerticalCenters);
    ImageEnView1.Update;
    ImageEnView1.LayersMergeAll;
  finally
    Screen.Cursor := crDefault;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
yogiyang Posted - Aug 25 2017 : 11:04:03
Thanks Bill,

But no.

I have attached an image in my original post. I want the text to come at the location shown in the attached image.

In your sample the text is in center in both way. It should be vertically in center and on the right edge without getting truncated.

TIA


Yogi Yang
w2m Posted - Aug 25 2017 : 10:21:08
Is this what you are looking for?


If so, here is the code:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Screen.Cursor := crHourGlass;
  try
    ImageEnView1.DeSelect;
    ImageEnView1.LayersCreateFromText('Duplicate Copy...', 'Tahoma', 36, clRed,
      [fsBold], false, 1, 0, 0, True);
    ImageEnView1.LayersRotateAll(90, True, True);
    ImageEnView1.CurrentLayer.PosX := ImageEnView1.Layers[0].Width div 2 -
      ImageEnView1.CurrentLayer.Width;
    ImageEnView1.CurrentLayer.PosY := ImageEnView1.Layers[0].Height div 2 -
      ImageEnView1.IEBitmap.IECanvas.TextWidth('Duplicate Copy...');
    ImageEnView1.LayersAlign(ilaAlignHorizontalCenters);
    ImageEnView1.LayersAlign(ilaAlignVerticalCenters);
    ImageEnView1.Update;
    ImageEnView1.LayersMergeAll;
  finally
    Screen.Cursor := crDefault;
  end;
end;

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