Accommodate for changes to default sRGB textures and targets

This commit is contained in:
Edwin Jakobs
2024-08-13 12:35:58 +02:00
parent 6f5ae89de7
commit 78ce8001a1
14 changed files with 25 additions and 105 deletions

View File

@@ -141,7 +141,7 @@ class Colorpicker : Element {
for (y in 0..49) {
for (x in 0 until it.colorBuffer.width) {
val hsv = ColorHSVa(360.0 / it.colorBuffer.width * x, saturation, (49 - y) / 49.0)
it.write(x, y, hsv.toRGBa())
it.write(x, y, hsv.toRGBa().toLinear())
}
}
it.upload()
@@ -155,7 +155,7 @@ class Colorpicker : Element {
}
drawer.image(colorMap!!, 0.0, 0.0)
drawer.fill = (color)
drawer.fill = color
drawer.stroke = null
drawer.shadeStyle = null
drawer.rectangle(0.0, 50.0, layout.screenWidth, 20.0)

View File

@@ -2,6 +2,7 @@ package org.openrndr.panel.elements
import kotlinx.coroutines.yield
import org.openrndr.color.ColorRGBa
import org.openrndr.color.Linearity
import org.openrndr.draw.Drawer
import org.openrndr.draw.LineCap
@@ -16,7 +17,7 @@ class ColorpickerButton : Element(ElementType("colorpicker-button")), Disposable
override var disposed: Boolean = false
var label: String = "OK"
var color: ColorRGBa = ColorRGBa(0.5, 0.5, 0.5)
var color: ColorRGBa = ColorRGBa(0.5, 0.5, 0.5, linearity = Linearity.SRGB)
set(value) {
if (value != field) {
field = value
@@ -74,13 +75,13 @@ class ColorpickerButton : Element(ElementType("colorpicker-button")), Disposable
val offset = Math.round((layout.screenWidth - textWidth) / 2.0)
val yOffset = Math.round((layout.screenHeight / 2) + textHeight / 2.0) - 2.0
drawer.fill = ((computedStyle.color as? Color.RGBa)?.color ?: ColorRGBa.WHITE)
drawer.fill = (computedStyle.color as? Color.RGBa)?.color ?: ColorRGBa.WHITE
drawer.fontMap = font
drawer.text(text, 0.0 + offset, 0.0 + yOffset)
drawer.stroke = (color)
drawer.stroke = color
drawer.pushStyle()
drawer.strokeWeight = (4.0)
drawer.lineCap = (LineCap.ROUND)
drawer.strokeWeight = 4.0
drawer.lineCap = LineCap.ROUND
drawer.lineSegment(2.0, layout.screenHeight - 2.0, layout.screenWidth - 2.0, layout.screenHeight - 2.0)
drawer.popStyle()
}