Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/ledctl.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 30 additions & 12 deletions pixarray/pixarray.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,42 @@ const (
GBR
RGB
RBG
GRBW
BRGW
BGRW
GBRW
RGBW
RBGW
)

var StringOrders map[string]int = map[string]int{
"GRB": GRB,
"BRG": BRG,
"BGR": BGR,
"GBR": GBR,
"RGB": RGB,
"RBG": RBG,
"GRB": GRB,
"BRG": BRG,
"BGR": BGR,
"GBR": GBR,
"RGB": RGB,
"RBG": RBG,
"GRBW": GRBW,
"BRGW": BRGW,
"BGRW": BGRW,
"GBRW": GBRW,
"RGBW": RGBW,
"RBGW": RBGW,
}

var offsets map[int][]int = map[int][]int{
GRB: {0, 1, 2, -1},
BRG: {2, 1, 0, -1},
BGR: {1, 2, 0, -1},
GBR: {0, 2, 1, -1},
RGB: {1, 0, 2, -1},
RBG: {2, 0, 1, -1},
GRB: {0, 1, 2, -1},
BRG: {2, 1, 0, -1},
BGR: {1, 2, 0, -1},
GBR: {0, 2, 1, -1},
RGB: {1, 0, 2, -1},
RBG: {2, 0, 1, -1},
GRBW: {0, 1, 2, 3},
BRGW: {2, 1, 0, 3},
BGRW: {1, 2, 0, 3},
GBRW: {0, 2, 1, 3},
RGBW: {1, 0, 2, 3},
RBGW: {2, 0, 1, 3},
}

func abs(i int) int {
Expand Down