17 lines
350 B
Go
17 lines
350 B
Go
|
package patterns
|
||
|
|
||
|
func AlternateRGBLinear(R0 byte, G0 byte, B0 byte, R1 byte, G1 byte, B1 byte, fromX int, toX int) []byte {
|
||
|
ret := make([]byte, toX*3)
|
||
|
for i := fromX; i < toX*3; i += 3 {
|
||
|
if Even(i) {
|
||
|
ret[i] = R0
|
||
|
ret[i+1] = G0
|
||
|
ret[i+2] = B0
|
||
|
} else {
|
||
|
ret[i] = R1
|
||
|
ret[i+1] = G1
|
||
|
ret[i+2] = B1
|
||
|
}
|
||
|
}
|
||
|
return ret
|
||
|
}
|