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
 What does MergeAlpha option do?

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
mouser Posted - Feb 20 2013 : 08:55:59
I'm having trouble understanding the MergeAlpha parameter that is used in a few functions, including DrawObjectsToBitmap.

The actual problem I'm having is I have an object on top of a 100% transparent background, and when I DrawObjectsToBitmap, the resulting bitmap still has 100% transparency and so the objects are invisible.

So I guess what I'm ultimately looking for is a way to draw the objects to a background and "combine" in a reasonable way the transparency of the original background with the transparency of the objects being drawn onto it.

I can think of some laborious multiple step masking methods to do that if there is no easy way in ImageEn -- and if someone knows an easier way I'd love to hear.

But I'd still like to understand with the MergeAlpha option does as it's not clear to me.

Thanks!
6   L A T E S T    R E P L I E S    (Newest First)
mouser Posted - Feb 22 2013 : 13:07:40
Hi Fabrizio,

I originally tried using CopyObjectsToBack, and it didn't work right -- however I cannot remember in what fashion it wasn't doing what I expected, and it may have been an error on my part.

Nevertheless, I am quite certain that I have fixed a few bugs in the ImageEn code related to this stuff -- I will email you my fixes (i've actually made some other "improvement" so it will be up to you what you want to keep).

ImageEn is a wonderful library.
fab Posted - Feb 22 2013 : 03:29:24
Dear Mouser,
it seems that the topic at:
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=283

describes a different problem.
In fact, using current version, now you can do:

  ImageEnVect1.IEBitmap.AlphaChannel.Fill(128);
  ImageEnVect1.AddNewObject(iekBox, Rect(10, 10, 100, 100), clRed);
  ImageEnVect1.CopyObjectsToBack();
  ImageEnVect1.RemoveAllObjects();
  ImageEnVect1.Update();


The box is displayed correctly, even if the background has 128 (50%) transparency.
w2m Posted - Feb 20 2013 : 15:09:22
Send your fixes directly to Fabrizio: support@hicomponents.com

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
mouser Posted - Feb 20 2013 : 14:04:18
Ok i've patched the imageen code in a couple of places to fix a few bugs responsible for alpha mergeing not working.

I've exchanged emails with Fabrizio a few times -- what's the best way to communicate some fixes?
mouser Posted - Feb 20 2013 : 09:31:37
Last self-followup.

The problem I appear to be having seems like it's the exact same bug reported here:
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=283

Which was reported fixed by Fabrizio. As I am using the latest version (4.3) I wonder if in fact this is a bug which has not actually been fixed?
mouser Posted - Feb 20 2013 : 09:22:38
A quick followup to explain the partial nature of my confusion.

When using the TIEBitmap.MergeWithAlpha function to draw one partially transparent bitmap or layer onto a fully transparent (alpha 0) background, the result is what I expected -- which is that the resulting bitmap becomes non-transparent where the bitmap is drawn.

But when using DrawObjectsToBitmap or CopyObjectsToBack with MergeAlpha option, the transparent backgrounds seem stay completely transparent, making the drawn objects completely invisible.