|
DUDS
|
Distributed Update of Data from Something
|
An image that uses a single bit to represent the state of each pixel; a black or white picture. More...
#include <BppImage.hpp>
Classes | |
| class | ConstPixel |
| A forward iterator like class that visits each location of the image or a subset of the image. More... | |
| struct | EndPixel |
| Can be used as an end iterator to avoid making a whole iterator. More... | |
| class | Pixel |
| A forward and output iterator that visits each location of the image. More... | |
Public Types | |
| enum | Direction { HorizInc, VertInc, HorizDec, VertDec, Rotate0DCCW = HorizInc, Rotate90DCCW = VertInc, Rotate180DCCW = HorizDec, Rotate270DCCW = VertDec } |
| Controls the direction ConstPixel and Pixel objects will move across the image when the object is incremented. More... | |
| enum | Operation { OpSet, OpNot, OpAnd, OpOr, OpXor, OpTotal } |
| Tells how to modify the destination pixel with the source pixel data. More... | |
| typedef std::uintptr_t | PixelBlock |
| The type used to hold pixel values, one bit per pixel. More... | |
Public Member Functions | |
| BppImage () | |
| Make an empty image with zero size. More... | |
| BppImage (const ImageDimensions &id) | |
| Makes an image of the requested size with uninitialized image data. More... | |
| BppImage (int width, int height) | |
| Makes an image of the requested size with uninitialized image data. More... | |
| BppImage (BppImage &&mv) | |
| Move constructor. More... | |
| BppImage (const BppImage &src) | |
| Copy constructor. More... | |
| BppImage (const char *data) | |
| Copies constant image data into a new image. More... | |
| BppImage (const std::vector< char > &data) | |
| Copies constant image data into a new image with run-time bounds checks on accesses to data. More... | |
| Pixel | begin () |
| Returns a Pixel (iterator) to the upper left of the image. More... | |
| Pixel | begin (Direction dir) |
| Returns a Pixel (iterator) to the start of the image for the given direction. More... | |
| Pixel | begin (const ImageLocation &origin, const ImageDimensions &size, Direction dir=HorizInc) |
| Returns a Pixel (iterator) to the start of a subset the image for the given direction. More... | |
| ConstPixel | begin () const |
| Returns a ConstPixel (iterator) to the upper left of the image. More... | |
| void | blankImage (bool state) |
| Changes the state of every pixel in the image to the given state. More... | |
| int | blocksPerLine () const |
| Returns the number of PixelBlock objects per row in the image data. More... | |
| const PixelBlock * | buffer () const |
| Retuns a pointer to the start of image data. More... | |
| PixelBlock * | buffer () |
| Retuns a pointer to the start of image data. More... | |
| const PixelBlock * | bufferLine (int py) const |
| Returns a pointer to the start of the given line. More... | |
| PixelBlock * | bufferLine (int py) |
| Returns a pointer to the start of the given line. More... | |
| std::size_t | bufferSize () const |
| Returns the number of PixelBlocks, not bytes, that make up the image buffer. More... | |
| void | bufferSpot (PixelBlock *(&addr), PixelBlock &mask, const ImageLocation &il) |
| Provides the location of the specified pixel inside the image data. More... | |
| void | bufferSpot (PixelBlock *(&addr), PixelBlock &mask, int x, int y) |
| Provides the location of the specified pixel inside the image data. More... | |
| void | bufferSpot (const PixelBlock *(&addr), PixelBlock &mask, const ImageLocation &il) const |
| Provides the location of the specified pixel inside the image data. More... | |
| ConstPixel | cbegin () const |
| Returns a ConstPixel (iterator) to the upper left of the image. More... | |
| ConstPixel | cbegin (Direction dir) const |
| Returns a ConstPixel (iterator) to the start of the image for the given direction. More... | |
| ConstPixel | cbegin (const ImageLocation &origin, const ImageDimensions &size, Direction dir=HorizInc) const |
| Returns a ConstPixel (iterator) to the start of a subset the image for the given direction. More... | |
| void | clear () |
| Removes all image data. More... | |
| void | clearImage () |
| Clears every pixel (change to false) in the image. More... | |
| void | clearLines (int start, int height) |
| Clears all the pixles of the given contiguous horizontal lines. More... | |
| void | clearPixel (const ImageLocation &il) |
| Changes the state of a pixel to clear (false). More... | |
| void | clearPixel (int x, int y) |
| Changes the state of a pixel to clear (false). More... | |
| ConstPixel | cpixel (const ImageLocation &il, Direction dir=HorizInc) const |
| Returns a ConstPixel (iterator) to iterate across the image starting from the given location. More... | |
| ConstPixel | cpixel (int x, int y, Direction dir=HorizInc) const |
| Returns a ConstPixel (iterator) to iterate across the image starting from the given location. More... | |
| const std::vector< PixelBlock > & | data () const |
| Provides access to the internal vector storing the image data. More... | |
| const ImageDimensions & | dimensions () const |
| Returns the dimensions of the image. More... | |
| void | drawBox (ImageLocation ul, ImageDimensions id, Operation op=OpSet) |
| Draws a box into this image. More... | |
| void | drawBox (ImageLocation ul, ImageDimensions id, bool state) |
| Draws a box into this image. More... | |
| void | drawBox (int x, int y, int w, int h=1, Operation op=OpSet) |
| Draws a box into this image. More... | |
| void | drawBox (int x, int y, int w, int h, bool state) |
| Draws a box into this image. More... | |
| bool | empty () const |
| Returns true if there is no image data. More... | |
| Pixel | end () |
| Returns a Pixel end iterator. More... | |
| ConstPixel | end () const |
| Returns a ConstPixel end iterator. More... | |
| std::int16_t | height () const |
| Returns the height of the image. More... | |
| void | invert () |
| Toggles the state of all pixels. More... | |
| void | invertLines (int start, int height) |
| Toggles the state of all pixels of the given contiguous horizontal lines. More... | |
| bool | invertPixel (const ImageLocation &il) |
| Toggles the state of a pixel. More... | |
| bool | invertPixel (int x, int y) |
| Toggles the state of a pixel. More... | |
| ConstPixel | operator() (int x, int y) const |
| Returns a ConstPixel (iterator) to inspect the given pixel and to iterate across the image starting from the given location. More... | |
| BppImage & | operator= (BppImage &&mv) |
| Move assignment. More... | |
| BppImage & | operator= (const BppImage &src) |
| Copy assignment. More... | |
| bool | operator== (const BppImage &other) const |
| Returns true if the contents of the two images are identical. More... | |
| void | patternLines (int start, int height, PixelBlock val) |
| Writes a pattern of pixles to a set of contiguous horizontal lines. More... | |
| Pixel | pixel (const ImageLocation &il, Direction dir=HorizInc) |
| Returns a Pixel (iterator) to iterate across the image starting from the given location. More... | |
| Pixel | pixel (int x, int y, Direction dir=HorizInc) |
| Returns a Pixel (iterator) to iterate across the image starting from the given location. More... | |
| void | resize (const duds::ui::graphics::ImageDimensions &newdim) |
| Changes the size of the image. More... | |
| void | resize (int width, int height) |
| Changes the size of the image. More... | |
| void | setImage () |
| Sets every pixel (set to true) in the image. More... | |
| void | setLines (int start, int height) |
| Sets all the pixles of the given contiguous horizontal lines. More... | |
| void | setPixel (const ImageLocation &il) |
| Changes the state of a pixel to set (true). More... | |
| void | setPixel (int x, int y) |
| Changes the state of a pixel to set (true). More... | |
| int | size () const |
| Returns the number of pixels that make up the image. More... | |
| ImageLocation | startPosition (Direction dir=HorizInc) const |
| Returns the starting location needed to iterate over the entire image in the given direction. More... | |
| bool | state (const ImageLocation &il) const |
| Returns the state of the image pixel of the requested location. More... | |
| bool | state (int x, int y) const |
| Returns the state of the image pixel of the requested location. More... | |
| void | state (const ImageLocation &il, bool s) |
| Changes the state of a pixel. More... | |
| void | state (int x, int y, bool s) |
| Changes the state of a pixel. More... | |
| void | swap (BppImage &other) |
| Swap two images. More... | |
| std::int16_t | width () const |
| Returns the width of the image. More... | |
| void | write (const BppImage *const src, const ImageLocation &destLoc, const ImageLocation &srcLoc, const ImageDimensions &srcSize, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes the specified portion of the source into this image. More... | |
| void | write (const BppImage *const src, const ImageLocation &destLoc, const ImageDimensions &srcSize, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes a portion of the source image, starting from (0, 0), into this image. More... | |
| void | write (const std::shared_ptr< const BppImage > &src, const ImageLocation &destLoc, const ImageLocation &srcLoc, const ImageDimensions &srcSize, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes the specified portion of the source into this image. More... | |
| void | write (const std::shared_ptr< const BppImage > src, const ImageLocation &destLoc, const ImageDimensions &srcSize, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes a portion of the source image, starting from (0, 0), into this image. More... | |
| void | write (const BppImage *const src, const ImageLocation &dest, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes as much of the given source image as will fit into this image. More... | |
| void | write (const std::shared_ptr< const BppImage > &src, const ImageLocation &dest, Direction srcDir=HorizInc, Operation op=OpSet) |
| Writes as much of the given source image as will fit into this image. More... | |
Static Public Member Functions | |
| static constexpr std::size_t | bufferBlockSize (int w, int h) |
| Returns the size of an image buffer as the number of PixelBlock PixelBlocks needed to store an image of the specified size. More... | |
| static constexpr int | bufferBlocksPerLine (int width) |
| Returns the number of PixelBlock objects that will be used for each horizontal line of an image of the indicated width. More... | |
| static constexpr int | bufferBlocksPerLine (ImageDimensions dim) |
| Returns the number of PixelBlock objects that will be used for each horizontal line of an image of the indicated width. More... | |
| static constexpr std::size_t | bufferByteSize (int w, int h) |
| Returns the size of an image buffer in bytes needed for the specified image size. More... | |
| static constexpr ConstPixel | cend () |
| Returns a ConstPixel end iterator. More... | |
| static EndPixel | endPixel () |
| Convenience function that returns EndPixel, which can be used as an end iterator with any ConstPixel or Pixel object, regardless what BppImage object they are working upon. More... | |
| static std::shared_ptr< BppImage > | make (const ImageDimensions &id) |
| Convenience function to make a shared pointer to an image using the BppImage(const ImageDimensions &) constructor. More... | |
| static std::shared_ptr< BppImage > | make (int width, int height) |
| Convenience function to make a shared pointer to an image using the BppImage(int, int) constructor. More... | |
| static std::shared_ptr< BppImage > | make (const char *data) |
| Convenience function to make a shared pointer to an image using the BppImage(const char *) constructor. More... | |
| static std::shared_ptr< BppImage > | make (const std::vector< char > &data) |
| Convenience function to make a shared pointer to an image using the BppImage(const std::vector<char> &) constructor. More... | |
| static ImageLocation | startPosition (const ImageLocation &origin, const ImageDimensions &size, Direction dir=HorizInc) |
| Returns the starting location needed to iterate over the specified subeset of an image in the given direction. More... | |
Private Types | |
| typedef bool(* | OpBitFunction) (bool dest, bool src) |
| typedef void(* | OpFunction) (PixelBlock *dest, const PixelBlock &src, const PixelBlock &mask) |
Private Attributes | |
| int | blkPerLine |
| Number of PixelBlocks used for each horizontal line. More... | |
| ImageDimensions | dim |
| The dimensions of the image. More... | |
| std::vector< PixelBlock > | img |
| The image data. More... | |
Static Private Attributes | |
| static const OpBitFunction | OpBitFunctions [OpTotal] |
| Functions implementing the operations listed in Operation one bit at a time. More... | |
| static const OpFunction | OpFunctions [OpTotal] |
| Functions implementing the operations listed in Operation one PixelBlock at a time. More... | |
An image that uses a single bit to represent the state of each pixel; a black or white picture.
The image data is stored as a vector of PixelBlock objects. These are pointer-sized integers. The LSb of the first PixelBlock represents the left-most pixel of the top-most row. Each succesive bit and PixelBlock moves to the right. PixelBlocks do not span rows, so unused space will fill the higher value bits of the right-most PixelBlock at the end of each row.
Definition at line 321 of file BppImage.hpp.
|
private |
Definition at line 1553 of file BppImage.hpp.
|
private |
Definition at line 1560 of file BppImage.hpp.
| typedef std::uintptr_t duds::ui::graphics::BppImage::PixelBlock |
The type used to hold pixel values, one bit per pixel.
Definition at line 326 of file BppImage.hpp.
Controls the direction ConstPixel and Pixel objects will move across the image when the object is incremented.
The direction will be the reverse when decremented. All options are HorizInc rotated by a multiple of 90 degrees. They are given in clockwise order by where the iterator starts to iterate over the whole image. However, the order is conuter-colockwise for the results of the write() functions.
Definition at line 386 of file BppImage.hpp.
Tells how to modify the destination pixel with the source pixel data.
Definition at line 1521 of file BppImage.hpp.
|
inline |
Make an empty image with zero size.
Definition at line 965 of file BppImage.hpp.
| duds::ui::graphics::BppImage::BppImage | ( | const ImageDimensions & | id | ) |
Makes an image of the requested size with uninitialized image data.
Definition at line 28 of file BppImage.cpp.
|
inline |
Makes an image of the requested size with uninitialized image data.
Definition at line 973 of file BppImage.hpp.
| duds::ui::graphics::BppImage::BppImage | ( | BppImage && | mv | ) |
Move constructor.
Definition at line 33 of file BppImage.cpp.
| duds::ui::graphics::BppImage::BppImage | ( | const BppImage & | src | ) |
Copy constructor.
Definition at line 39 of file BppImage.cpp.
| duds::ui::graphics::BppImage::BppImage | ( | const char * | data | ) |
Copies constant image data into a new image.
This is intended for use with the output of the Bit-Per-Pixel Image Compiler (bppic). The BppImageArchive uses this constructor with data from an archive made by bppic, and it can be used directly with the const char arrays from the C++ output of bppic.
| data | The source data. It starts with the width and height, in that order. Both are two bytes in little endian form. Following that is the image data. The LSb of each byte is for the pixel furthest left in the byte. If the width is not evenly divisible by 8, the last byte of each line will contain unused bits. Each line of the image will start on a new byte. |
Definition at line 42 of file BppImage.cpp.
| duds::ui::graphics::BppImage::BppImage | ( | const std::vector< char > & | data | ) |
Copies constant image data into a new image with run-time bounds checks on accesses to data.
| data | The source data. It starts with the width and height, in that order. Both are two bytes in little endian form. Following that is the image data. The LSb of each byte is for the pixel furthest left in the byte. If the width is not evenly divisible by 8, the last byte of each line will contain unused bits. Each line of the image will start on a new byte. |
| ImageTruncatedError | The provided data was too short. Either there isn't enough data for the smallest possible image, or the indicated dimensions require more data. |
Definition at line 63 of file BppImage.cpp.
| BppImage::Pixel duds::ui::graphics::BppImage::begin | ( | ) |
Returns a Pixel (iterator) to the upper left of the image.
Definition at line 249 of file BppImage.cpp.
Referenced by write().
| BppImage::Pixel duds::ui::graphics::BppImage::begin | ( | Direction | dir | ) |
Returns a Pixel (iterator) to the start of the image for the given direction.
Different directions start in a different location, but will iterate over the whole image.
Definition at line 256 of file BppImage.cpp.
| BppImage::Pixel duds::ui::graphics::BppImage::begin | ( | const ImageLocation & | origin, |
| const ImageDimensions & | size, | ||
| Direction | dir = HorizInc |
||
| ) |
Returns a Pixel (iterator) to the start of a subset the image for the given direction.
Different directions and subsets start in different locations, but will iterate over the entire subset of the image.
| origin | The origin (top left); used to limit the iteration to a subset of the image data. The top left location is not modified by the iteration direction dir. The area to iterate over must exist within the source image. |
| size | The size of the image to iterate over. This is used to limit the iteration to a subset of the image data. The axes for width and height are not modified by the iteration direction dir. The area to iterate over must exist within the source image. |
| dir | The direction of the iteration as defined in the enum Direction. |
Definition at line 263 of file BppImage.cpp.
|
inline |
Returns a ConstPixel (iterator) to the upper left of the image.
Definition at line 1360 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::blankImage | ( | bool | state | ) |
Changes the state of every pixel in the image to the given state.
Definition at line 340 of file BppImage.cpp.
|
inline |
Returns the number of PixelBlock objects per row in the image data.
Definition at line 1167 of file BppImage.hpp.
Referenced by drawBox(), and operator==().
| const BppImage::PixelBlock * duds::ui::graphics::BppImage::buffer | ( | ) | const |
Retuns a pointer to the start of image data.
| ImageZeroSizeError |
Definition at line 138 of file BppImage.cpp.
|
inline |
Retuns a pointer to the start of image data.
| ImageZeroSizeError |
Definition at line 1124 of file BppImage.hpp.
|
inlinestatic |
Returns the size of an image buffer as the number of PixelBlock PixelBlocks needed to store an image of the specified size.
Definition at line 347 of file BppImage.hpp.
Referenced by BppImage(), and resize().
|
inlinestatic |
Returns the number of PixelBlock objects that will be used for each horizontal line of an image of the indicated width.
There may be unused space in the more significant bits of the last PixelBlock in the line.
Definition at line 363 of file BppImage.hpp.
Referenced by BppImage(), and resize().
|
inlinestatic |
Returns the number of PixelBlock objects that will be used for each horizontal line of an image of the indicated width.
There may be unused space in the more significant bits of the last PixelBlock in the line.
Definition at line 372 of file BppImage.hpp.
|
inlinestatic |
Returns the size of an image buffer in bytes needed for the specified image size.
Definition at line 355 of file BppImage.hpp.
| const BppImage::PixelBlock * duds::ui::graphics::BppImage::bufferLine | ( | int | py | ) | const |
Returns a pointer to the start of the given line.
| py | The Y-coordinate of the line. |
| ImageBoundsError | The given location is out of bounds. To satisfy C++ iterator requirements, one past the end will not throw, but should not be dereferenced. |
Definition at line 175 of file BppImage.cpp.
Referenced by BppImage(), invertLines(), duds::hardware::devices::displays::SimulatedBppDisplay::outputFrame(), duds::hardware::devices::displays::ST7920::outputFrame(), and patternLines().
|
inline |
Returns a pointer to the start of the given line.
| py | The Y-coordinate of the line. |
| ImageBoundsError | The given location is out of bounds. To satisfy C++ iterator requirements, one past the end will not throw, but should not be dereferenced. |
Definition at line 1159 of file BppImage.hpp.
|
inline |
Returns the number of PixelBlocks, not bytes, that make up the image buffer.
This result includes space allocated but not used for the image data.
Definition at line 1088 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::bufferSpot | ( | PixelBlock *& | addr, |
| PixelBlock & | mask, | ||
| const ImageLocation & | il | ||
| ) |
Provides the location of the specified pixel inside the image data.
A class for the result of bufferSpot() is not provided because it is more useful when combined with a coordinate, and the ConstPixel and Pixel classes do that.
| addr | The address of the PixelBlock that contains the requested pixel. |
| mask | A bitmask that will be set to identify the pixel inside the PixelBlock. |
| il | The location to find within the image data. |
| ImageBoundsError | The given location is out of bounds. |
Definition at line 185 of file BppImage.cpp.
Referenced by duds::ui::graphics::BppImage::ConstPixel::ConstPixel(), invertPixel(), duds::ui::graphics::BppImage::ConstPixel::location(), duds::ui::graphics::BppImage::ConstPixel::operator++(), duds::ui::graphics::BppImage::ConstPixel::origdimloc(), duds::ui::graphics::BppImage::ConstPixel::origin(), and state().
|
inline |
Provides the location of the specified pixel inside the image data.
A class for the result of bufferSpot() is not provided because it is more useful when combined with a coordinate, and the ConstPixel and Pixel classes do that.
| addr | The address of the PixelBlock that contains the requested pixel. |
| mask | A bitmask that will be set to identify the pixel inside the PixelBlock. |
| x | The X coordinate. |
| y | The Y coordinate. |
| ImageBoundsError | The given location is out of bounds. |
Definition at line 1200 of file BppImage.hpp.
|
inline |
Provides the location of the specified pixel inside the image data.
A class for the result of bufferSpot() is not provided because it is more useful when combined with a coordinate, and the ConstPixel and Pixel classes do that.
| addr | The address of the PixelBlock that contains the requested pixel. |
| mask | A bitmask that will be set to identify the pixel inside the PixelBlock. |
| il | The location to find within the image data. |
| ImageBoundsError | The given location is out of bounds. |
Definition at line 1215 of file BppImage.hpp.
| BppImage::ConstPixel duds::ui::graphics::BppImage::cbegin | ( | ) | const |
Returns a ConstPixel (iterator) to the upper left of the image.
Definition at line 274 of file BppImage.cpp.
Referenced by write().
| BppImage::ConstPixel duds::ui::graphics::BppImage::cbegin | ( | Direction | dir | ) | const |
Returns a ConstPixel (iterator) to the start of the image for the given direction.
Different directions start in a different location, but will iterate over the whole image.
Definition at line 281 of file BppImage.cpp.
| BppImage::ConstPixel duds::ui::graphics::BppImage::cbegin | ( | const ImageLocation & | origin, |
| const ImageDimensions & | size, | ||
| Direction | dir = HorizInc |
||
| ) | const |
Returns a ConstPixel (iterator) to the start of a subset the image for the given direction.
Different directions and subsets start in different locations, but will iterate over the entire subset of the image.
| origin | The origin (top left); used to limit the iteration to a subset of the image data. The top left location is not modified by the iteration direction dir. The area to iterate over must exist within the source image. |
| size | The size of the image to iterate over. This is used to limit the iteration to a subset of the image data. The axes for width and height are not modified by the iteration direction dir. The area to iterate over must exist within the source image. |
| dir | The direction of the iteration as defined in the enum Direction. |
Definition at line 288 of file BppImage.cpp.
|
inlinestatic |
Returns a ConstPixel end iterator.
It can be used as an end iterator with any ConstPixel, regardless of the source BppImage object in use. It is less efficient than using an EndPixel object, but its constexpr status should mitigate this compared to using the non-const end().
Definition at line 1382 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::clear | ( | ) |
Removes all image data.
Definition at line 117 of file BppImage.cpp.
Referenced by resize().
|
inline |
Clears every pixel (change to false) in the image.
Definition at line 1509 of file BppImage.hpp.
Referenced by duds::hardware::devices::displays::ST7920::initialize().
|
inline |
Clears all the pixles of the given contiguous horizontal lines.
| start | The first horizontal line (y-coordinate) to write. |
| height | The number of lines to write. |
Definition at line 1496 of file BppImage.hpp.
|
inline |
Changes the state of a pixel to clear (false).
| il | The location to change. |
Definition at line 1426 of file BppImage.hpp.
|
inline |
Changes the state of a pixel to clear (false).
| x | Horizontal coordinate to change. |
| y | Vertical coordinate to change. |
Definition at line 1434 of file BppImage.hpp.
| BppImage::ConstPixel duds::ui::graphics::BppImage::cpixel | ( | const ImageLocation & | il, |
| Direction | dir = HorizInc |
||
| ) | const |
Returns a ConstPixel (iterator) to iterate across the image starting from the given location.
The whole image will be traversed, save for what came before the given location.
| il | The starting location. |
| dir | The direction of iteration. |
Definition at line 235 of file BppImage.cpp.
|
inline |
Returns a ConstPixel (iterator) to iterate across the image starting from the given location.
The whole image will be traversed, save for what came before the given location.
| x | The horizontal starting location. |
| y | The vertical starting location. |
| dir | The direction of iteration. |
Definition at line 1282 of file BppImage.hpp.
|
inline |
Provides access to the internal vector storing the image data.
Definition at line 1133 of file BppImage.hpp.
Referenced by BppImage().
|
inline |
Returns the dimensions of the image.
Definition at line 1112 of file BppImage.hpp.
Referenced by duds::hardware::display::BppGraphicDisplay::dimensions(), duds::ui::graphics::BppImage::ConstPixel::dimensions(), duds::hardware::devices::displays::ST7920::initialize(), duds::ui::graphics::MaxExtent(), duds::ui::graphics::BppImage::ConstPixel::origdimloc(), duds::ui::graphics::BppImage::ConstPixel::origin(), duds::ui::graphics::PriorityGridLayout::render(), duds::hardware::display::BppGraphicDisplay::write(), and write().
| void duds::ui::graphics::BppImage::drawBox | ( | ImageLocation | ul, |
| ImageDimensions | id, | ||
| Operation | op = OpSet |
||
| ) |
Draws a box into this image.
| ul | The upper-left location of the box. |
| id | The dimensions of the box. |
| op | The bit-wise operation to perform to draw the box. One operand will be the image data, and the other will always be set bit(s). This means that OpSet will change pixels to true (set), OpNot will change pixels to false (clear), and OpXor will toggle (invert) pixels. |
| ImageBoundsError | The box extends beyond the bounds of the image. |
Definition at line 485 of file BppImage.cpp.
Referenced by duds::ui::graphics::BppPositionIndicator::render().
|
inline |
Draws a box into this image.
| ul | The upper-left location of the box. |
| id | The dimensions of the box. |
| state | The pixel state to write. |
| ImageBoundsError | The box extends beyond the bounds of the image. |
Definition at line 1718 of file BppImage.hpp.
|
inline |
Draws a box into this image.
| x | The upper-left horizontal coordinate of the box. |
| y | The upper-left vertical coordinate of the box. |
| w | The width of the box. |
| h | The height of the box. |
| op | The bit-wise operation to perform to draw the box. One operand will be the image data, and the other will always be set bit(s). This means that OpSet will change pixels to true (set), OpNot will change pixels to false (clear), and OpXor will toggle (invert) pixels. |
| ImageBoundsError | The box extends beyond the bounds of the image. |
Definition at line 1739 of file BppImage.hpp.
|
inline |
Draws a box into this image.
| x | The upper-left horizontal coordinate of the box. |
| y | The upper-left vertical coordinate of the box. |
| w | The width of the box. |
| h | The height of the box. |
| state | The pixel state to write. |
| ImageBoundsError | The box extends beyond the bounds of the image. |
Definition at line 1758 of file BppImage.hpp.
|
inline |
Returns true if there is no image data.
Definition at line 1080 of file BppImage.hpp.
| Pixel duds::ui::graphics::BppImage::end | ( | ) |
Returns a Pixel end iterator.
This is less efficient than using an EndPixel object, but is more consistent with how iterators are used.
Referenced by invertLines(), and patternLines().
|
inline |
Returns a ConstPixel end iterator.
It can be used as an end iterator with any ConstPixel, regardless of the source BppImage object in use. It is less efficient than using an EndPixel object, but its constexpr status should mitigate this compared to using the non-const end().
Definition at line 1391 of file BppImage.hpp.
|
inlinestatic |
Convenience function that returns EndPixel, which can be used as an end iterator with any ConstPixel or Pixel object, regardless what BppImage object they are working upon.
Definition at line 1368 of file BppImage.hpp.
|
inline |
Returns the height of the image.
Definition at line 1106 of file BppImage.hpp.
Referenced by duds::hardware::display::BppGraphicDisplay::height().
| void duds::ui::graphics::BppImage::invert | ( | ) |
Toggles the state of all pixels.
Definition at line 320 of file BppImage.cpp.
| void duds::ui::graphics::BppImage::invertLines | ( | int | start, |
| int | height | ||
| ) |
Toggles the state of all pixels of the given contiguous horizontal lines.
| start | The first horizontal line (y-coordinate) to invert. |
| height | The number of lines to invert. |
Definition at line 326 of file BppImage.cpp.
| bool duds::ui::graphics::BppImage::invertPixel | ( | const ImageLocation & | il | ) |
Toggles the state of a pixel.
| il | The location to toggle. |
Definition at line 313 of file BppImage.cpp.
|
inline |
Toggles the state of a pixel.
| x | Horizontal coordinate to toggle. |
| y | Vertical coordinate to toggle. |
Definition at line 1462 of file BppImage.hpp.
|
inlinestatic |
Convenience function to make a shared pointer to an image using the BppImage(const ImageDimensions &) constructor.
Definition at line 1018 of file BppImage.hpp.
Referenced by duds::ui::graphics::BppFont::render(), and duds::ui::menu::renderers::BppMenuRenderer::render().
|
inlinestatic |
Convenience function to make a shared pointer to an image using the BppImage(int, int) constructor.
Definition at line 1025 of file BppImage.hpp.
|
inlinestatic |
Convenience function to make a shared pointer to an image using the BppImage(const char *) constructor.
Definition at line 1032 of file BppImage.hpp.
|
inlinestatic |
Convenience function to make a shared pointer to an image using the BppImage(const std::vector<char> &) constructor.
Definition at line 1039 of file BppImage.hpp.
|
inline |
Returns a ConstPixel (iterator) to inspect the given pixel and to iterate across the image starting from the given location.
The whole image will be traversed, save for what came before the given location.
| x | The horizontal starting location. |
| y | The vertical starting location. |
Definition at line 1292 of file BppImage.hpp.
Move assignment.
Definition at line 95 of file BppImage.cpp.
Copy assignment.
Definition at line 104 of file BppImage.cpp.
| bool duds::ui::graphics::BppImage::operator== | ( | const BppImage & | other | ) | const |
Returns true if the contents of the two images are identical.
Definition at line 145 of file BppImage.cpp.
| void duds::ui::graphics::BppImage::patternLines | ( | int | start, |
| int | height, | ||
| PixelBlock | val | ||
| ) |
Writes a pattern of pixles to a set of contiguous horizontal lines.
| start | The first horizontal line (y-coordinate) to write. |
| height | The number of lines to write. |
| val | The value, or pattern, of pixels to write. The pattern may extend past the right side boundry of the image. |
Definition at line 333 of file BppImage.cpp.
| BppImage::Pixel duds::ui::graphics::BppImage::pixel | ( | const ImageLocation & | il, |
| Direction | dir = HorizInc |
||
| ) |
Returns a Pixel (iterator) to iterate across the image starting from the given location.
The whole image will be traversed, save for what came before the given location.
| il | The starting location. |
| dir | The direction of iteration. |
Definition at line 224 of file BppImage.cpp.
Returns a Pixel (iterator) to iterate across the image starting from the given location.
The whole image will be traversed, save for what came before the given location.
| x | The horizontal starting location. |
| y | The vertical starting location. |
| dir | The direction of iteration. |
Definition at line 1263 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::resize | ( | const duds::ui::graphics::ImageDimensions & | newdim | ) |
Changes the size of the image.
| newdim | The new image dimensions. |
| ImageBoundsError | A negative dimension was provided. |
Definition at line 123 of file BppImage.cpp.
Referenced by duds::hardware::devices::displays::SimulatedBppDisplay::configure(), and duds::hardware::devices::displays::ST7920::configure().
|
inline |
Changes the size of the image.
| width | The new width of the image. |
| height | The new height of the image. |
| ImageBoundsError | A negative dimension was provided. |
Definition at line 1074 of file BppImage.hpp.
|
inline |
Sets every pixel (set to true) in the image.
Definition at line 1515 of file BppImage.hpp.
Referenced by duds::hardware::devices::displays::ST7920::initialize().
|
inline |
Sets all the pixles of the given contiguous horizontal lines.
| start | The first horizontal line (y-coordinate) to write. |
| height | The number of lines to write. |
Definition at line 1488 of file BppImage.hpp.
|
inline |
Changes the state of a pixel to set (true).
| il | The location to change. |
Definition at line 1441 of file BppImage.hpp.
|
inline |
Changes the state of a pixel to set (true).
| x | Horizontal coordinate to change. |
| y | Vertical coordinate to change. |
Definition at line 1449 of file BppImage.hpp.
|
inline |
Returns the number of pixels that make up the image.
Definition at line 1094 of file BppImage.hpp.
Referenced by bufferSize().
| ImageLocation duds::ui::graphics::BppImage::startPosition | ( | Direction | dir = HorizInc | ) | const |
Returns the starting location needed to iterate over the entire image in the given direction.
| dir | The iteration direction. Each direction starts at a different corner of the image. |
Definition at line 201 of file BppImage.cpp.
|
static |
Returns the starting location needed to iterate over the specified subeset of an image in the given direction.
| origin | The origin; the top left of the image subset. |
| size | The size of the image subset extending from the origin. |
| dir | The iteration direction. Each direction starts at a different corner of the image. |
Definition at line 205 of file BppImage.cpp.
| bool duds::ui::graphics::BppImage::state | ( | const ImageLocation & | il | ) | const |
Returns the state of the image pixel of the requested location.
| il | The location to query. |
Definition at line 299 of file BppImage.cpp.
|
inline |
Returns the state of the image pixel of the requested location.
| x | Horizontal coordinate to query. |
| y | Vertical coordinate to query. |
Definition at line 1404 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::state | ( | const ImageLocation & | il, |
| bool | s | ||
| ) |
Changes the state of a pixel.
| il | The location to change. |
| s | The new state of the pixel. |
Definition at line 306 of file BppImage.cpp.
|
inline |
Changes the state of a pixel.
| x | Horizontal coordinate to change. |
| y | Vertical coordinate to change. |
| s | The new state of the pixel. |
Definition at line 1419 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::swap | ( | BppImage & | other | ) |
Swap two images.
Definition at line 111 of file BppImage.cpp.
Referenced by duds::ui::graphics::swap().
|
inline |
Returns the width of the image.
Definition at line 1100 of file BppImage.hpp.
Referenced by duds::hardware::display::BppGraphicDisplay::width().
| void duds::ui::graphics::BppImage::write | ( | const BppImage *const | src, |
| const ImageLocation & | destLoc, | ||
| const ImageLocation & | srcLoc, | ||
| const ImageDimensions & | srcSize, | ||
| Direction | srcDir = HorizInc, |
||
| Operation | op = OpSet |
||
| ) |
Writes the specified portion of the source into this image.
| src | The source image. |
| destLoc | The top-left location on this image where the source image will be placed. |
| srcLoc | The top-left location in the source image, not modified by srcDir, that will be written into this image. |
| srcSize | The width and height of the source image that will be used. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 430 of file BppImage.cpp.
Referenced by duds::ui::graphics::PriorityGridLayout::render(), and write().
|
inline |
Writes a portion of the source image, starting from (0, 0), into this image.
| src | The source image. |
| destLoc | The top-left location on this image where the source image will be placed. |
| srcSize | The width and height of the source image that will be used. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 1601 of file BppImage.hpp.
|
inline |
Writes the specified portion of the source into this image.
| src | The source image. |
| destLoc | The top-left location on this image where the source image will be placed. |
| srcLoc | The top-left location in the source image, not modified by srcDir, that will be written into this image. |
| srcSize | The width and height of the source image that will be used. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 1623 of file BppImage.hpp.
|
inline |
Writes a portion of the source image, starting from (0, 0), into this image.
| src | The source image. |
| destLoc | The top-left location on this image where the source image will be placed. |
| srcSize | The width and height of the source image that will be used. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 1645 of file BppImage.hpp.
| void duds::ui::graphics::BppImage::write | ( | const BppImage *const | src, |
| const ImageLocation & | dest, | ||
| Direction | srcDir = HorizInc, |
||
| Operation | op = OpSet |
||
| ) |
Writes as much of the given source image as will fit into this image.
| src | The source image. |
| dest | The top-left location on this image where the source image will be placed. The source image will be clipped to fit. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 462 of file BppImage.cpp.
|
inline |
Writes as much of the given source image as will fit into this image.
| src | The source image. |
| dest | The top-left location on this image where the source image will be placed. The source image will be clipped to fit. |
| srcDir | The iteration direction on the source image. This allows the source to be rotated by 0, 90, 180, or 270 degrees. |
| op | The operation used to modify this image. |
Definition at line 1680 of file BppImage.hpp.
|
private |
Number of PixelBlocks used for each horizontal line.
A whole number is always used, save for the case of a zero size image.
Definition at line 340 of file BppImage.hpp.
Referenced by BppImage(), bufferLine(), bufferSpot(), clear(), drawBox(), operator=(), resize(), and swap().
|
private |
The dimensions of the image.
Definition at line 335 of file BppImage.hpp.
Referenced by BppImage(), bufferLine(), bufferSpot(), clear(), cpixel(), drawBox(), operator=(), operator==(), pixel(), resize(), startPosition(), swap(), and write().
|
private |
The image data.
Definition at line 331 of file BppImage.hpp.
Referenced by begin(), blankImage(), BppImage(), buffer(), bufferLine(), bufferSpot(), cbegin(), clear(), drawBox(), invert(), operator=(), operator==(), resize(), and swap().
|
staticprivate |
Functions implementing the operations listed in Operation one bit at a time.
These are intended to be used when there is no optimized implementation of an operation.
Definition at line 1559 of file BppImage.hpp.
Referenced by duds::ui::graphics::opxorbit(), and write().
|
staticprivate |
Functions implementing the operations listed in Operation one PixelBlock at a time.
These are intended to be used by more optimized implementations of an operation than OpBitFunctions.
Definition at line 1566 of file BppImage.hpp.
Referenced by drawBox(), and duds::ui::graphics::opxor().