Documentation ¶
Index ¶
- func StripLinearExp(val byte) byte
- type Buffer
- func (pb *Buffer) AntiLog()
- func (pb *Buffer) Bytes() []byte
- func (pb *Buffer) CloneFrom(other *Buffer)
- func (pb *Buffer) CloneFromWithLen(other *Buffer, count int)
- func (pb *Buffer) CopyPixelValuesFrom(other *Buffer)
- func (pb *Buffer) Len() int
- func (pb *Buffer) Pixel(i int) (p P)
- func (pb *Buffer) ReadFrom(r *byteslicereader.R, size int) error
- func (pb *Buffer) Reset(size int)
- func (pb *Buffer) SetPixel(i int, p P)
- func (pb *Buffer) SetPixels(pixels ...P)
- func (pb *Buffer) UseBytes(buf []byte)
- type BufferLayout
- type P
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripLinearExp ¶
StripLinearExp returns the linear expansion factor for the given value.
Types ¶
type Buffer ¶
type Buffer struct { // Layout is the buffer layout to use. // // Adjusting this value will invalidate the current buffered data. The user // must call Reset afterwards. Layout BufferLayout // contains filtered or unexported fields }
Buffer represents the wire format for a series of consecutive pixels. It is used for minimal-copy pixel processing.
func (*Buffer) AntiLog ¶
func (pb *Buffer) AntiLog()
AntiLog performs an antilog transform on every pixel in the buffer. This is more efficient than calling AntiLog on each individual pixel.
func (*Buffer) CloneFromWithLen ¶
CloneFromWithLen clones pb from the pixels in other. pb will have count pixels. If other has additional pixels, they will be discarded during the clone. If other has fewer pixels, pb's remainder will be left uninitialised (black).
func (*Buffer) CopyPixelValuesFrom ¶
CopyPixelValuesFrom tries to set pb's pixel values to match those in other.
If pb's flags and size align with other, this will be a fast buffer copy. Otherwise, as many pixels as possible will be copied from other one-by-one.
In either case, pb will not have its flags or size changed.
func (*Buffer) Pixel ¶
Pixel returns the pixel data for the Pixel at index i.
If i is out of bounds, Pixel will return a zero value.
func (*Buffer) ReadFrom ¶
func (pb *Buffer) ReadFrom(r *byteslicereader.R, size int) error
ReadFrom reads a Buffer with size pixels from the supplied byte slice reader.
The Buffer's underlying data will be a pointer into that byte slice reader's buffer, and pb expects to take ownership over that section of the buffer.
func (*Buffer) Reset ¶
Reset clears the buffer and allocates room for size pixels.
If the underlying buffer is already >= this size, it will be reused; otherwise, a new buffer will be allocated.
func (*Buffer) SetPixel ¶
SetPixel sets the pixel value at index i.
If i is out of bounds, SetPixel will do nothing.
type BufferLayout ¶
type BufferLayout int
BufferLayout is the layout of a pixel buffer.
const ( // BufferRGB is a BufferLayout specifying a series of contiguous (R, G, B) // pixel value bytes. BufferRGB BufferLayout = iota // BufferRGBOW is a BufferLayout specifying a series of contiguous // (R, G, B, OOO, WWW) pixel value bytes. The O and W bytes are each three // bytes of the same value. BufferRGBOW )
type P ¶
type P struct { Red uint8 Green uint8 Blue uint8 // Note that Orange and White take three bytes in the protocol, despite the // fact that they can only hold a single byte value. // // These may not be populated if the strip is not an RGBOW strip. Orange uint8 White uint8 }
P is the state of a single pixel.
Depending on the strip that P belongs to, Orange and White may be ignored.