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
 What does MergeAlpha option do?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mouser

22 Posts

Posted - Feb 20 2013 :  08:55:59  Show Profile  Reply
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!

mouser

22 Posts

Posted - Feb 20 2013 :  09:22:38  Show Profile  Reply
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.
Go to Top of Page

mouser

22 Posts

Posted - Feb 20 2013 :  09:31:37  Show Profile  Reply
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?
Go to Top of Page

mouser

22 Posts

Posted - Feb 20 2013 :  14:04:18  Show Profile  Reply
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?
Go to Top of Page

w2m

USA
1990 Posts

Posted - Feb 20 2013 :  15:09:22  Show Profile  Reply
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
Go to Top of Page

fab

1310 Posts

Posted - Feb 22 2013 :  03:29:24  Show Profile  Reply
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.
Go to Top of Page

mouser

22 Posts

Posted - Feb 22 2013 :  13:07:40  Show Profile  Reply
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: