Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
NeoBufferContext.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2 NeoBufferContext
3 
4 Written by Michael C. Miller.
5 
6 I invest time and resources providing this open source code,
7 please support me by dontating (see https://github.com/Makuna)
8 
9 -------------------------------------------------------------------------
10 This file is part of the LUMITRONIX_iFlex_Workshop library.
11 
12 LumitronixIFlexBus is free software: you can redistribute it and/or modify
13 it under the terms of the GNU Lesser General Public License as
14 published by the Free Software Foundation, either version 3 of
15 the License, or (at your option) any later version.
16 
17 LumitronixIFlexBus is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU Lesser General Public License for more details.
21 
22 You should have received a copy of the GNU Lesser General Public
23 License along with LumitronixIFlex. If not, see
24 <http://www.gnu.org/licenses/>.
25 -------------------------------------------------------------------------*/
26 #pragma once
27 
28 // This is used to allow a template classes that share common buffer concept to
29 // be able to pass that common information to functions
30 // The template classes just need to expose a conversion operator to this type
31 template <typename T_COLOR_FEATURE> struct NeoBufferContext
32 {
33  NeoBufferContext(uint8_t* pixels,
34  size_t sizePixels) :
35  Pixels(pixels),
36  SizePixels(sizePixels)
37  {
38  }
39 
40  uint16_t PixelCount() const
41  {
42  return SizePixels / T_COLOR_FEATURE::PixelSize;
43  };
44 
45  uint8_t* Pixels;
46  const size_t SizePixels;
47 
48 };
Definition: NeoBufferContext.h:32
uint8_t * Pixels
Definition: NeoBufferContext.h:43
uint16_t PixelCount() const
Definition: NeoBufferContext.h:40
NeoBufferContext(uint8_t *pixels, size_t sizePixels)
Definition: NeoBufferContext.h:33
const size_t SizePixels
Definition: NeoBufferContext.h:46