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
 Using SoftShadow in Text Layer - TIETextLayer

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
nachbar Posted - Aug 28 2019 : 14:51:32
I have a utility app I use to add text with a shadow to an adjusted bitmap. I had implemented that utility using TImageEnView.LayersCreateFromText, which had an AddShadow parameter, and it worked great. I was updating the utility, and LayersCreateFromText is now deprecated and no longer documented, with the recommendation to use TIETextLayer, which has a SoftShadow component.

However, I am not able to get the shadow to show up, even though Enabled is true and regardless of what I set for the radius, etc. The only shadow demo uses Proc->AddSoftShadow, but that just puts a shadow on the entire image, not shadowing the text. There is a nice picture in the help file of what shadowed text should look like, but no code to produce it.

I am using a throwaway (i.e., not displayed) TImageEnView, assigning the image from the TIEBitmap to Layers[0]->Bitmap, creating a TIETextLayer using LayersAdd, setting the text and other info on the TIETextLayer, calling SizeToText on the layer, and then calling Update() on the TImageEnView. Then I use IELayersMerge to merge both of the layers together into a bitmap.

All of that works fine to put text on the bitmap, but I cannot cause a shadow to appear. If I call AddShoftShadow on the TImageEnView's Proc, I get the error "Active layer does not contain bitmap." -- That is true - the active layer is a TIETextLayer.

Can you tell me how to put shadowed text on a bitmap, or provide some working code using TIETextLayer->SoftShadow?

Thank you.

James Nachbar
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 29 2019 : 23:14:05
Hi James

No, unfortunately LayersCreateFromText creates an image layer with text drawn onto it, so it's not a great way to create a "text layer".

If the layer is sized after creation then it will look awful.

Nigel
Xequte Software
www.imageen.com
nachbar Posted - Aug 29 2019 : 19:57:32
Thank you. Yes, LayersCreateFromText works fine. Will LayersCreateFromText be restored to the documentation?

James Nachbar
xequte Posted - Aug 29 2019 : 17:15:17
Hi James

You can continue to use LayersCreateFromText. It won't be removed.

This works in my testing:

// Load an image, add text with a soft shadow and save it
var
  iev : TImageEnView;
begin
  iev := TImageEnView.Create( nil );
  iev.IEBitmap.LoadFromFile( 'd:\image.jpg' );
  iev.LayersAdd( ielkText, 100, 100 );
  TIETextLayer( iev.CurrentLayer ).Text := 'This is a test';
  TIETextLayer( iev.CurrentLayer ).Font.Size := 30;
  TIETextLayer( iev.CurrentLayer ).Font.Style := [fsBold];
  iev.CurrentLayer.SoftShadow.Enabled := True;
  iev.LayersMergeAll();
  iev.IEBitmap.SaveToFile( 'd:\image_out.jpg' );
  iev.Free;
end;


Nigel
Xequte Software
www.imageen.com