diff --git a/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill02.kt b/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill02.kt new file mode 100644 index 00000000..772e02e9 --- /dev/null +++ b/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill02.kt @@ -0,0 +1,27 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa +import org.openrndr.extra.fx.Post +import org.openrndr.math.Polar +import org.openrndr.poissonfill.PoissonFill + +fun main() = application { + program { + extend(Post()) { + val pf = PoissonFill() + post { input, output -> + pf.apply(input, output) + } + } + + extend { + drawer.stroke = null + drawer.clear(ColorRGBa.TRANSPARENT) + + drawer.fill = ColorRGBa.RED + drawer.circle(Polar(60.0 * seconds, 200.0).cartesian + drawer.bounds.center, 20.0) + + drawer.fill = ColorRGBa.BLUE + drawer.circle(Polar(-60.0 * seconds, 200.0).cartesian + drawer.bounds.center, 20.0) + } + } +} diff --git a/orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonFiller.kt b/orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonFiller.kt index 89764352..770b2384 100644 --- a/orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonFiller.kt +++ b/orx-jvm/orx-poisson-fill/src/main/kotlin/PoissonFiller.kt @@ -42,18 +42,16 @@ class PoissonFiller(val width: Int, val height: Int, type: ColorType = ColorType class PoissonFill : Filter() { private var filler: PoissonFiller? = null override fun apply(source: Array, target: Array) { - if (target.isNotEmpty()) { - filler?.let { - if (it.width != target[0].width || it.height != target[0].height) { + if (it.width != target[0].effectiveWidth || it.height != target[0].effectiveHeight) { it.destroy() filler = null } } if (filler == null) { - filler = PoissonFiller(target[0].width, target[0].height) + filler = PoissonFiller(target[0].effectiveWidth, target[0].effectiveHeight) } filler?.let {