From 0aff3f6bbfb9386ea8cacc62f0567a3f50401b58 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Wed, 1 Sep 2021 09:23:14 +0200 Subject: [PATCH] [orx-boofcv] convert to Kotlin DSL --- .../{build.gradle => build.gradle.kts} | 17 +++++++++++++---- .../src/demo/kotlin/DemoContours01.kt | 8 -------- .../orx-boofcv/src/demo/kotlin/DemoResize01.kt | 6 ------ .../orx-boofcv/src/demo/kotlin/DemoResize02.kt | 6 ------ .../src/demo/kotlin/DemoSimplified01.kt | 8 -------- 5 files changed, 13 insertions(+), 32 deletions(-) rename orx-jvm/orx-boofcv/{build.gradle => build.gradle.kts} (59%) diff --git a/orx-jvm/orx-boofcv/build.gradle b/orx-jvm/orx-boofcv/build.gradle.kts similarity index 59% rename from orx-jvm/orx-boofcv/build.gradle rename to orx-jvm/orx-boofcv/build.gradle.kts index c1f8f49f..aafeeeda 100644 --- a/orx-jvm/orx-boofcv/build.gradle +++ b/orx-jvm/orx-boofcv/build.gradle.kts @@ -1,14 +1,23 @@ +import ScreenshotsHelper.collectScreenshots + sourceSets { - demo { + val main by getting { } + val demo by creating { java { - srcDirs = ["src/demo/kotlin"] + srcDir("src/demo/kotlin") compileClasspath += main.getCompileClasspath() runtimeClasspath += main.getRuntimeClasspath() } } + collectScreenshots(project, demo) { } } -def boofcvVersion = "0.37" +val openrndrVersion: String by rootProject.extra +val openrndrOS: String by rootProject.extra +val boofcvVersion = "0.37" + +val demoImplementation by configurations.getting {} +val demoRuntimeOnly by configurations.getting {} dependencies { api("org.boofcv:boofcv-core:$boofcvVersion") @@ -17,4 +26,4 @@ dependencies { demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion") demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion") demoImplementation(sourceSets.getByName("main").output) -} +} \ No newline at end of file diff --git a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoContours01.kt b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoContours01.kt index 65b13833..2b4a5249 100644 --- a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoContours01.kt +++ b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoContours01.kt @@ -16,14 +16,6 @@ import kotlin.math.sin fun main() { application { program { - - // -- this block is for automation purposes only - if (System.getProperty("takeScreenshot") == "true") { - extend(SingleScreenshot()) { - this.outputFile = System.getProperty("screenshotPath") - } - } - // Load an image, convert to BoofCV format using orx-boofcv val input = loadImage("demo-data/images/image-001.png").toGrayF32() diff --git a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize01.kt b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize01.kt index 27fb3a5f..7bce9b08 100644 --- a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize01.kt +++ b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize01.kt @@ -8,12 +8,6 @@ import org.openrndr.extensions.SingleScreenshot fun main() { application { program { - if (System.getProperty("takeScreenshot") == "true") { - extend(SingleScreenshot()) { - this.outputFile = System.getProperty("screenshotPath") - } - } - // Load an image, convert to BoofCV format using orx-boofcv val input = loadImage("demo-data/images/image-001.png") diff --git a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize02.kt b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize02.kt index a1cebfbf..354fb8f0 100644 --- a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize02.kt +++ b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoResize02.kt @@ -8,12 +8,6 @@ import org.openrndr.extensions.SingleScreenshot fun main() { application { program { - if (System.getProperty("takeScreenshot") == "true") { - extend(SingleScreenshot()) { - this.outputFile = System.getProperty("screenshotPath") - } - } - // Load an image, convert to BoofCV format using orx-boofcv val input = loadImage("demo-data/images/image-001.png") val scaled = input.resizeTo(input.width / 3) diff --git a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoSimplified01.kt b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoSimplified01.kt index 73761550..9284dffb 100644 --- a/orx-jvm/orx-boofcv/src/demo/kotlin/DemoSimplified01.kt +++ b/orx-jvm/orx-boofcv/src/demo/kotlin/DemoSimplified01.kt @@ -21,14 +21,6 @@ import org.openrndr.shape.toContour fun main() { application { program { - - // -- this block is for automation purposes only - if (System.getProperty("takeScreenshot") == "true") { - extend(SingleScreenshot()) { - this.outputFile = System.getProperty("screenshotPath") - } - } - // Create a buffer where to draw something for boofcv val rt = renderTarget(width, height) { colorBuffer()