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
 Understanding Transparency
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Alan

Australia
10 Posts

Posted - Mar 07 2022 :  19:45:51  Show Profile  Reply
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





xequte

38182 Posts

Posted - Mar 07 2022 :  21:53:09  Show Profile  Reply
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
Go to Top of Page

Alan

Australia
10 Posts

Posted - Mar 07 2022 :  22:04:13  Show Profile  Reply
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
Go to Top of Page

xequte

38182 Posts

Posted - Mar 08 2022 :  15:09:26  Show Profile  Reply
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
Go to Top of Page

Alan

Australia
10 Posts

Posted - Mar 08 2022 :  22:33:42  Show Profile  Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: