DUDS
Distributed Update of Data from Something
duds::ui::graphics::BppImage::Pixel Class Reference

A forward and output iterator that visits each location of the image. More...

#include <BppImage.hpp>

Inheritance diagram for duds::ui::graphics::BppImage::Pixel:
Collaboration diagram for duds::ui::graphics::BppImage::Pixel:

Classes

class  BoolProxy
 Retreives a pixel's state; used to allow Pixel to be dereferenced like any other iterator to get a bool for the pixel. More...
 

Public Member Functions

 Pixel (BppImage *img, const ImageLocation &il={ 0, 0 }, Direction d=HorizInc)
 Construct a Pixel to reference the requested location of the image. More...
 
 Pixel (BppImage *img, int x, int y, Direction d=HorizInc)
 Construct a Pixel to reference the requested location of the image. More...
 
 Pixel (BppImage *img, const ImageLocation &o, const ImageDimensions &s, const ImageLocation &p={ 0, 0 }, Direction d=HorizInc)
 Construct a Pixel to iterate over a subset of the image, and start at a given spot. More...
 
void clear ()
 Clears (make false) the referenced pixel. More...
 
BoolProxy operator* ()
 Dereferences the Pixel; provides the state of the pixel. More...
 
Pixeloperator= (const Pixel &p)=default
 Obvious assignment operator. More...
 
Pixeloperator= (const EndPixel)
 Assigns a Pixel to nowhere. More...
 
Pixeloperator= (bool s)
 Changes the state of the referenced pixel. More...
 
void set ()
 Sets (make true) the referenced pixel. More...
 
void state (bool s)
 Sets the state of the pixel. More...
 
bool state () const
 Returns the state of the referenced pixel. More...
 
bool toggle ()
 Toggles the state of the pixel. More...
 
- Public Member Functions inherited from duds::ui::graphics::BppImage::ConstPixel
constexpr ConstPixel ()
 Construct a ConstPixel to nowhere. More...
 
constexpr ConstPixel (const EndPixel)
 Construct a ConstPixel to nowhere. More...
 
 ConstPixel (const ConstPixel &)=default
 Obvious copy constructor. More...
 
 ConstPixel (const BppImage *img, const End e)
 Construct a ConstPixel to be the end iterator of the given image. More...
 
 ConstPixel (const BppImage *img, const ImageLocation &il=ImageLocation(0, 0), Direction d=HorizInc)
 Construct a ConstPixel to reference the requested location of the image. More...
 
 ConstPixel (const BppImage *img, int x, int y, Direction d=HorizInc)
 Construct a ConstPixel to reference the requested location of the image. More...
 
 ConstPixel (const BppImage *img, const ImageLocation &o, const ImageDimensions &s, const ImageLocation &p=ImageLocation(0, 0), Direction d=HorizInc)
 Construct a ConstPixel to iterate over a subset of the image, and start at a given spot. More...
 
ImageLocation absLocation () const
 Returns the absolute coordinates of the referenced pixel. More...
 
int absX () const
 Returns the absolute horizontal coordinate of the referenced pixel. More...
 
int absY () const
 Returns the absolute vertical coordinate of the referenced pixel. More...
 
const ImageDimensionsdimensions () const
 Returns this object's dimensions used to limit the area of the source image that will be visited. More...
 
void dimensions (const ImageDimensions &d)
 Changes the dimensions of this object. More...
 
Direction direction () const
 Returns the direction used for incrementing. More...
 
void direction (Direction d)
 Changes the direction used for incrementing. More...
 
int height () const
 Returns the height of this object's dimensions used to limit the area of the source image that will be visited. More...
 
const ImageLocationlocation () const
 Returns the coordinates of the referenced pixel relative to this object's origin. More...
 
void location (const ImageLocation &il)
 Changes the location referenced by this ConstPixel relative to its origin. More...
 
void location (int x, int y)
 Changes the location referenced by this ConstPixel relative to its origin. More...
 
bool operator!= (const ConstPixel &cp) const
 Obvious inequality operator. More...
 
bool operator!= (const EndPixel) const
 False if this object is an end iterator or an iterator to nowhere. More...
 
ConstBoolProxy operator* () const
 Dereferences the ConstPixel; provides the state of the pixel. More...
 
ConstPixeloperator++ ()
 Pre-increment operator. More...
 
ConstPixel operator++ (int)
 Post-increment operator. More...
 
ConstPixeloperator= (const ConstPixel &)=default
 Obvious assignment operator. More...
 
ConstPixeloperator= (const Pixel &p)
 Assigns a ConstPixel to reference the same location of the same image as the given Pixel object. More...
 
ConstPixeloperator= (const EndPixel)
 Assigns a ConstPixel to nowhere. More...
 
bool operator== (const ConstPixel &cp) const
 Less than obvious equality operator. More...
 
bool operator== (const EndPixel) const
 True if this object is an end iterator or an iterator to nowhere. More...
 
void origdimloc (const ImageLocation &o, const ImageDimensions &d, const ImageLocation &p)
 Changes the origin, dimensions, and relative position of this object. More...
 
const ImageLocationorigin () const
 Returns this object's origin used to limit the area of the source image that will be visited. More...
 
void origin (const ImageLocation &il)
 Changes the origin of this object. More...
 
int originX () const
 Returns the X coordinate of this object's origin used to limit the area of the source image that will be visited. More...
 
int originY () const
 Returns the Y coordinate of this object's origin used to limit the area of the source image that will be visited. More...
 
bool state () const
 Returns the state of the referenced pixel. More...
 
int width () const
 Returns the width of this object's dimensions used to limit the area of the source image that will be visited. More...
 
int x () const
 Returns the horizontal coordinate of the referenced pixel relative to this object's origin. More...
 
int y () const
 Returns the vertical coordinate of the referenced pixel relative to this object's origin. More...
 

Additional Inherited Members

- Public Types inherited from duds::ui::graphics::BppImage::ConstPixel
typedef bool value_type
 
- Protected Attributes inherited from duds::ui::graphics::BppImage::ConstPixel
PixelBlockblk
 The PixelBlock containing the referenced pixel. More...
 
ImageDimensions dim
 The dimensions of the image to iterate over; can be used to limit the portion visited by the iterator. More...
 
Direction dir
 The direction to move when incremented. More...
 
PixelBlock mask
 The mask used to isolate the referenced pixel. More...
 
ImageLocation orig
 Upper left corner of the image to limit the iteration to a portion of the whole image. More...
 
ImageLocation pos
 The location of the referenced pixel on the source image. More...
 
BppImagesrc
 The image to operate upon. More...
 

Detailed Description

A forward and output iterator that visits each location of the image.

Definition at line 823 of file BppImage.hpp.

Constructor & Destructor Documentation

◆ Pixel() [1/3]

duds::ui::graphics::BppImage::Pixel::Pixel ( BppImage img,
const ImageLocation il = { 0, 0 },
Direction  d = HorizInc 
)
inline

Construct a Pixel to reference the requested location of the image.

Exceptions
ImageBoundsError

Definition at line 830 of file BppImage.hpp.

◆ Pixel() [2/3]

duds::ui::graphics::BppImage::Pixel::Pixel ( BppImage img,
int  x,
int  y,
Direction  d = HorizInc 
)
inline

Construct a Pixel to reference the requested location of the image.

Exceptions
ImageBoundsError

Definition at line 840 of file BppImage.hpp.

◆ Pixel() [3/3]

duds::ui::graphics::BppImage::Pixel::Pixel ( BppImage img,
const ImageLocation o,
const ImageDimensions s,
const ImageLocation p = { 0, 0 },
Direction  d = HorizInc 
)
inline

Construct a Pixel to iterate over a subset of the image, and start at a given spot.

Parameters
imgThe source image to iterate over.
oThe 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 d. The area to iterate over must exist within the source image.
sThe 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 d. The area to iterate over must exist within the source image.
pThe starting position of the iteration. Its axes are not modified by the iteration direction d. It must specify a position within the dimensions s. It will not change when iteration will end.
dThe direction of the iteration as defined in the enum Direction.
Exceptions
ImageBoundsErrorEither the starting position p is beyond the dimensions s, or the area to iterate over goes beyond the bounds of the source image img.

Definition at line 870 of file BppImage.hpp.

Member Function Documentation

◆ clear()

void duds::ui::graphics::BppImage::Pixel::clear ( )
inline

Clears (make false) the referenced pixel.

Exceptions
ImageIteratorEndError

Definition at line 913 of file BppImage.hpp.

◆ operator*()

BoolProxy duds::ui::graphics::BppImage::Pixel::operator* ( )
inline

Dereferences the Pixel; provides the state of the pixel.

Definition at line 958 of file BppImage.hpp.

◆ operator=() [1/3]

Pixel& duds::ui::graphics::BppImage::Pixel::operator= ( const Pixel p)
default

Obvious assignment operator.

◆ operator=() [2/3]

Pixel& duds::ui::graphics::BppImage::Pixel::operator= ( const EndPixel  )
inline

Assigns a Pixel to nowhere.

Definition at line 884 of file BppImage.hpp.

◆ operator=() [3/3]

Pixel& duds::ui::graphics::BppImage::Pixel::operator= ( bool  s)
inline

Changes the state of the referenced pixel.

Exceptions
ImageIteratorEndError
Returns
The new state of the pixel.

Definition at line 905 of file BppImage.hpp.

◆ set()

void duds::ui::graphics::BppImage::Pixel::set ( )
inline

Sets (make true) the referenced pixel.

Exceptions
ImageIteratorEndError

Definition at line 920 of file BppImage.hpp.

◆ state() [1/2]

void duds::ui::graphics::BppImage::Pixel::state ( bool  s)

◆ state() [2/2]

bool duds::ui::graphics::BppImage::Pixel::state ( ) const
inline

Returns the state of the referenced pixel.

Exceptions
ImageIteratorEndError

Definition at line 897 of file BppImage.hpp.

◆ toggle()

bool duds::ui::graphics::BppImage::Pixel::toggle ( )

Toggles the state of the pixel.

This works like state(!state()), but is more efficient.

Returns
The new state of the pixel.
Exceptions
ImageIteratorEndError

Definition at line 789 of file BppImage.cpp.


The documentation for this class was generated from the following files: