Night - Day Filter

BlitzPlus Forums/BlitzPlus Programming/Night - Day Filter

Hello,

Im trying to come up with a way to make a filter that changes the sprite darkness like so that I can have the effect of night to day in my game im making.
It would nice if this function or command was realtime..

Does anyone have any suggestions??

Function FB_DarkenImage ( image, d )

	For ix = 0 To ImageWidth( image ) - 1
		For iy = 0 To ImageHeight( image ) - 1
			Local rbgc = ReadPixel( ix, iy, ImageBuffer(image) )
			If rbgc = $FFFF00FF + d
				WritePixel ix,iy,($0),ImageBuffer(image)		
			Else
				WritePixel ix,iy,( rbgc + d ), ImageBuffer(image)
			EndIf
		Next
	Next
	Return image

End Function 


all this is doing is change the tint or the blue :( I can't seem to make a function that changes the pixels brightness

also if there was a way to keep the mask :( that would be nice :(