Changed RgbImage to template based Image (with template for pixel type)

Former-commit-id: ef02f164eaf3c2f9dd552c1c17b525cf6eed499c
This commit is contained in:
T. van der Zwan
2013-11-11 09:00:37 +00:00
parent 90f1f282e2
commit dd16af0df5
58 changed files with 593 additions and 464 deletions

View File

@@ -1,4 +1,9 @@
// STL includes
#include <cassert>
#include <iostream>
// Local includes
#include "DispmanxFrameGrabber.h"
DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned height) :
@@ -32,7 +37,7 @@ DispmanxFrameGrabber::DispmanxFrameGrabber(const unsigned width, const unsigned
// Create the resources for capturing image
uint32_t vc_nativeImageHandle;
_vc_resource = vc_dispmanx_resource_create(
VC_IMAGE_RGB888,
VC_IMAGE_RGBA32,
width,
height,
&vc_nativeImageHandle);
@@ -56,7 +61,7 @@ void DispmanxFrameGrabber::setFlags(const int vc_flags)
_vc_flags = vc_flags;
}
void DispmanxFrameGrabber::grabFrame(RgbImage& image)
void DispmanxFrameGrabber::grabFrame(Image<ColorRgba> & image)
{
// Sanity check of the given image size
assert(image.width() == _width && image.height() == _height);
@@ -69,7 +74,7 @@ void DispmanxFrameGrabber::grabFrame(RgbImage& image)
// Read the snapshot into the memory
void* image_ptr = image.memptr();
const unsigned destPitch = _width * 3;
const unsigned destPitch = _width * sizeof(ColorRgba);
vc_dispmanx_resource_read_data(_vc_resource, &_rectangle, image_ptr, destPitch);
// Close the displaye

View File

@@ -8,7 +8,8 @@
#include <cstdint>
// Utils includes
#include <utils/RgbImage.h>
#include <utils/Image.h>
#include <utils/ColorRgba.h>
///
/// The DispmanxFrameGrabber is used for creating snapshots of the display (screenshots) with a
@@ -41,7 +42,7 @@ public:
/// @param[out] image The snapped screenshot (should be initialized with correct width and
/// height)
///
void grabFrame(RgbImage& image);
void grabFrame(Image<ColorRgba> & image);
private:
/// Handle to the display that is being captured

View File

@@ -20,7 +20,7 @@ DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHe
_image(grabWidth, grabHeight),
_frameGrabber(new DispmanxFrameGrabber(grabWidth, grabHeight)),
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
_ledColors(hyperion->getLedCount(), RgbColor::BLACK),
_ledColors(hyperion->getLedCount(), ColorRgb{0,0,0}),
_hyperion(hyperion)
{
// Configure the timer to generate events every n milliseconds