@Test public void orderedBytesWhenModeIsGBR() { Ws2801.Mode mode = Ws2801.Mode.GBR; byte[] result = ColorUnpacker.getOrderedRgbBytes(mode, R, G, B); assertBytesOrder(result, G, B, R); }
static byte[] getOrderedRgbBytes(Mode ledMode, byte r, byte g, byte b) { switch (ledMode) { case RBG: return new byte[]{r, b, g}; case BGR: return new byte[]{b, g, r}; case BRG: return new byte[]{b, r, g}; case GRB: return new byte[]{g, r, b}; case GBR: return new byte[]{g, b, r}; default: throw new IllegalArgumentException(ledMode.name() + " is an unknown " + Mode.class.getSimpleName()); } }
ColorUnpacker { static byte[] getOrderedRgbBytes(Mode ledMode, byte r, byte g, byte b) { switch (ledMode) { case RBG: return new byte[]{r, b, g}; case BGR: return new byte[]{b, g, r}; case BRG: return new byte[]{b, r, g}; case GRB: return new byte[]{g, r, b}; case GBR: return new byte[]{g, b, r}; default: throw new IllegalArgumentException(ledMode.name() + " is an unknown " + Mode.class.getSimpleName()); } } }
ColorUnpacker { static byte[] getOrderedRgbBytes(Mode ledMode, byte r, byte g, byte b) { switch (ledMode) { case RBG: return new byte[]{r, b, g}; case BGR: return new byte[]{b, g, r}; case BRG: return new byte[]{b, r, g}; case GRB: return new byte[]{g, r, b}; case GBR: return new byte[]{g, b, r}; default: throw new IllegalArgumentException(ledMode.name() + " is an unknown " + Mode.class.getSimpleName()); } } ColorUnpacker(Mode ledMode); }
ColorUnpacker { static byte[] getOrderedRgbBytes(Mode ledMode, byte r, byte g, byte b) { switch (ledMode) { case RBG: return new byte[]{r, b, g}; case BGR: return new byte[]{b, g, r}; case BRG: return new byte[]{b, r, g}; case GRB: return new byte[]{g, r, b}; case GBR: return new byte[]{g, b, r}; default: throw new IllegalArgumentException(ledMode.name() + " is an unknown " + Mode.class.getSimpleName()); } } ColorUnpacker(Mode ledMode);  }
ColorUnpacker { static byte[] getOrderedRgbBytes(Mode ledMode, byte r, byte g, byte b) { switch (ledMode) { case RBG: return new byte[]{r, b, g}; case BGR: return new byte[]{b, g, r}; case BRG: return new byte[]{b, r, g}; case GRB: return new byte[]{g, r, b}; case GBR: return new byte[]{g, b, r}; default: throw new IllegalArgumentException(ledMode.name() + " is an unknown " + Mode.class.getSimpleName()); } } ColorUnpacker(Mode ledMode);   }