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
 Understanding Transparency

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
Alan Posted - Mar 07 2022 : 19:45:51
Hi

I can see that ImageEn can do some amazing things with transparency and layers.

I would like to add an image that I have drawn onto the image layer with transparency.

I'm trying to get my head around some basics.


With a standard TBitmap:

Create
Fill with color I want to be transparent
Set Transparent color eg clFucia
Draw what I want on the bitmap
Display... lets say in TImage.
All I can is the Image I have drawn - no background.

With a TIEBitmap:

Create image layer
using the IEBitmap of that layer

Allocate
Fill
Draw what I want on the bitmap


Now the background color of the image layer is the same as the fill color.

How can I erase the fill color?

From what I can read I need to use the Alpha channel

Do I need to draw on the TIEBitmap with the transparency set?

Do I need to set something to make it transparent?

If you can point me in the right direction, thanks.

Alan





4   L A T E S T    R E P L I E S    (Newest First)
Alan Posted - Mar 08 2022 : 22:33:42
Hi Nigel

Got it to work by drawing a black and white mask and assigning that to the AlphaChanel

Thanks for the great support

Alan
xequte Posted - Mar 08 2022 : 15:09:26
Hi Alan

You need to show me what you are trying to do, but for example let's say you wanted 50% transparent text. You could text out onto the bitmap canvas in the color you want and then text out to the bitmap.alphachannel as 50% gray.

Alternatively, if you have an image with a fuchsia background you want to remove, you can just use:

https://www.imageen.com/help/TImageEnProc.SetTransparentColors.html



Nigel
Xequte Software
www.imageen.com
Alan Posted - Mar 07 2022 : 22:04:13
Hi Nigel

Thanks for the explanation.. Makes sense.

So do I need to create a second (mask) Image in Black and White?

Or can I get ImageEn to create the mask if I provide the color to be transparent?

If the second option, how would do that?

I'm unsure what you mean when you say "Most ImageEn methods will handle this for you."

Thanks again

Alan
xequte Posted - Mar 07 2022 : 21:53:09
Hi Alan

Essentially in ImageEn you have two bitmaps:
- A (generally) 24bit image handling the RGB channels
- And optionally, a 1bit or 8bit image handling the alpha (1 bit gives you pixels that are transparent or not transparent. 8bit gives you 0-255 levels of transparency)

Let's say you assign this image to ImageEnView1.IEBitmap:




And you assign this image to ImageEnView1.IEBitmap.AlphaChannel:




The TImageEnView will display it as follows (when the background is set to solid white):




As you can see the black pixels in the alpha are fully transparent, so the white background shows through.
The grey pixels are 50% transparent so you get a mix of white background and image pixels.
The White pixels are fully opaque so only the image pixels show.


So you see that when working with alpha you must draw to both the image and the alpha channel image. Most ImageEn methods will handle this for you.

If you tell me what you are looking to do, I can give a more specific response.

Nigel
Xequte Software
www.imageen.com