From d1fd5a5541b8a3d63e73e74ac27d6aef1bd2dd8c Mon Sep 17 00:00:00 2001 From: faberf Date: Wed, 28 Aug 2024 17:28:27 +0200 Subject: [PATCH] fix signed bytes --- .../vitrivr/engine/core/model/color/RGBColorContainer.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/color/RGBColorContainer.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/color/RGBColorContainer.kt index 498a6fad..536f5bf7 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/color/RGBColorContainer.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/color/RGBColorContainer.kt @@ -13,7 +13,7 @@ import kotlin.math.sqrt * @version 1.0.0 */ @JvmInline -value class RGBColorContainer constructor(private val rgb: FloatArray) { +value class RGBColorContainer(private val rgb: FloatArray) { init { require(this.rgb.size == 4) { "RGBFloatColorContainer must have exactly 4 elements." } @@ -23,8 +23,8 @@ value class RGBColorContainer constructor(private val rgb: FloatArray) { require(this.rgb[3] in 0.0f..1.0f) { "RGBFloatColorContainer components must be between 0.0 and 1.0." } } - constructor(rgb: Int) : this((rgb shr 16 and 0xFF).toByte(), (rgb shr 8 and 0xFF).toByte(), (rgb and 0xFF).toByte()) - constructor(red: Byte, green: Byte, blue: Byte, alpha: Byte = Byte.MAX_VALUE) : this(red.toFloat() / 255f, green.toFloat() / 255f, blue.toFloat() / 255f, alpha.toFloat() / 255f) + constructor(rgb: Int) : this((rgb shr 16 and 0xFF).toUByte(), (rgb shr 8 and 0xFF).toUByte(), (rgb and 0xFF).toUByte()) + constructor(red: UByte, green: UByte, blue: UByte, alpha: UByte = UByte.MAX_VALUE) : this(red.toFloat() / 255f, green.toFloat() / 255f, blue.toFloat() / 255f, alpha.toFloat() / 255f) constructor(red: Int, green: Int, blue: Int, alpha: Int = 255) : this(red.toFloat() / 255f, green.toFloat() / 255f, blue.toFloat() / 255f, alpha.toFloat() / 255f) constructor(r: Double, g: Double, b: Double, alpha: Double = 1.0) : this(r.toFloat(), g.toFloat(), b.toFloat(), alpha.toFloat()) constructor(red: Float, green: Float, blue: Float, alpha: Float = 1.0f) : this(floatArrayOf(red, green, blue, alpha))