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
 TImageEnView and Proc.Fill() method
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

115 Posts

Posted - Apr 16 2025 :  22:56:05  Show Profile  Reply
When using the Proc.Fill() method of TImageEnView to dynamically change colors with an Opacity value of 0.5, after changing the color several times, the original image is no longer visible. What is the reason for this, and is there a way to fix it?

xequte

38949 Posts

Posted - Apr 17 2025 :  23:45:18  Show Profile  Reply
Hi

Fill does not alter the alpha channel, only performs a color blend with the existing image content. So each time you fill at 0.5 opacity, you are making the image 50% solid color.

If you instead want to make the image 50% transparent use

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

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

Flashcqxg

115 Posts

Posted - Apr 18 2025 :  01:53:55  Show Profile  Reply
I want to set a different color each time, and set its opacity value to 0.5
Proc.Fill() and AlphaFill() can not do this.
How to do?
Go to Top of Page

xequte

38949 Posts

Posted - Apr 18 2025 :  02:17:00  Show Profile  Reply
Hi

Image formats do not support that. You can make an image 50% transparent, but then it won't be 50% blue (unless displayed over a blue background). The only way to make an image 50% blue is to perform a 50% blend with blue (and 0% transparency). If you then apply 50% red then you are going to get a result which is 25% image, 25% blue and 50% red, etc.

Your only option is to restore the original image and apply the new color changes to it.


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

Flashcqxg

115 Posts

Posted - Apr 18 2025 :  02:19:10  Show Profile  Reply
how to blend ?
Go to Top of Page

xequte

38949 Posts

Posted - Apr 18 2025 :  02:30:45  Show Profile  Reply
Hi

That is:
// Blend image with 50% blue
ImageEnView1.Proc.Fill( clBlue, 0.5 );


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

Flashcqxg

115 Posts

Posted - Apr 18 2025 :  02:35:45  Show Profile  Reply
My code:

ImageEnView1.Proc.Fill(cxColorComboBox2.ColorValue, 0.5);
ImageEnView1.update.


cxColorComboBox2 is a color select box.
First time is ok,but....you won't be able to see the content on the picture on the fifth try.
Go to Top of Page

xequte

38949 Posts

Posted - Apr 18 2025 :  20:44:34  Show Profile  Reply
Yes, that is what will happen.

Why not use something like:

ImageEnView1.Assign( fOriginalFile );
ImageEnView1.Proc.Fill(cxColorComboBox2.ColorValue, 0.5);
ImageEnView1.update.


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

Flashcqxg

115 Posts

Posted - Apr 18 2025 :  22:37:43  Show Profile  Reply
Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: