diff --git a/orx-color/README.md b/orx-color/README.md index 1db97199..f88f9a43 100644 --- a/orx-color/README.md +++ b/orx-color/README.md @@ -10,7 +10,7 @@ orx-color adds an extensive list of preset colors to `ColorRGBa`. Check [sources orx-color comes with tools to calculate color histograms for images. -``` +```kotlin val histogram = calculateHistogramRGB(image) val colors = histogram.sortedColors() ``` @@ -20,7 +20,7 @@ val colors = histogram.sortedColors() Easy ways of creating blends between colors. Using the `rangeTo` operator: -``` +```kotlin for (c in ColorRGBa.PINK..ColorRGBa.BLUE.toHSVa() blend 10) { drawer.fill = c drawer.rectangle(0.0, 0.0, 40.0, 40.0) @@ -29,7 +29,7 @@ for (c in ColorRGBa.PINK..ColorRGBa.BLUE.toHSVa() blend 10) { ``` Or blends for multiple color stops using `colorSequence`. Blending takes place in the colorspace of the input arguments. -``` +```kotlin val cs = colorSequence(0.0 to ColorRGBa.PINK, 0.5 to ColorRGBa.BLUE, 1.0 to ColorRGBa.PINK.toHSLUVa()) // <-- note this one is in hsluv diff --git a/orx-compute-graph/README.md b/orx-compute-graph/README.md index 0227afe3..93cc6a81 100644 --- a/orx-compute-graph/README.md +++ b/orx-compute-graph/README.md @@ -8,7 +8,7 @@ In development. Things may change without prior notice. ## Usage -``` +```kotlin fun main() = application { program { val linkNode: ComputeNode @@ -52,4 +52,4 @@ fun main() = application { } } } -``` \ No newline at end of file +``` diff --git a/orx-easing/README.md b/orx-easing/README.md index fcd161b9..7c9526b5 100644 --- a/orx-easing/README.md +++ b/orx-easing/README.md @@ -25,7 +25,7 @@ Similar to those on https://easings.net ## Usage -``` +```kotlin fun easeX( t: Double, // current time b: Double = 0.0, // beginning (output value when t is 0.0) diff --git a/orx-image-fit/README.md b/orx-image-fit/README.md index 24bc44ac..52c10ccf 100644 --- a/orx-image-fit/README.md +++ b/orx-image-fit/README.md @@ -8,7 +8,7 @@ Similar to CSS object-fit (https://developer.mozilla.org/en-US/docs/Web/CSS/obje ## Usage -``` +```kotlin drawer.imageFit( img: ColorBuffer, x: Double, y: Double, w: Double, h: Double, @@ -19,7 +19,7 @@ drawer.imageFit( or -``` +```kotlin drawer.imageFit( img: ColorBuffer, bounds: Rectangle, @@ -66,7 +66,8 @@ fun main() = application { } } } -``` +``` + ## Demos ### DemoImageFit01 diff --git a/orx-integral-image/README.md b/orx-integral-image/README.md index 9d5656d7..33a84b2f 100644 --- a/orx-integral-image/README.md +++ b/orx-integral-image/README.md @@ -4,7 +4,7 @@ CPU and GPU-based implementation for integral images (summed area tables) #### Usage -``` +```kotlin val image = colorBuffer( ... ) image.shadow.download() val integralImage = IntegralImage.fromColorBufferShadow(image.shadow) diff --git a/orx-interval-tree/README.md b/orx-interval-tree/README.md index b01e7518..bffad5db 100644 --- a/orx-interval-tree/README.md +++ b/orx-interval-tree/README.md @@ -6,7 +6,8 @@ when we need all entries containing a specific time value. Useful when creating For more information on interval trees read the [wikipedia page](https://en.wikipedia.org/wiki/Interval_tree). ## Usage -``` + +```kotlin // -- the item class we want to search for class Item(val start: Double, val end: Double) diff --git a/orx-jvm/orx-gui/README.md b/orx-jvm/orx-gui/README.md index 7bb814d4..1c2933e8 100644 --- a/orx-jvm/orx-gui/README.md +++ b/orx-jvm/orx-gui/README.md @@ -134,6 +134,7 @@ one detail that doesn't occur in normal programs: the UI state is reset when a script is changed and re-evaluated. This is overcome by using an annotated `Reloadable` object. An example `live.kts` script that uses `orx-gui` and `Reloadable`: + ```kotlin @file:Suppress("UNUSED_LAMBDA_EXPRESSION") import org.openrndr.Program @@ -172,6 +173,7 @@ import org.openrndr.extra.parameters.DoubleParameter ![DemoOptions01Kt](https://github.com/openrndr/orx/blob/media/orx-gui/images/DemoOptions01Kt.png [DemoSimple01Kt](src/demo/kotlin/DemoSimple01Kt.kt ![DemoSimple01Kt](https://github.com/openrndr/orx/blob/media/orx-gui/images/DemoSimple01Kt.png + ## Demos ### DemoAppearance01 diff --git a/orx-jvm/orx-olive/README.md b/orx-jvm/orx-olive/README.md index 68740490..e4fe850f 100644 --- a/orx-jvm/orx-olive/README.md +++ b/orx-jvm/orx-olive/README.md @@ -5,7 +5,7 @@ Provides live coding functionality: updates a running OPENRNDR program when you ## usage make sure that you add the following to your list of dependencies (next to orx-olive) -``` +```gradle implementation "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.31" ``` @@ -42,6 +42,7 @@ Along with the extension comes a mechanism that allows state to be reloaded from This functionality is offered by the `Reloadable` class. An example `live.kts` in which the reloadable state is used: + ```kotlin @file:Suppress("UNUSED_LAMBDA_EXPRESSION") import org.openrndr.color.ColorRGBa @@ -68,7 +69,7 @@ The Reloadable store can be cleared using the `clearReloadables` function. To store GPU resources or objects that use GPU resources (a.o. `ColorBuffer`, `VertexBuffer`, `Shader`, `BufferTexture`) in a `Reloadable` object one uses OPENRNDR's `persistent {}` builder function. -```!kotlin +```kotlin @file:Suppress("UNUSED_LAMBDA_EXPRESSION") import org.openrndr.color.ColorRGBa import org.openrndr.draw.* @@ -133,6 +134,7 @@ import org.openrndr.draw.* } } ``` + ## Demos ### DemoOlive01 diff --git a/orx-jvm/orx-syphon/README.md b/orx-jvm/orx-syphon/README.md index b2c6be43..c7495f01 100644 --- a/orx-jvm/orx-syphon/README.md +++ b/orx-jvm/orx-syphon/README.md @@ -6,6 +6,7 @@ Send frames to- and from OPENRNDR to other applications in real time using _Syph ### Syphon Server #### Sharing the whole view + ```kotlin import org.openrndr.application import org.openrndr.color.ColorRGBa @@ -33,6 +34,7 @@ fun main() { ``` #### Sharing a different render target + ```kotlin import org.openrndr.application import org.openrndr.color.ColorRGBa @@ -75,6 +77,7 @@ fun main() { ``` ### Syphon Client + ```kotlin fun main() = application { configure { diff --git a/orx-jvm/orx-video-profiles/README.md b/orx-jvm/orx-video-profiles/README.md index 288b6454..b2890dcf 100644 --- a/orx-jvm/orx-video-profiles/README.md +++ b/orx-jvm/orx-video-profiles/README.md @@ -6,7 +6,7 @@ GIF, H265, PNG, Prores, TIFF and Webp `VideoWriterProfile`s for `ScreenRecorder` ### GIF -``` +```kotlin import org.openrndr.application import org.openrndr.color.ColorRGBa import org.openrndr.extra.videoprofiles.* @@ -26,7 +26,7 @@ fun main() = application { Then use `gifsicle` or a similar tool to reduce the gif file size. For example: -``` +```bash $ gifsicle --loop --delay=4 --colors 16 --optimize=2 heavy.gif >lessheavy.gif ``` diff --git a/orx-noise/README.md b/orx-noise/README.md index bb874f95..078d4d72 100644 --- a/orx-noise/README.md +++ b/orx-noise/README.md @@ -52,7 +52,8 @@ val noiseValue2 = myNoise2(993, seconds * 0.1) These are a mostly straight port from FastNoise-Java but have a slightly different interface. ### Perlin noise -``` + +```kotlin // -- 1d val v0 = perlinLinear(seed, x) val v1 = perlinQuintic(seed, x) @@ -70,7 +71,8 @@ val v8 = perlinHermite(seed, x, y, z) ``` ### Value noise -``` + +```kotlin // -- 1d val v0 = valueLinear(seed, x) val v1 = valueQuintic(seed, x) @@ -88,7 +90,8 @@ val v7 = valueHermite(seed, x, y ,z) ``` ### Simplex noise -``` + +```kotlin // -- 1d val v0 = simplex(seed, x) @@ -103,7 +106,8 @@ val v3 = simplex(seed, x, y, z, w) ``` ### Cubic noise -``` + +```kotlin // -- 1d val v0 = cubic(seed, x, y) val v1 = cubicQuintic(seed, x, y) @@ -126,7 +130,7 @@ The library provides 3 functions with which fractal noise can be composed. #### Fractal brownian motion (FBM) -``` +```kotlin // 1d val v0 = fbm(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v1 = fbm(seed, x, ::simplexLinear, octaves, lacunarity, gain) @@ -145,7 +149,7 @@ val v8 = fbm(seed, x, y, z, ::valueLinear, octaves, lacunarity, gain) #### Rigid -``` +```kotlin // 1d val v0 = rigid(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v1 = rigid(seed, x, ::simplexLinear, octaves, lacunarity, gain) @@ -164,7 +168,7 @@ val v5 = rigid(seed, x, y, z, ::valueLinear, octaves, lacunarity, gain) #### Billow -``` +```kotlin // 1d val v0 = billow(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v1 = billow(seed, x, ::perlinLinear, octaves, lacunarity, gain) @@ -180,6 +184,7 @@ val v6 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) val v7 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) ``` +