Skip to content

Commit

Permalink
[orx-color] Fix deprecation in demos
Browse files Browse the repository at this point in the history
`.saturated` is now `.clip()`
  • Loading branch information
hamoid committed Jul 30, 2024
1 parent fdde6ad commit 3d59143
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion orx-color/src/jvmDemo/kotlin/DemoColorPlane01.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fun main() {
for (hue in 0 until 360 step 4) {
for (chroma in 0 until 100 step 1) {
val lch = ColorOKLCHa(cos(seconds * 0.1) * 0.5 + 0.5, chroma / 100.0, hue.toDouble())
val srgb = lch.toRGBa().toSRGB().saturated
val srgb = lch.toRGBa().toSRGB().clip()
write(srgb)
write(Vector3((srgb.r - 0.5) * 10.0, (srgb.g - 0.5) * 10.0, (srgb.b - 0.5) * 10.0))
}
Expand Down
2 changes: 1 addition & 1 deletion orx-color/src/jvmDemo/kotlin/DemoColorPlane02.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun main() {
for (lumo in 0 until 100 step 1) {
for (chroma in 0 until 100 step 1) {
val lch = ColorOKLCHa(lumo / 100.0, chroma / 100.0, cos(seconds * 0.1) * 360.0)
val srgb = lch.toRGBa().toSRGB().saturated
val srgb = lch.toRGBa().toSRGB().clip()
write(srgb)
write(Vector3((srgb.r - 0.5) * 10.0, (srgb.g - 0.5) * 10.0, (srgb.b - 0.5) * 10.0))
}
Expand Down
4 changes: 2 additions & 2 deletions orx-color/src/jvmDemo/kotlin/DemoColorRange04.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ fun main() {
drawer.fontMap = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 16.0)
for ((_, steps) in allSteps) {
for (i in steps.indices) {
val srgb = steps[i].toSRGB().saturated
val srgb = steps[i].toSRGB().clip()
drawer.fill = srgb
drawer.isolated {
drawer.translate((srgb.r - 0.5) * 10.0, (srgb.g - 0.5) * 10.0, (srgb.b - 0.5) * 10.0)
drawer.vertexBuffer(mesh, DrawPrimitive.TRIANGLES)
}
}
val positions = steps.map {
val l = it.toSRGB().saturated
val l = it.toSRGB().clip()
Vector3((l.r - 0.5) * 10.0, (l.g - 0.5) * 10.0, (l.b - 0.5) * 10.0)
}
drawer.stroke = ColorRGBa.BLACK.opacify(0.25)
Expand Down

0 comments on commit 3d59143

Please sign in to comment.