Readme files: add missing "kotlin" to code fences (#336)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -67,6 +67,7 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- __demos__ -->
|
<!-- __demos__ -->
|
||||||
## Demos
|
## Demos
|
||||||
### DemoImageFit01
|
### DemoImageFit01
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|||||||

|
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
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user