[orx-panel] Fix colorspace used for text input in ColorPicker
This commit is contained in:
33
orx-jvm/orx-panel/src/demo/kotlin/DemoColorPickerButton01.kt
Normal file
33
orx-jvm/orx-panel/src/demo/kotlin/DemoColorPickerButton01.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.panel.controlManager
|
||||
import org.openrndr.panel.elements.colorpickerButton
|
||||
|
||||
/**
|
||||
* A simple demonstration of a ColorPickerButton
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
var bgColor = ColorRGBa.PINK
|
||||
|
||||
val cm = controlManager {
|
||||
layout {
|
||||
colorpickerButton {
|
||||
label = "Pick color"
|
||||
color = bgColor
|
||||
events.valueChanged.listen {
|
||||
bgColor = it.color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
extend(cm)
|
||||
extend {
|
||||
drawer.clear(bgColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.openrndr.panel.elements
|
||||
import org.openrndr.*
|
||||
import org.openrndr.color.ColorHSVa
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.color.Linearity
|
||||
import org.openrndr.draw.ColorBuffer
|
||||
import org.openrndr.draw.Drawer
|
||||
import org.openrndr.draw.colorBuffer
|
||||
@@ -121,7 +122,7 @@ class Colorpicker : Element {
|
||||
val g = (number shr 8) and 0xff
|
||||
val b = number and 0xff
|
||||
val oldColor = color
|
||||
color = ColorRGBa(r / 255.0, g / 255.0, b / 255.0)
|
||||
color = ColorRGBa(r / 255.0, g / 255.0, b / 255.0, 1.0, Linearity.SRGB)
|
||||
events.colorChanged.trigger(ColorChangedEvent(this, oldColor, realColor))
|
||||
keyboardInput = ""
|
||||
draw.dirty = true
|
||||
|
||||
Reference in New Issue
Block a user