DUDS
Distributed Update of Data from Something
duds::ui::graphics::ImageLocation Struct Reference

Stores a location within an image. More...

#include <BppImage.hpp>

Public Member Functions

 ImageLocation ()=default
 Construct uninitialized. More...
 
template<typename Int0 , typename Int1 , std::enable_if_t< std::is_integral< Int0 >::value, bool > = true, std::enable_if_t< std::is_integral< Int1 >::value, bool > = true>
constexpr ImageLocation (Int0 px, Int1 py)
 Construct with the given location. More...
 
constexpr bool operator!= (const ImageLocation &il) const
 Obvious inequality operator. More...
 
constexpr ImageLocation operator+ (const ImageLocation &il) const
 Add locations together. More...
 
constexpr ImageLocation operator+ (const ImageDimensions &id) const
 Add in dimensions. More...
 
constexpr ImageLocation operator- (const ImageLocation &il) const
 Subtract locations. More...
 
constexpr ImageLocation operator- (const ImageDimensions &id) const
 Subtract dimensions. More...
 
constexpr bool operator== (const ImageLocation &il) const
 Obvious equality operator. More...
 
void swapAxes ()
 Swaps the location's axes. More...
 
constexpr ImageLocation swappedAxes () const
 Returns a new location with swapped axes. More...
 

Public Attributes

std::int16_t x
 Horizontal coordinate. More...
 
std::int16_t y
 Vertical coordinate. More...
 

Detailed Description

Stores a location within an image.

Author
Jeff Jackowski
Examples:
bppmenu.cpp, rendertext.cpp, and st7920.cpp.

Definition at line 33 of file BppImage.hpp.

Constructor & Destructor Documentation

◆ ImageLocation() [1/2]

◆ ImageLocation() [2/2]

template<typename Int0 , typename Int1 , std::enable_if_t< std::is_integral< Int0 >::value, bool > = true, std::enable_if_t< std::is_integral< Int1 >::value, bool > = true>
constexpr duds::ui::graphics::ImageLocation::ImageLocation ( Int0  px,
Int1  py 
)
inline

Construct with the given location.

The template avoids warnings when the integer type is not std::int16_t. If the coordinate value is the result of a computation, it will likely be an int unless explicitly made otherwise, which is annoying.

Parameters
pxThe X coord.
pyThe Y coord.

Definition at line 60 of file BppImage.hpp.

Member Function Documentation

◆ operator!=()

constexpr bool duds::ui::graphics::ImageLocation::operator!= ( const ImageLocation il) const
inline

Obvious inequality operator.

Definition at line 71 of file BppImage.hpp.

◆ operator+() [1/2]

constexpr ImageLocation duds::ui::graphics::ImageLocation::operator+ ( const ImageLocation il) const
inline

Add locations together.

Definition at line 77 of file BppImage.hpp.

Referenced by operator-().

◆ operator+() [2/2]

constexpr ImageLocation duds::ui::graphics::ImageLocation::operator+ ( const ImageDimensions id) const

Add in dimensions.

Adds the width and height of an ImageDimensions to the x and y coordinates of a ImageLocation.

Definition at line 268 of file BppImage.hpp.

◆ operator-() [1/2]

constexpr ImageLocation duds::ui::graphics::ImageLocation::operator- ( const ImageLocation il) const
inline

Subtract locations.

Definition at line 83 of file BppImage.hpp.

◆ operator-() [2/2]

constexpr ImageLocation duds::ui::graphics::ImageLocation::operator- ( const ImageDimensions id) const

Subtract dimensions.

Subtracts the width and height of an ImageDimensions from the x and y coordinates of a ImageLocation.

Definition at line 278 of file BppImage.hpp.

◆ operator==()

constexpr bool duds::ui::graphics::ImageLocation::operator== ( const ImageLocation il) const
inline

Obvious equality operator.

Definition at line 65 of file BppImage.hpp.

Referenced by duds::ui::graphics::BppImage::data(), and duds::ui::graphics::BppImage::ConstPixel::direction().

◆ swapAxes()

void duds::ui::graphics::ImageLocation::swapAxes ( )
inline

Swaps the location's axes.

Definition at line 97 of file BppImage.hpp.

Referenced by duds::ui::graphics::BppPositionIndicator::render().

◆ swappedAxes()

constexpr ImageLocation duds::ui::graphics::ImageLocation::swappedAxes ( ) const
inline

Returns a new location with swapped axes.

Definition at line 103 of file BppImage.hpp.

Member Data Documentation

◆ x

◆ y


The documentation for this struct was generated from the following file: