1

I have read several internet articles about drawing fluids. They refer to taking a bitmap, blurring it and then applying a threshold. From what I can determine it looks like it might be some type of color replacement. Is that true?

I am not seeing any android bitmap or paint method that is called "threshold". So my question is "What is a bitmap threshold" and/or "Does android have an equivalent function?"

Jack
  • 241
  • 4
  • 12
  • Threshold is no method. It just means that if you have a value of some sort and that value reaches a certain value (= the treshold) you do something different than before. – zapl Aug 30 '12 at 20:09

1 Answers1

3

I think I understand what you are talking about. Imagine an image with several circles that are close to each other (but not necessarily touching). When the image gets blurred, the blured parts of the new image may touch, merge, and generally look like an amorphous blob of fluid. When you threshold the image, you effectively choose a saturation value below which all image data is discarded.

So, for example, if you wanted to threshold the image at 50%, all RGB pixel values that are greater than 50% will be kept. All others are discarded. The threshold function in this case would sum the Red, Green, and Blue colors and divide by 3. If the value is greater than 0xFF/2 the pixel is kept.

Setting how much the image gets blurred and the level of thresholding will cause the image to look more or less connected.

This code looked interesting:

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164