Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, March 25, 2008 5:37:51 AM(UTC)
GregMcFarland

Groups: Registered
Posts: 10


I have what will probably turn out to be a simple question. I have a PNG file with a alpha channel transparency mask and am attempting to use the L_FeatherAlphaBlendBitmap() function to implement the transparency. My question is when loading the image I have the source PNG and can get the mask from the L_GetBitmapAlpha() function, what image do I use as the Destination bitmap in the L_FeatherAlphaBlendBitmap() function call? Do I simply need to create a blank image, or will this not work in all cases?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, March 25, 2008 9:35:16 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Yes, you will need to create a destination image.  The easiest way to do this is to make a copy of your source image (L_CopyBitmap) and then fill it (L_FillBitmap) with whatever color you want for the background (generally the color of the form so the image appears to be transparent to the form).
 
#3 Posted : Tuesday, March 25, 2008 10:07:27 AM(UTC)
GregMcFarland

Groups: Registered
Posts: 10


Greg, in my program I never know what the background of the final destination. Is there some easy way that I can create a region of the transparent area? I can't use the L_SetBitmapRgnFromMask() on the Alpha Channel generated mask can I?
 
#4 Posted : Wednesday, March 26, 2008 4:38:33 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


L_SetBitmapRgnFromMask() uses a 1bpp B/W mask.  The Alpha channel will be grayscale, so you'll need to flatten that image out and make it black and white if you want to use it with L_SetBitmapRgnFromMask.
 
#5 Posted : Wednesday, March 26, 2008 5:14:54 AM(UTC)
GregMcFarland

Groups: Registered
Posts: 10


Is this the recommended method for acheiving the transparency from the alpha channel? Because the L_FeatherAlphaBlendBitmap() function takes two bitmaps and combines them using a mask but it does not allow you to paint the image with transparency.
 
#6 Posted : Wednesday, March 26, 2008 5:32:58 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


If your alpha channel only has 100% and 0% transparent and nothing else in between, then it will work.  Otherwise you still need to use L_FeatherAlphaBlendBitmap because it's the only function that works with alpha channels.

What exactly are you trying to accomplish?  Are you trying to make your entire form transparent?  What are the possible problems you're running into with using a background image?  Please explain in more detail.
 
#7 Posted : Wednesday, March 26, 2008 5:54:39 AM(UTC)
GregMcFarland

Groups: Registered
Posts: 10


My application prints an bitmap on the page, however the image could lay on top of another item that was printed prior to the bitmap and is not a bitmap. Therefore I want to print my bitmap using the alpha channel and overlay the existing background inside the Device Context. Can I use the L_ScreenCaptureBitmap() to get the background for the region of interest? Does that work with printer Device Contexts as well? Thanks for your help.
 
#8 Posted : Wednesday, March 26, 2008 8:22:02 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Thanks for the explanation.  Unfortunately this is not possible because as far as I know, there isn't a way to get the data from the DC and turn it into a bitmap.  The only thing that would work would be to do a screen capture, but that wouldn't work with printers.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.080 seconds.