X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FVideoFrame.java;h=931237dae82c80ae5a2f146bc0f95f7d78292580;hb=fe55a0449c2f5d434357c481890d909fffd30b3a;hp=e77dcd9a67bf807f1b77e8f7813ecd7f3b7a8b32;hpb=6a03452e2520ad9d3b2a9d7e1932bb93e696380d;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/VideoFrame.java b/src/kaka/cakelight/VideoFrame.java index e77dcd9..931237d 100644 --- a/src/kaka/cakelight/VideoFrame.java +++ b/src/kaka/cakelight/VideoFrame.java @@ -104,7 +104,10 @@ public class VideoFrame { private Color wrappedGetLedColor(ListPosition listPosition, int xy) { Color c = getLedColor(listPosition, xy); double[] hsv = c.toHSV(); - return Color.hsv(hsv[0], 1, 1); + double saturation = config.video.saturation >= 0.5 + ? hsv[1] + (config.video.saturation - 0.5) * 2 * (1 - hsv[1]) + : hsv[1] - (1 - config.video.saturation * 2) * hsv[1]; + return Color.hsv(hsv[0], saturation, hsv[2]); } private Color getLedColor(ListPosition listPosition, int xy) { @@ -172,10 +175,27 @@ public class VideoFrame { public LedFrame getLedFrame() { LedFrame frame = LedFrame.from(config); int led = 0; - if (config.video.list.bottom) for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i)); - if (config.video.list.right) for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i)); - if (config.video.list.top) for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i)); - if (config.video.list.left) for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i)); + + if (config.video.list.bottom) + for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.BOTTOM, i)); + else + for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.right) + for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.RIGHT, i)); + else + for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.top) + for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.TOP, i)); + else + for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, Color.BLACK); + + if (config.video.list.left) + for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, wrappedGetLedColor(ListPosition.LEFT, i)); + else + for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, Color.BLACK); + return frame; } }