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 : Wednesday, December 13, 2006 4:31:34 AM(UTC)

marasma  
marasma

Groups: Registered
Posts: 51


Hi,
I'm doing a very hard work (for me), as you can see in the attached files, this is what I have to do:
1 - Draw an annotation (any type) (attachement 1)
2 - Fill with a texture
3 - Blend with the background image with transparency

This is what I do:
1 - I create an image filled with white starting from a region in the bck image of the same dimension of the BoundingRectangle of the annotation

2 - I create a Texture Image of the same dimension of the BoundingRectangle of the annotation

3 - I burn the annotation in the image created at point 1 and I create a 1-bit mask image

4 - I combine the texture and 1-bit mask image, so I obtain the annotation filled with texture on a white background

5 - Now as final step I have to combine the backimage (point 1) with the image at point 4, applying trasparency for example at 50%. The result I obtain is quiet good, but not right, in fact only the white background of the 1-bit mask image would be 100 transparency and only the annotation must be at 50%

Thanks
I'm using Vb.NET and 14.5.0.16.

I can do this at point 5 ?
File Attachment(s):
exampimg.rar (373kb) downloaded 24 time(s).
 

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 : Wednesday, December 13, 2006 11:04:36 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


To use a variable opacity on one image, you will need to use a better mask image.  With a 1-bit mask image you will only be able to have one transparency amount.  If you use an 8-bit mask image, then you will be able to use this as your alpha channel and make part of your image (the white part) 100% transparent and then the other part 50%.

I've posted a simple sample project that shows how to create a mask image when loading a TGA file with an alpha channel.  Though this isn't exactly what you are needing to do, it will at least show you how you would use an 8-bit mask image and the FeatherAlphaBlendCommand class to combine the two images.  Take a look at the Button3_Click event's code.
File Attachment(s):
NET - V145 - AlphaTransparency.zip (260kb) downloaded 24 time(s).
 
#3 Posted : Wednesday, December 13, 2006 4:20:32 PM(UTC)

marasma  
marasma

Groups: Registered
Posts: 51


Hi,
I tried what you suggest and it execute ok, but I don't understand how can I do to do transparency variable. Now I convert the image containg the annotation with texture in a 8 bit grayscale image for use as mask and then apply FeatherAlphaBlendCommand. It's ok but I can't set the transparency value, that I think it depends on the gray level of the mask. It's right? What can I do?
Thanks
 
#4 Posted : Thursday, December 14, 2006 5:12:59 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


The transparency depends on the mask.  Black is 100% transparent, and white is 0% transparent (opaque).  Therefore, if you want the white part of your image in step 4 to be 100%, and the annoation part with the bricks texture to be 50% transparent, your mask will need to be black where step 4's image is white, and RGB(128,128,128) where step 4's image has the brick texture.
 
#5 Posted : Thursday, December 14, 2006 8:25:41 AM(UTC)

marasma  
marasma

Groups: Registered
Posts: 51


Hi,
I understand wath you say, but I don't know wich is the way or command to use to create the mask. Wich is the way for create the mask with RGB(128,128,128) value ?
 
#6 Posted : Thursday, December 14, 2006 10:43:05 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 766


To create a mask using the image in your step four, you will need to:

1.) create a copy of that image. 

2.) Select a region in the copied image based on the color White using RasterImage.AddColorToRegion() using the Set combine mode.

3.) Use the Leadtools.ImageProcessing.FillCommand to fill that region with black to make it your 100% transparent area.

4.) Now select the black area with AddColorToRegion using the SetNot combine mode.  This will select the rest of the image that is not black.

5.) Fill this region with RGB(128,128,128) using the FillCommand.

After following these steps you should have a mask image usable with the FeatherAlphaBlendCommand class that will make the bricks part 50% transparent and the white background 100% transparent.
 
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-2020, Yet Another Forum.NET
This page was generated in 0.170 seconds.