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 new image from the current layer?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

859 Posts

Posted - Sep 24 2020 :  14:18:40  Show Profile  Reply
Is there a built-in method to create a new image from the current layer (Containing only the layer image)? Or do I have to code it myself? (I don't want to reinvent the wheel).

PeterPanino

859 Posts

Posted - Sep 24 2020 :  15:12:55  Show Profile  Reply
I've come up with this code:

procedure TForm.mCreatenNewImageFromTextLayerClick(Sender: TObject);
var
  b: TIEBitmap;
  i: Integer;
begin
  b := TIEBitmap.Create;
  try
    ImageEnView1.Layers[idx].CopyToBitmap(b);
    ImageEnView1.IEBitmap.Assign(b);
    ImageEnView1.Update;
    for i := ImageEnView1.LayersCount - 1 downto 1 do
      ImageEnView1.LayersRemove(i);
  finally
    b.Free;
  end;
end;
Go to Top of Page

xequte

38176 Posts

Posted - Sep 24 2020 :  17:56:27  Show Profile  Reply
Hi

You can probably simplify it like this (untested):

procedure TForm.mCreateNewImageFromTextLayerClick(Sender: TObject);
begin
  ImageEnView1.Assign( ImageEnView1.CurrentLayer.Bitmap );
  ImageEnView1.LayersClear( False );
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

859 Posts

Posted - Sep 25 2020 :  04:31:10  Show Profile  Reply
Amazing!

I still have a question about the quality of the result. This is the source text-layer with a Heart shape:



And this is the result after the above operation:



You can clearly see that the curved part of the result has massive imperfections. (Also the text seems to be made from a Sawtooth font). Are these imperfections a result of rounding errors or of aliasing effects or of something else? Is it possible to obtain a perfect curved line?
Go to Top of Page

xequte

38176 Posts

Posted - Sep 25 2020 :  05:44:09  Show Profile  Reply
Hi

Non-image layers may need to be handled differently. I'll need to check that when I'm back in the office next week.

In the meantime you might try using CopyToBitmap rather than assigning the bitmap.

https://www.imageen.com/help/TIELayer.CopyToBitmap.html

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