Readme files: add missing "kotlin" to code fences (#336)

This commit is contained in:
Abe Pazos
2024-05-27 12:37:21 +00:00
committed by GitHub
parent 45d67a7ef9
commit d8682f34f9
12 changed files with 37 additions and 23 deletions

View File

@@ -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. orx-color comes with tools to calculate color histograms for images.
``` ```kotlin
val histogram = calculateHistogramRGB(image) val histogram = calculateHistogramRGB(image)
val colors = histogram.sortedColors() val colors = histogram.sortedColors()
``` ```
@@ -20,7 +20,7 @@ val colors = histogram.sortedColors()
Easy ways of creating blends between colors. Easy ways of creating blends between colors.
Using the `rangeTo` operator: Using the `rangeTo` operator:
``` ```kotlin
for (c in ColorRGBa.PINK..ColorRGBa.BLUE.toHSVa() blend 10) { for (c in ColorRGBa.PINK..ColorRGBa.BLUE.toHSVa() blend 10) {
drawer.fill = c drawer.fill = c
drawer.rectangle(0.0, 0.0, 40.0, 40.0) 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. 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, val cs = colorSequence(0.0 to ColorRGBa.PINK,
0.5 to ColorRGBa.BLUE, 0.5 to ColorRGBa.BLUE,
1.0 to ColorRGBa.PINK.toHSLUVa()) // <-- note this one is in hsluv 1.0 to ColorRGBa.PINK.toHSLUVa()) // <-- note this one is in hsluv

View File

@@ -8,7 +8,7 @@ In development. Things may change without prior notice.
## Usage ## Usage
``` ```kotlin
fun main() = application { fun main() = application {
program { program {
val linkNode: ComputeNode val linkNode: ComputeNode
@@ -52,4 +52,4 @@ fun main() = application {
} }
} }
} }
``` ```

View File

@@ -25,7 +25,7 @@ Similar to those on https://easings.net
## Usage ## Usage
``` ```kotlin
fun easeX( fun easeX(
t: Double, // current time t: Double, // current time
b: Double = 0.0, // beginning (output value when t is 0.0) b: Double = 0.0, // beginning (output value when t is 0.0)

View File

@@ -8,7 +8,7 @@ Similar to CSS object-fit (https://developer.mozilla.org/en-US/docs/Web/CSS/obje
## Usage ## Usage
``` ```kotlin
drawer.imageFit( drawer.imageFit(
img: ColorBuffer, img: ColorBuffer,
x: Double, y: Double, w: Double, h: Double, x: Double, y: Double, w: Double, h: Double,
@@ -19,7 +19,7 @@ drawer.imageFit(
or or
``` ```kotlin
drawer.imageFit( drawer.imageFit(
img: ColorBuffer, img: ColorBuffer,
bounds: Rectangle, bounds: Rectangle,
@@ -66,7 +66,8 @@ fun main() = application {
} }
} }
} }
``` ```
<!-- __demos__ --> <!-- __demos__ -->
## Demos ## Demos
### DemoImageFit01 ### DemoImageFit01

View File

@@ -4,7 +4,7 @@ CPU and GPU-based implementation for integral images (summed area tables)
#### Usage #### Usage
``` ```kotlin
val image = colorBuffer( ... ) val image = colorBuffer( ... )
image.shadow.download() image.shadow.download()
val integralImage = IntegralImage.fromColorBufferShadow(image.shadow) val integralImage = IntegralImage.fromColorBufferShadow(image.shadow)

View File

@@ -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). For more information on interval trees read the [wikipedia page](https://en.wikipedia.org/wiki/Interval_tree).
## Usage ## Usage
```
```kotlin
// -- the item class we want to search for // -- the item class we want to search for
class Item(val start: Double, val end: Double) class Item(val start: Double, val end: Double)

View File

@@ -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. 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`: An example `live.kts` script that uses `orx-gui` and `Reloadable`:
```kotlin ```kotlin
@file:Suppress("UNUSED_LAMBDA_EXPRESSION") @file:Suppress("UNUSED_LAMBDA_EXPRESSION")
import org.openrndr.Program 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 ![DemoOptions01Kt](https://github.com/openrndr/orx/blob/media/orx-gui/images/DemoOptions01Kt.png
[DemoSimple01Kt](src/demo/kotlin/DemoSimple01Kt.kt [DemoSimple01Kt](src/demo/kotlin/DemoSimple01Kt.kt
![DemoSimple01Kt](https://github.com/openrndr/orx/blob/media/orx-gui/images/DemoSimple01Kt.png ![DemoSimple01Kt](https://github.com/openrndr/orx/blob/media/orx-gui/images/DemoSimple01Kt.png
<!-- __demos__ --> <!-- __demos__ -->
## Demos ## Demos
### DemoAppearance01 ### DemoAppearance01

View File

@@ -5,7 +5,7 @@ Provides live coding functionality: updates a running OPENRNDR program when you
## usage ## usage
make sure that you add the following to your list of dependencies (next to orx-olive) 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" 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. This functionality is offered by the `Reloadable` class.
An example `live.kts` in which the reloadable state is used: An example `live.kts` in which the reloadable state is used:
```kotlin ```kotlin
@file:Suppress("UNUSED_LAMBDA_EXPRESSION") @file:Suppress("UNUSED_LAMBDA_EXPRESSION")
import org.openrndr.color.ColorRGBa 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 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. `persistent {}` builder function.
```!kotlin ```kotlin
@file:Suppress("UNUSED_LAMBDA_EXPRESSION") @file:Suppress("UNUSED_LAMBDA_EXPRESSION")
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.* import org.openrndr.draw.*
@@ -133,6 +134,7 @@ import org.openrndr.draw.*
} }
} }
``` ```
<!-- __demos__ --> <!-- __demos__ -->
## Demos ## Demos
### DemoOlive01 ### DemoOlive01

View File

@@ -6,6 +6,7 @@ Send frames to- and from OPENRNDR to other applications in real time using _Syph
### Syphon Server ### Syphon Server
#### Sharing the whole view #### Sharing the whole view
```kotlin ```kotlin
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
@@ -33,6 +34,7 @@ fun main() {
``` ```
#### Sharing a different render target #### Sharing a different render target
```kotlin ```kotlin
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
@@ -75,6 +77,7 @@ fun main() {
``` ```
### Syphon Client ### Syphon Client
```kotlin ```kotlin
fun main() = application { fun main() = application {
configure { configure {

View File

@@ -6,7 +6,7 @@ GIF, H265, PNG, Prores, TIFF and Webp `VideoWriterProfile`s for `ScreenRecorder`
### GIF ### GIF
``` ```kotlin
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.extra.videoprofiles.* 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: 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 $ gifsicle --loop --delay=4 --colors 16 --optimize=2 heavy.gif >lessheavy.gif
``` ```

View File

@@ -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. These are a mostly straight port from FastNoise-Java but have a slightly different interface.
### Perlin noise ### Perlin noise
```
```kotlin
// -- 1d // -- 1d
val v0 = perlinLinear(seed, x) val v0 = perlinLinear(seed, x)
val v1 = perlinQuintic(seed, x) val v1 = perlinQuintic(seed, x)
@@ -70,7 +71,8 @@ val v8 = perlinHermite(seed, x, y, z)
``` ```
### Value noise ### Value noise
```
```kotlin
// -- 1d // -- 1d
val v0 = valueLinear(seed, x) val v0 = valueLinear(seed, x)
val v1 = valueQuintic(seed, x) val v1 = valueQuintic(seed, x)
@@ -88,7 +90,8 @@ val v7 = valueHermite(seed, x, y ,z)
``` ```
### Simplex noise ### Simplex noise
```
```kotlin
// -- 1d // -- 1d
val v0 = simplex(seed, x) val v0 = simplex(seed, x)
@@ -103,7 +106,8 @@ val v3 = simplex(seed, x, y, z, w)
``` ```
### Cubic noise ### Cubic noise
```
```kotlin
// -- 1d // -- 1d
val v0 = cubic(seed, x, y) val v0 = cubic(seed, x, y)
val v1 = cubicQuintic(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) #### Fractal brownian motion (FBM)
``` ```kotlin
// 1d // 1d
val v0 = fbm(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v0 = fbm(seed, x, ::perlinLinear, octaves, lacunarity, gain)
val v1 = fbm(seed, x, ::simplexLinear, 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 #### Rigid
``` ```kotlin
// 1d // 1d
val v0 = rigid(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v0 = rigid(seed, x, ::perlinLinear, octaves, lacunarity, gain)
val v1 = rigid(seed, x, ::simplexLinear, 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 #### Billow
``` ```kotlin
// 1d // 1d
val v0 = billow(seed, x, ::perlinLinear, octaves, lacunarity, gain) val v0 = billow(seed, x, ::perlinLinear, octaves, lacunarity, gain)
val v1 = 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 v7 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain) val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
``` ```
<!-- __demos__ > <!-- __demos__ >
# Demos # Demos
[DemoGradientPerturb2DKt](src/demo/kotlin/DemoGradientPerturb2DKt.kt [DemoGradientPerturb2DKt](src/demo/kotlin/DemoGradientPerturb2DKt.kt

View File

@@ -29,7 +29,7 @@ extend(TemporalBlur()) {
Additionally, a color matrix can be set per accumulation step. See [`DemoColorShift01.kt`](src/demo/kotlin/DemoColorShift01.kt) Additionally, a color matrix can be set per accumulation step. See [`DemoColorShift01.kt`](src/demo/kotlin/DemoColorShift01.kt)
``` ```kotlin
extend(TemporalBlur()) { extend(TemporalBlur()) {
colorMatrix = { colorMatrix = {
// `it` is 0.0 at start of frame, 1.0 at end of frame // `it` is 0.0 at start of frame, 1.0 at end of frame