FastLED 3.9.15
Loading...
Searching...
No Matches

◆ getPixelFromFrame()

CRGB CodecProcessor::getPixelFromFrame ( const fl::Frame & frame,
int x,
int y )

Definition at line 230 of file codec_processor.cpp.

230 {
231 if (x >= (int)frame.getWidth() || y >= (int)frame.getHeight() || !frame.isValid()) {
232 return CRGB::Black;
233 }
234
235 int pixelIndex = y * (int)frame.getWidth() + x;
236
237 // Frame stores data as CRGB
238 if (pixelIndex < (int)frame.size()) {
239 return frame.rgb()[pixelIndex];
240 }
241
242 return CRGB::Black;
243}
int y
Definition simple.h:93
int x
Definition simple.h:92
size_t size() const
Definition frame.h:44
fl::u16 getWidth() const
Definition frame.h:59
fl::span< CRGB > rgb()
Definition frame.h:42
fl::u16 getHeight() const
Definition frame.h:60
bool isValid() const
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:510

References fl::CRGB::Black, fl::Frame::getHeight(), fl::Frame::getWidth(), fl::Frame::isValid(), fl::Frame::rgb(), fl::Frame::size(), x, and y.

Referenced by displayFrameOnLEDs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: