X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FVideoFrame.java;h=a3353a5b9ce68c8768a7d8e74b621c8df90134ba;hb=48cb60b7bcb3acecc8b56b5e07b4f7e883f35e8f;hp=e77dcd9a67bf807f1b77e8f7813ecd7f3b7a8b32;hpb=6a03452e2520ad9d3b2a9d7e1932bb93e696380d;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/VideoFrame.java b/src/kaka/cakelight/VideoFrame.java index e77dcd9..a3353a5 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,34 @@ 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; } + + private enum ListPosition { + LEFT, + RIGHT, + TOP, + BOTTOM + } }