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
 Create a Layer in a TIEBitmap directly?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Oct 28 2024 :  05:02:00  Show Profile  Reply
I currently use this code to add a "PAID" stamp to a TIEBitmap:

procedure AddPaidStampToBitmap(Bmp: TIEBitmap);
var
  TempImageEnView: TImageEnView;
begin
  // Create a temporary TImageEnView to handle layers:
  TempImageEnView := TImageEnView.Create(nil);
  try
    // Load the bitmap into TImageEnView:
    TempImageEnView.IEBitmap.Assign(Bmp);  // Copy TIEBitmap content to TImageEnView

    // Apply a "Paid" stamp to the image:
    with TempImageEnView do
    begin
      LayersAdd('PAID', 48, clRed, 'Arial Black', [fsBold]);
      CurrentLayer.Rotate := 30;
      TIETextLayer(CurrentLayer).SizeToText();
      CurrentLayer.PosX := IELayer_Pos_HCenter;
      CurrentLayer.PosY := IELayer_Pos_VCenter;
      LayersMergeAll();
    end;

    // Copy the result back to the original TIEBitmap:
    Bmp.Assign(TempImageEnView.IEBitmap);
  finally
    TempImageEnView.Free;
  end;
end;


Is it possible to do this with the TIEBitmap directly without using the temporary TImageEnView?

xequte

38608 Posts

Posted - Oct 28 2024 :  17:40:04  Show Profile  Reply
Yes, you can use one of the text out methods:

http://www.imageen.com/help/TIECanvas.DrawText.html
http://www.imageen.com/help/TImageEnProc.TextOut.html

Note: The Proc method supports positioning consts


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