Login or Signup

Code archives/Graphics/Setimagemask

This code has been declared by its author to be Public Domain code.

Download source code

Setimagemask by dynaman1+ years ago
Set the mask color of an image after it has been loaded
Function setimagemask(p_image:Timage, p_red,p_green,p_blue)
	Local l_maskrgb
	Local l_maskargb
	Local l_pixelrgb
	Local l_pixelraw
	Local l_x,l_y
	Local l_pix1:Tpixmap
	l_maskrgb = p_red * 65536 + p_green * 256 + p_blue
	l_pix1 = LockImage(p_image)
	For l_x = 0 To ImageWidth(p_image)
		For l_y = 0 To ImageHeight(p_image)
			l_pixelraw = ReadPixel(l_pix1,l_x,l_y)
			l_pixelrgb = l_pixelraw & 16777215
			If l_pixelrgb = l_maskrgb Then
			End if

	Release l_pix1
End function


Baystep Productions(Posted 1+ years ago)
I'll sum that up to...
MaskImage img,r,b,g
And it does it after it has been loaded!

dynaman(Posted 1+ years ago)
That is pretty much it. Sorry if I wasn't clear - docs are not my thing...

(tu) ENAY(Posted 1+ years ago)
This throws an error in the newest version of Blitzmax because you should be doing:-

For l_x = 0 To ImageWidth(p_image)-1
For l_y = 0 To ImageHeight(p_image)-1


Code Archives Forum
Blitz Social Club