Suppress and resolve warnings

This commit is contained in:
Edwin Jakobs
2023-12-06 16:08:17 +01:00
parent a9b59a435a
commit 077f316b15
75 changed files with 152 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
package org.openrndr.extra.color.fettepalette
import org.openrndr.color.ColorHSLa
@@ -75,8 +77,6 @@ object Lamé : Curve {
object Arc : Curve {
override fun pointOnCurve(i: Double, total: Double, curveAccent: Double, min: Vector2, max: Vector2): Vector2 {
val limit = PI / 2
val percentile = i / total
val t = percentile * limit
val slice = limit / total
val y = cos(-PI / 2 + i * slice + curveAccent)
val x = sin(PI / 2 + i * slice - curveAccent)

View File

@@ -33,20 +33,20 @@ data class ColorOKLCHa(val l: Double, val c: Double, val h: Double, override val
@Deprecated("Legacy alpha parameter name", ReplaceWith("alpha"))
val a = alpha
override fun opacify(factor: Double) = copy(alpha = a * factor)
override fun opacify(factor: Double) = copy(alpha = alpha * factor)
override fun shade(factor: Double) = copy(l = l * factor)
override fun shiftHue(shiftInDegrees: Double) = copy(h = h + shiftInDegrees)
override fun saturate(factor: Double) = copy(c = c * factor)
override fun plus(right: ColorOKLCHa) = copy(l = l + right.l, c = c + right.c, h = h + right.h, alpha = a + right.a)
override fun minus(right: ColorOKLCHa) = copy(l = l - right.l, c = c - right.c, h = h - right.h, alpha = a - right.a)
override fun times(scale: Double) = copy(l = l * scale, c = c * scale, h = h * scale, alpha = a * scale)
override fun plus(right: ColorOKLCHa) = copy(l = l + right.l, c = c + right.c, h = h + right.h, alpha = alpha + right.alpha)
override fun minus(right: ColorOKLCHa) = copy(l = l - right.l, c = c - right.c, h = h - right.h, alpha = alpha - right.alpha)
override fun times(scale: Double) = copy(l = l * scale, c = c * scale, h = h * scale, alpha = alpha * scale)
override fun mix(other: ColorOKLCHa, factor: Double) = mix(this, other, factor)
fun toOKLABa(): ColorOKLABa {
val a = c * cos(h.asRadians)
val b = c * sin(h.asRadians)
return ColorOKLABa(l, a, b, alpha = this.a)
return ColorOKLABa(l, a, b, alpha = this.alpha)
}
override fun toRGBa(): ColorRGBa = toOKLABa().toRGBa()
@@ -59,7 +59,7 @@ fun mix(left: ColorOKLCHa, right: ColorOKLCHa, x: Double): ColorOKLCHa {
(1.0 - sx) * left.l + sx * right.l,
(1.0 - sx) * left.c + sx * right.c,
mixAngle(left.h, right.h, sx),
(1.0 - sx) * left.a + sx * right.a
(1.0 - sx) * left.alpha + sx * right.alpha
)
}

View File

@@ -40,7 +40,7 @@ data class ColorXSLUVa(val x: Double, val s: Double, val l: Double, override val
}
private fun xToHue(x:Double) : Double {
val x = x % 360.0
@Suppress("NAME_SHADOWING") val x = x.mod(360.0)
return if (0.0 <= x && x < 60.0) {
map(x, 0.0, 60.0, 0.0, 35.0)
} else if (60.0 <= x && x < 120.0) {

View File

@@ -105,7 +105,7 @@ internal fun find_cusp(a: Double, b: Double): DoubleArray {
}
internal fun get_ST_max(a: Double, b: Double, cusp: DoubleArray? = null): DoubleArray {
val cusp = cusp ?: find_cusp(a, b)
@Suppress("NAME_SHADOWING") val cusp = cusp ?: find_cusp(a, b)
val L = cusp[0]
val C = cusp[1]
@@ -183,7 +183,7 @@ fun find_gamut_intersection(
L0: Double,
cusp: DoubleArray? = null
): Double {
val cusp = cusp ?: find_cusp(a, b)
@Suppress("NAME_SHADOWING") val cusp = cusp ?: find_cusp(a, b)
// Find the intersection for upper and lower half seprately