mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-07 12:54:26 +02:00
Updated NeoBuffer object (markdown)
@@ -1,3 +1,28 @@
|
||||
(under construction)
|
||||
|
||||
[NeoBuffer object API](https://github.com/Makuna/NeoPixelBus/wiki/NeoBuffer-object-API)
|
||||
[NeoBuffer object API](https://github.com/Makuna/NeoPixelBus/wiki/NeoBuffer-object-API)
|
||||
|
||||
The NeoBuffer is basic image storage object. Based upon the "method" object it is defined with, it can store the image data in RAM or reference image data stored in PROGMEM.
|
||||
|
||||
It provides direct x,y access to get and set pixels along with a render method Blt() that will copy bits to the NeoPixelBus or other Raster objects.
|
||||
|
||||
## How to construct one
|
||||
The important part of creating one is to match the "ColorFeature" between your NeoPixelBus and the buffer since the buffer will store/reference data in the same format as the bus.
|
||||
|
||||
Here you can see that they both are defined with `NeoGrbwFeature`.
|
||||
```
|
||||
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
NeoBuffer<NeoBufferMethod<NeoGrbwFeature>> image(myImageWidth, myImageHeight, NULL);
|
||||
```
|
||||
|
||||
You also need to decide how you are going to store the image data. Images take a lot of memory, and some consideration needs to be taken when making this decision.
|
||||
If you plan to dynamically modify the image through source code, then you have to use define it to use RAM. You can still initialize the RAM stored image from PROGMEM.
|
||||
If you plan to just consume the image and never modify it, your best approach is to use PROGMEM as it will store in flash like source code and save precious RAM for your sketch.
|
||||
```
|
||||
// stored in RAM, but initialized by the "myImage" from PROGMEM
|
||||
NeoBuffer<NeoBuffermMethod<NeoGrbwFeature>> image(myImageWidth, myImageHeight, myImage);
|
||||
// stored in PROGMEM
|
||||
NeoBuffer<NeoBufferProgmemMethod<NeoGrbwFeature>> image(myImageWidth, myImageHeight, myImage);
|
||||
```
|
||||
|
||||
## How to render the image to NeoPixelBus
|
||||
|
Reference in New Issue
Block a user