Hi! Is there a way to use an image as alpha mask to others?
Also a B/W one could be fine;)
Thanks!
			
			
									
									
						Alpha Mask
Moderators: Shine, Insert_witty_name
Check it out.
I have made a function for the Image Class that does just that... It makes an alpha mask of the image that calls the function 'AlphaImage' and sets it to anouther image.
Use it like this:My Alpha Function: Click Here
			
			
									
									
						Use it like this:
Code: Select all
X = 0 ; Y = 0 ; Color.new(200,0,0,200)
MyImagesAlphaMask = MyImage.AlphaImage(X, Y, Colour)No problem
Well I am happy you can use it... if you have any other problems just post them and I'll be happy to help.
			
			
									
									
						Hi CT_Bolt
I do some more test but at some point i get errors al line
Something aboute XPos or YPos meke them unvalid.
So I rewrite the function myself.
If it could be usefull, here it is
The main idea is the same, but i cuold use it without error.
Thanks Again!
			
			
									
									
						I do some more test but at some point i get errors al line
Code: Select all
color = self:pixel(XPos,YPos)
So I rewrite the function myself.
If it could be usefull, here it is
Code: Select all
function Mask(ToDraw,Mask,Alpha)
  if not Alpha then Alpha = Color.new(0,0,0,0) end
  Masked = Image.createEmpty(Mask:width(),Mask:height())
  Masked:clear(Color.new(0,0,0,0))
  for xp = 0, Mask:width()-1 do
    for yp = 0, Mask:height()-1 do
      pix = Mask:pixel(xp,yp)
      c = pix:colors()
      if  not (c.a == 0) then
        Masked:fillRect(xp,yp,1,1,ToDraw:pixel(xp,yp))
      end
    end
  end
  return Masked
end
Thanks Again!
i had that problem with the :pixel(x,y) function i solved it by setting the ammount of pixeld to cover as  but the code seems fine to me
			
			
									
									
						Code: Select all
Image:width()-1Ahh... oh yeah.
Hmm... I see... yes I did overlook that... well thanks for fixing it.