This is a mostly a number of small changes to improve efficiency; and there are two 'feature adds':
you can now assign to a slice, e.g. pixels[:12:2] = red, see examples/set_range.py
rotate_left() and rotate_right() can now be called with no parameter; defaults to 1 (this looks like it was the original intent)
I had looked for a way to pass a range of pixels to set_pixel, so that when calling set_pixel_line or fill, we could avoid the repeated calculation inside set_pixel; instead, just do it it once and store it multiple times. By making set_pixel accept a slice object for 'pixel_num', we get this advantage and can also implement the __setitem__ operation for assigning to slices, by just forwarding the slice to get_pixel.
The branch is a series of small, mostly independent mods (one per commit) to make it easier to review; and relatively easy to drop any you don't like.
NOTE: I have only tested with "GRB" mode, since that's what the LEDs I have are.
This is a mostly a number of small changes to improve efficiency; and there are two 'feature adds':
pixels[:12:2] = red
, seeexamples/set_range.py
rotate_left()
androtate_right()
can now be called with no parameter; defaults to 1 (this looks like it was the original intent)I had looked for a way to pass a range of pixels to
set_pixel
, so that when callingset_pixel_line
orfill
, we could avoid the repeated calculation insideset_pixel
; instead, just do it it once and store it multiple times. By makingset_pixel
accept a slice object for 'pixel_num', we get this advantage and can also implement the__setitem__
operation for assigning to slices, by just forwarding the slice toget_pixel
.The branch is a series of small, mostly independent mods (one per commit) to make it easier to review; and relatively easy to drop any you don't like.
NOTE: I have only tested with
"GRB"
mode, since that's what the LEDs I have are.