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.
|
||||
|
||||
```
|
||||
```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
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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__ -->
|
||||
## Demos
|
||||
### DemoImageFit01
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||

|
||||
```
|
||||
```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__ -->
|
||||
## Demos
|
||||
### DemoOlive01
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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)
|
||||
```
|
||||
|
||||
<!-- __demos__ >
|
||||
# Demos
|
||||
[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)
|
||||
|
||||
```
|
||||
```kotlin
|
||||
extend(TemporalBlur()) {
|
||||
colorMatrix = {
|
||||
// `it` is 0.0 at start of frame, 1.0 at end of frame
|
||||
|
||||
Reference in New Issue
Block a user