DissolveToColorStochastically
Returns a pixmap with each pixel unchanged or set to a given colour with a given probability.
Syntax
-
DissolveToColorStochastically(pm, c[, p])
-
pm
is a pixmap -
c
is a colour -
p
is a number in [0, 1]
-
-
DissolveToColorRegularly(pm, f[, p])
-
pm
is a pixmap -
f
is a colour function in two integer variables -
p
is a number in [0, 1]
-
Description
DissolveToColorStochastically(pm, c, p)
returns pm
with each pixel either unaltered or set to c
with the probability of the latter being p
. If omitted, p
defaults to 0.5
.
The overload with a function instead of a colour will use f(x, y)
as the colour at pixel (x, y)
.
Examples
DissolveToColorStochastically(ExampleData("rabbit"), (x, y) ↦ hsv(x + y, 1, 1), 0.25)