X-Git-Url: http://dolda2000.com/gitweb/?p=kaka%2Fcakelight.git;a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FFrame.java;h=07a6ffd0744c8229eee43c25430af4a6cd9fec94;hp=a1d6946743fb8d45e35572afcf5e3478b1ded480;hb=03b67a7377d6d23d517d33e47f338bb7859596ed;hpb=03670958a5eab132a4f1a6ae5ae58b88f55bfe2f diff --git a/src/kaka/cakelight/Frame.java b/src/kaka/cakelight/Frame.java index a1d6946..07a6ffd 100644 --- a/src/kaka/cakelight/Frame.java +++ b/src/kaka/cakelight/Frame.java @@ -131,4 +131,17 @@ public class Frame { public Mat getConvertedImage() { return converted; } + + /** + * Creates a LED frame going clockwise from the bottom-left corner, sans the corners. + */ + public LedFrame getLedFrame() { + LedFrame frame = LedFrame.from(config); + int led = 0; + for (int i = config.leds.rows - 1; i >= 0; i--) frame.setLedColor(led++, getLedColor(ListPosition.LEFT, i)); + for (int i = 0; i < config.leds.cols; i++) frame.setLedColor(led++, getLedColor(ListPosition.TOP, i)); + for (int i = 0; i < config.leds.rows; i++) frame.setLedColor(led++, getLedColor(ListPosition.RIGHT, i)); + for (int i = config.leds.cols - 1; i >= 0; i--) frame.setLedColor(led++, getLedColor(ListPosition.BOTTOM, i)); + return frame; + } }