[orx-color] Fix deprecation in demos

`.saturated` is now `.clip()`
This commit is contained in:
Abe Pazos
2024-07-30 22:53:33 +02:00
parent fdde6ad7b9
commit 3d59143754
3 changed files with 4 additions and 4 deletions

View File

@@ -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))
}

View File

@@ -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))
}

View File

@@ -48,7 +48,7 @@ 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)
@@ -56,7 +56,7 @@ fun main() {
}
}
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)