DUDS
Distributed Update of Data from Something
BppGraphicDisplay.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2018 Jeff Jackowski
9  */
10 #ifndef BPPGRAPHICDISPLAY_HPP
11 #define BPPGRAPHICDISPLAY_HPP
12 
14 
15 namespace duds { namespace hardware { namespace display {
16 
22 protected:
36  virtual void outputFrame(const duds::ui::graphics::BppImage *img) = 0;
40  BppGraphicDisplay() = default;
46  frmbuf(dim) { }
47 public:
52  return frmbuf;
53  }
57  int width() const {
58  return frmbuf.width();
59  }
63  int height() const {
64  return frmbuf.height();
65  }
70  return frmbuf.dimensions();
71  }
80  void write(const duds::ui::graphics::BppImage *img);
89  void write(const std::shared_ptr<const duds::ui::graphics::BppImage> &img) {
90  write(img.get());
91  }
92 };
93 
94 typedef std::shared_ptr<BppGraphicDisplay> BppGraphicDisplaySptr;
95 
96 } } }
97 
98 #endif // #ifndef BPPGRAPHICDISPLAY_HPP
const ImageDimensions & dimensions() const
Returns the dimensions of the image.
Definition: BppImage.hpp:1112
int height() const
Returns the height of the frame buffer.
BppGraphicDisplay(const duds::ui::graphics::ImageDimensions &dim)
Construct with a frame buffer of the specified size.
std::int16_t width() const
Returns the width of the image.
Definition: BppImage.hpp:1100
const duds::ui::graphics::ImageDimensions & dimensions() const
Returns the dimensions of the frame buffer.
Stores the dimensions of an image.
Definition: BppImage.hpp:125
virtual void outputFrame(const duds::ui::graphics::BppImage *img)=0
Writes out the given image to the display and updates the image in frmbuf to match.
void write(const std::shared_ptr< const duds::ui::graphics::BppImage > &img)
Writes the new image to the display.
void write(const duds::ui::graphics::BppImage *img)
Writes the new image to the display.
int width() const
Returns the width of the frame buffer.
const duds::ui::graphics::BppImage & frame() const
Provides access to the image in the frame buffer.
duds::ui::graphics::BppImage frmbuf
The frame buffer.
std::shared_ptr< BppGraphicDisplay > BppGraphicDisplaySptr
Base class for bit-per-pixel graphic displays.
BppGraphicDisplay()=default
Construct with an empty frame buffer.
An image that uses a single bit to represent the state of each pixel; a black or white picture...
Definition: BppImage.hpp:321
std::int16_t height() const
Returns the height of the image.
Definition: BppImage.hpp:1106