Direct access to Pixel Buffer?

Does the PixelBlaze architecture use an internal Pixel Buffer to store all the pixel values prior to serializing them out to the LED strip? And if so, is there a way to directly access (both read and write) that Pixel Buffer Array?

I ask because I have a pattern that would be easier to render completely in the beforeRender() function, particularly if the Pixel Buffer could be manipulated with the Array functions such as arrayMutate(a, fn) ↔️ a.mutate(fn).

In order to calculate my next frame’s pixel values, I need to be able to Read the Pixel Buffer’s prior frame values, do some calcs, and then Write my new values. So render() alone does not provide enough information (about the former value).

I understand that if I cannot have access to the internal Pixel Buffer Array, then I could declare my own array, do the calculations on it in beforeRender(), and then in render() I could just call rgb() with values indexed from my own array. But I would prefer to just have direct access.

There’s no buffer so that each pixel can be sent out on the wire immediately after the call to render().

However you can easily make your own framebuffer, as in, just for example:

I looked through my patterns and … yeah I do it several different ways depending on the shape of the LED strip and how the beforeRender process accesses the pixels.

For example for a sword that has a total of 288 pixels up one side and down the other, I have a ‘framebuffer’ of 144 pixels which are all calculated in beforeRender (for motion blur and stuff like that), and then the render function is just … (hPc is half pixelcount)

export function render(index) {
  // The PB is at one end of the strip, and the strip is folded in half
  // Use "^hPc - [...]" instead of "[...] - 1$" if PB is at the other end
  pindex = ( (index < hPc) ? (hPc - index) : (index - hPc + 1) ) - 1

  rgb(fb_Red[pindex], fb_Green[pindex], fb_Blue[pindex])
1 Like