mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
colorutil update, some code cleanup
Former-commit-id: 47b13e7e899dc9151f7a1ae71977ed8d4b403345 Former-commit-id: 136f9c787b76aec75d76535891cf264170bd3b04
This commit is contained in:
@@ -3,8 +3,9 @@ package net.torvald.colourutil
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.Color
|
||||
import net.torvald.colourutil.CIELabUtil.toXYZ
|
||||
import net.torvald.colourutil.CIELabUtil.toRawRGB
|
||||
import net.torvald.colourutil.CIELabUtil.toRGB
|
||||
import net.torvald.colourutil.CIEXYZUtil.toColor
|
||||
import net.torvald.colourutil.CIEXYZUtil.toRGB
|
||||
import net.torvald.colourutil.CIEXYZUtil.toXYZ
|
||||
import net.torvald.colourutil.CIELuvUtil.toLuv
|
||||
import net.torvald.colourutil.CIELuvUtil.toXYZ
|
||||
|
||||
@@ -25,7 +26,7 @@ object CIELuvUtil {
|
||||
|
||||
val luv = this.toLuv()
|
||||
luv.L *= brighten
|
||||
return luv.toRGB()
|
||||
return luv.toColor()
|
||||
}
|
||||
|
||||
fun Color.darkerLuv(scale: Float): Color {
|
||||
@@ -33,7 +34,7 @@ object CIELuvUtil {
|
||||
|
||||
val luv = this.toLuv()
|
||||
luv.L *= darken
|
||||
return luv.toRGB()
|
||||
return luv.toColor()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +56,7 @@ object CIELuvUtil {
|
||||
val newU = thisLuv.u.times(otherLuv.L / newL) + otherLuv.u.times(otherLuv.L).times(1f - thisLuv.L).div(newL)
|
||||
val newV = thisLuv.v.times(otherLuv.L / newL) + otherLuv.v.times(otherLuv.L).times(1f - thisLuv.L).div(newL)
|
||||
|
||||
return CIELuv(newL, newU, newV).toRawRGB()
|
||||
return CIELuv(newL, newU, newV).toRGB()
|
||||
}
|
||||
|
||||
fun CIEXYZ.toLuv(): CIELuv {
|
||||
@@ -98,8 +99,8 @@ object CIELuvUtil {
|
||||
}
|
||||
|
||||
fun Color.toLuv() = this.toXYZ().toLuv()
|
||||
fun CIELuv.toRawRGB() = this.toXYZ().toRawRGB()
|
||||
fun CIELuv.toRGB() = this.toXYZ().toRGB()
|
||||
fun CIELuv.toColor() = this.toXYZ().toColor()
|
||||
|
||||
/**
|
||||
* Range:
|
||||
|
||||
Reference in New Issue
Block a user