[orx-fx, orx-jumpflood] Match changes to Filter
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.jumpfill.fx
|
||||
|
||||
import org.openrndr.draw.*
|
||||
@@ -9,6 +11,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
private class InnerBevelFilter : Filter(filterShaderFromCode(jf_inner_bevel, "inner-bevel")) {
|
||||
var angle: Double by parameters
|
||||
@@ -45,7 +48,7 @@ class InnerBevel : Filter1to1() {
|
||||
|
||||
private var distance: ColorBuffer? = null
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
if (jumpFlooder == null) {
|
||||
jumpFlooder = JumpFlooder(target[0].width, target[0].height, encodePoints = EncodeSubpixel())
|
||||
}
|
||||
@@ -60,6 +63,6 @@ class InnerBevel : Filter1to1() {
|
||||
bevelFilter.angle = angle
|
||||
bevelFilter.width = width
|
||||
bevelFilter.noise = noise
|
||||
bevelFilter.apply(arrayOf(source[0], distance!!), target[0])
|
||||
bevelFilter.apply(arrayOf(source[0], distance!!), target[0], clip)
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
private class InnerGlowFilter : Filter(filterShaderFromCode(jf_inner_glow, "inner-glow")) {
|
||||
var angle: Double by parameters
|
||||
@@ -56,7 +57,7 @@ class InnerGlow : Filter1to1() {
|
||||
private val glowFilter = InnerGlowFilter()
|
||||
private var distance: ColorBuffer? = null
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
if (jumpFlooder == null) {
|
||||
jumpFlooder = JumpFlooder(target[0].width, target[0].height, encodePoints = EncodeSubpixel())
|
||||
}
|
||||
@@ -73,6 +74,6 @@ class InnerGlow : Filter1to1() {
|
||||
glowFilter.noise = noise
|
||||
glowFilter.shape = shape
|
||||
glowFilter.imageOpacity = imageOpacity
|
||||
glowFilter.apply(arrayOf(source[0], distance!!), target[0])
|
||||
glowFilter.apply(arrayOf(source[0], distance!!), target[0], clip)
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
private class InpaintFilter : Filter(filterShaderFromCode(jf_inpaint, "inpaint")) {
|
||||
|
||||
@@ -50,7 +51,7 @@ class Inpaint : Filter1to1() {
|
||||
|
||||
private var distance: ColorBuffer? = null
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
if (jumpFlooder == null) {
|
||||
jumpFlooder = JumpFlooder(target[0].width, target[0].height, encodePoints = EncodeSubpixel())
|
||||
}
|
||||
@@ -67,6 +68,6 @@ class Inpaint : Filter1to1() {
|
||||
inpaintFilter.opacity = opacity
|
||||
inpaintFilter.shape = shape
|
||||
inpaintFilter.width = width
|
||||
inpaintFilter.apply(arrayOf(source[0], distance!!), target[0])
|
||||
inpaintFilter.apply(arrayOf(source[0], distance!!), target[0], clip)
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
private class OuterGlowFilter : Filter(filterShaderFromCode(jf_outer_glow, "outer-glow")) {
|
||||
var angle: Double by parameters
|
||||
@@ -57,7 +58,7 @@ class OuterGlow : Filter1to1() {
|
||||
|
||||
private var distance: ColorBuffer? = null
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
if (jumpFlooder == null) {
|
||||
jumpFlooder = JumpFlooder(target[0].width, target[0].height, encodePoints = EncodeSubpixel())
|
||||
}
|
||||
@@ -74,6 +75,6 @@ class OuterGlow : Filter1to1() {
|
||||
glowFilter.noise = noise
|
||||
glowFilter.shape = shape
|
||||
glowFilter.imageOpacity = imageOpacity
|
||||
glowFilter.apply(arrayOf(source[0], distance!!), target[0])
|
||||
glowFilter.apply(arrayOf(source[0], distance!!), target[0], clip)
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
|
||||
private class SkeletonFilter : Filter(filterShaderFromCode(jf_skeleton, "skeleton")) {
|
||||
var skeletonColor: ColorRGBa by parameters
|
||||
@@ -50,7 +51,9 @@ class Skeleton : Filter() {
|
||||
private val decodeFilter = PixelDistance()
|
||||
private val skeletonFilter = SkeletonFilter()
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
require(clip == null)
|
||||
|
||||
if (thresholded == null) {
|
||||
thresholded = colorBuffer(target[0].width, target[0].height, format = ColorFormat.R)
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.openrndr.extra.parameters.Description
|
||||
import org.openrndr.extra.parameters.DoubleParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.resourceUrl
|
||||
import org.openrndr.shape.Rectangle
|
||||
import kotlin.math.sqrt
|
||||
|
||||
private class StraightSkeletonFilter : Filter(filterShaderFromCode(jf_straight_skeleton, "straight-skeleton")) {
|
||||
@@ -56,7 +57,7 @@ class StraightSkeleton : Filter() {
|
||||
private val decodeFilter = PixelDirection()
|
||||
private val skeletonFilter = StraightSkeletonFilter()
|
||||
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>) {
|
||||
override fun apply(source: Array<ColorBuffer>, target: Array<ColorBuffer>, clip: Rectangle?) {
|
||||
if (thresholded == null) {
|
||||
thresholded = colorBuffer(target[0].width, target[0].height, format = ColorFormat.R)
|
||||
}
|
||||
@@ -83,6 +84,6 @@ class StraightSkeleton : Filter() {
|
||||
skeletonFilter.skeletonColor = skeletonColor
|
||||
skeletonFilter.backgroundColor = backgroundColor
|
||||
skeletonFilter.foregroundColor = foregroundColor
|
||||
skeletonFilter.apply(copied!!, target[0])
|
||||
skeletonFilter.apply(copied!!, target[0], clip)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user