Using mask to make % transparent pictures

Crirus

Member
Joined
Oct 14, 2003
Messages
9
I need to reproduce what I can do in photoshop with two image layers and a mask.
So, I have 2 images and a mask image, grayscale...
How can I blend the 2 images using the mask so they will be merged more or less where there are grey portion on the mask, the white mean full trsnsparent and the black full opaque

Thanks, Crirus

PS> In VB, without Marshaling and LockBits
 
You dont need that mask stuff in .net.
Use the MakeTransparent(Color c) method of the Bitmap.
 
if u just want 1bit transparency u can use the MakeTransparent.

BUT if u want something like a gradient of transparencies, u can go setting the color of a new image based on the 2 sources

like
Code:
DestBMP.SetPixel(x,y, Color.FromARGB(AlphaMaskBMP.GetPixel(x.y).A, ImageBMP.GetPixel(x,y).R, ImageBMP.GetPixel(x,y).G, ImageBMP.GetPixel(x,y).B);
 
The mask picture is greyscale, white -greys-black..without alpha info in it. Alpha should be given by grey value to a certain point
 
Originally posted by aewarnick
You dont need that mask stuff in .net.
Use the MakeTransparent(Color c) method of the Bitmap.


I know that for a single color, but I have multiple levels of transparency
 
AlphaMask is a greyscale picture without alpha info... so AlphaMaskBMP.GetPixel(x.y).A is 0. Only the color can be some grey...
 
OK, forget about semi-transparent...I will use full transparent only
The other problem is how to draw only on white area of the mask, from one image to the other... the black area of the mask should remain transparent...
I need some NET methods, not per pixel ideea..Can I set the region of the image to whotle non-transparent zone?
 
why dont u use only one image with a transparent key color (Color.Lime, for instance) and then use the MakeTransparent() method?

if you NEED a mask, then u NEED to composite... and thats problematic...
 
is not a sprite-like image....I have 2 80 x 80 images.
I need to make one image from them with black zones of the mask to be from first one and white zones to be from second one
 
Well, I may came up with a solution:
Make white transparent and draw over the first image
Make black transparent on that image and draw it over the second image..this should give me a combination of 2 images
 
Back
Top