Finished the amlogic grabber for the 'WeTek Play'

Former-commit-id: e459cdfe6273ad2bfee92d2d190801ebdc691a5c
This commit is contained in:
T.van der Zwan
2015-08-20 09:51:44 +02:00
parent 348e0c1ee8
commit 5497fbf577
11 changed files with 265 additions and 71 deletions

View File

@@ -6,8 +6,8 @@
// Utils includes
#include <utils/Image.h>
#include <utils/ColorBgr.h>
#include <utils/ColorRgb.h>
#include <utils/ColorRgba.h>
#include <utils/GrabbingMode.h>
#include <utils/VideoMode.h>
@@ -80,7 +80,7 @@ private:
QTimer _timer;
/// The image used for grabbing frames
Image<ColorRgb> _image;
Image<ColorBgr> _image;
/// The actual grabber
AmlogicGrabber * _frameGrabber;
/// The processor for transforming images to led colors

63
include/utils/ColorBgr.h Normal file
View File

@@ -0,0 +1,63 @@
#pragma once
// STL includes
#include <cstdint>
#include <iostream>
struct ColorBgr;
///
/// Plain-Old-Data structure containing the red-green-blue color specification. Size of the
/// structure is exactly 3-bytes for easy writing to led-device
///
struct ColorBgr
{
/// The blue color channel
uint8_t blue;
/// The green color channel
uint8_t green;
/// The red color channel
uint8_t red;
/// 'Black' RgbColor (0, 0, 0)
static ColorBgr BLACK;
/// 'Red' RgbColor (255, 0, 0)
static ColorBgr RED;
/// 'Green' RgbColor (0, 255, 0)
static ColorBgr GREEN;
/// 'Blue' RgbColor (0, 0, 255)
static ColorBgr BLUE;
/// 'Yellow' RgbColor (255, 255, 0)
static ColorBgr YELLOW;
/// 'White' RgbColor (255, 255, 255)
static ColorBgr WHITE;
};
/// Assert to ensure that the size of the structure is 'only' 3 bytes
static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorRgb");
///
/// Stream operator to write ColorRgb to an outputstream (format "'{'[red]','[green]','[blue]'}'")
///
/// @param os The output stream
/// @param color The color to write
/// @return The output stream (with the color written to it)
///
inline std::ostream& operator<<(std::ostream& os, const ColorBgr& color)
{
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
return os;
}
/// Compare operator to check if a color is 'smaller' than another color
inline bool operator<(const ColorBgr & lhs, const ColorBgr & rhs)
{
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
}
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
inline bool operator<=(const ColorBgr & lhs, const ColorBgr & rhs)
{
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
}