diff --git a/src/main/kotlin/graphics/scenery/volumes/ColormapPanel.kt b/src/main/kotlin/graphics/scenery/volumes/ColormapPanel.kt index e99200533..cbb980e6d 100644 --- a/src/main/kotlin/graphics/scenery/volumes/ColormapPanel.kt +++ b/src/main/kotlin/graphics/scenery/volumes/ColormapPanel.kt @@ -299,7 +299,8 @@ class ColormapPanel(val target:Volume?): JPanel() { repaint() if(width > 0 && height > 0) { - target?.colormap = Colormap.fromBuffer(toBuffer(), width, height) + val bi = toImage() + target?.colormap = Colormap.fromBuffer(Image.bufferedImageToRGBABuffer(bi), bi.width, bi.height) } } @@ -310,10 +311,6 @@ class ColormapPanel(val target:Volume?): JPanel() { return bufferedImage } - private fun toBuffer(): ByteBuffer { - return Image.bufferedImageToRGBABuffer(toImage()) - } - private fun pointAtMouse(e: MouseEvent) = colorPoints.firstOrNull { (e.x - (width * it.position)).absoluteValue < height / 2 } @@ -325,9 +322,7 @@ class ColormapPanel(val target:Volume?): JPanel() { val h = height val pointList = colorPoints.sortedBy { it.position } - // background Gradient - //paintBackgroundGradient(pointList, g2d) val img = toImage() g2d.drawImage(img, 0, 0, this)