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
 Making the whole image transparent

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
PeterPanino Posted - Dec 05 2021 : 06:22:12
I use this code to make the whole image transparent (which does work):

ImageEnView1.Layers[0].Transparency := 128;


However, afterwards, HasAlphaChannel(True) still reports the image as not having transparent areas:

ImageEnView1.Layers[0].Transparency := 128;
CodeSite.Send('ImageEnView1.IEBitmap.HasAlphaChannel(True)', ImageEnView1.IEBitmap.HasAlphaChannel(True)); // False!


Is the first or the second procedure wrong?
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 09 2021 : 14:01:53
Hi Peter

You can use:

ImageEnView1.IEBitmap.AlphaChannel.GradientFillRect();

https://www.imageen.com/help/TIEBitmap.GradientFillRect.html

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Dec 09 2021 : 11:14:48
Hi,

how do I apply gradient transparency explicitly to a SELECTION?

ImageEnView1.SetSelectedAreaAlpha does not allow gradient transparency.

It would be useful if ImageEnView1.IEBitmap.AlphaFill (even with gradient transparency) would be automatically applied to the selected area IF a selection exists (otherwise to the whole image)!

A workaround would be:
1. Copy the selection area to a temporary IEBitmap
2. Apply the gradient transparency to that temporary IEBitmap
3. Then copy the temporary IEBitmap back to the selection area

Isn't there already a built-in method to do this?
PeterPanino Posted - Dec 09 2021 : 10:57:23
Hi Nigel,

Thanks!

IEBitmap.AlphaFill is a perfect solution, as it optionally supports even gradient transparency!
xequte Posted - Dec 07 2021 : 13:29:41
You can use Layer[0].ConvertToImageLayer();

// Convert an image layer with 50% opacity to an image with 50% alpha
ImageEnView1.LayersAdd( ielkImage );
TIEImageLayer( ImageEnView1.CurrentLayer ).Bitmap.Read( 'D:\MyImage.jpeg' );
ImageEnView1.CurrentLayer.Opacity := 0.50;
ImageEnView1.CurrentLayer.ConvertToImageLayer();

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


But using layer functionality is overkill if all you want to do is make an image transparent. You can just work with the alpha channel instead:

ImageEnView1.IEBitmap.AlphaFill( 128 );
ImageEnView1.Update();

https://www.imageen.com/help/TIEBitmap.AlphaFill.html

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Dec 07 2021 : 08:49:00
Hi Nigel

But how do I flatten the Background Layer? I get an AV when I do this:

ImageEnView1.LayersMerge([0, 0]);


And when I do:

ImageEnView1.LayersMerge([]);


...then any other existing layers are merged too which I do not want.
xequte Posted - Dec 07 2021 : 02:38:39
Hi Peter

> ImageEnView1.Layers[0].Transparency := 128;

This only makes the layer *display* as half transparent (the tranparency will become fixed if convert to image layer/flatten).


> ImageEnView1.IEBitmap.HasAlphaChannel(True)); // False!

This checks whether the image itself has any alpha (e.g. an image loaded from a PNG file).



Nigel
Xequte Software
www.imageen.com