From 3ab5c528caaffee4ca9079be6947c72d94ecbe62 Mon Sep 17 00:00:00 2001 From: Abe Pazos Date: Thu, 27 Mar 2025 15:10:08 +0100 Subject: [PATCH] [orx-color] Fix misplaced demo comments --- .../src/jvmDemo/kotlin/histogram/DemoHistogram01.kt | 7 ++++++- .../src/jvmDemo/kotlin/histogram/DemoHistogram02.kt | 8 ++++++-- .../src/jvmDemo/kotlin/histogram/DemoHistogram03.kt | 11 +++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram01.kt b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram01.kt index 1ea43560..121fe573 100644 --- a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram01.kt +++ b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram01.kt @@ -1,9 +1,14 @@ -package histogram// Show color histogram of an image +package histogram import org.openrndr.application import org.openrndr.draw.loadImage import org.openrndr.extra.color.statistics.calculateHistogramRGB +/* + * Demonstrates how to generate a palette with the top 32 colors + * of a loaded image, sorted by luminosity. The colors are displayed + * as rectangles overlayed on top of the image. + */ fun main() = application { configure { width = 720 diff --git a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram02.kt b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram02.kt index c12ce3a3..78d0bcf9 100644 --- a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram02.kt +++ b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram02.kt @@ -1,10 +1,14 @@ -package histogram// Show color histogram using non-uniform weighting +package histogram import org.openrndr.application import org.openrndr.draw.loadImage import org.openrndr.extra.color.statistics.calculateHistogramRGB import kotlin.math.pow +/* + * Show the color histogram of an image using non-uniform weighting, + * prioritizing bright colors. + */ fun main() = application { configure { width = 720 @@ -31,4 +35,4 @@ fun main() = application { } } } -} \ No newline at end of file +} diff --git a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram03.kt b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram03.kt index 1dee160f..33af6599 100644 --- a/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram03.kt +++ b/orx-color/src/jvmDemo/kotlin/histogram/DemoHistogram03.kt @@ -1,9 +1,16 @@ -package histogram// Create a simple rectangle composition based on colors sampled from image +package histogram import org.openrndr.application import org.openrndr.draw.loadImage import org.openrndr.extra.color.statistics.calculateHistogramRGB +/* + * Create a simple grid-like composition based on colors sampled from image. + * The cells are 32 by 32 pixels in size and are filled with a random sample + * taken from the color histogram of the image. + * + * Note: due to its random nature the resulting animation contains flickering colors. + */ fun main() = application { configure { width = 720 @@ -22,4 +29,4 @@ fun main() = application { } } } -} \ No newline at end of file +}