Crirus Posted October 14, 2003 Posted October 14, 2003 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 Quote
aewarnick Posted October 14, 2003 Posted October 14, 2003 You don't need that mask stuff in .net. Use the MakeTransparent(Color c) method of the Bitmap. Quote C#
Menge Posted October 15, 2003 Posted October 15, 2003 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 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); Quote Menge
Crirus Posted October 15, 2003 Author Posted October 15, 2003 The mask picture is greyscale, white -greys-black..without alpha info in it. Alpha should be given by grey value to a certain point Quote
Crirus Posted October 15, 2003 Author Posted October 15, 2003 aewarnick said: You don't 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 Quote
Crirus Posted October 15, 2003 Author Posted October 15, 2003 AlphaMask is a greyscale picture without alpha info... so AlphaMaskBMP.GetPixel(x.y).A is 0. Only the color can be some grey... Quote
Crirus Posted October 15, 2003 Author Posted October 15, 2003 For large image processing stuffs, this loop can be time consumming... Quote
Menge Posted October 15, 2003 Posted October 15, 2003 (edited) there is no other way i know of :S oh! u could use PNGs too... it avoids the compositing Edited October 15, 2003 by Menge Quote Menge
Crirus Posted October 15, 2003 Author Posted October 15, 2003 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? Quote
Menge Posted October 15, 2003 Posted October 15, 2003 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 that's problematic... Quote Menge
Crirus Posted October 15, 2003 Author Posted October 15, 2003 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 Quote
Menge Posted October 15, 2003 Posted October 15, 2003 sorry... the only method i can think of is the GetPixel/SetPixel loop Quote Menge
Crirus Posted October 15, 2003 Author Posted October 15, 2003 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.