6#include "roo_logging.h"
42 [[
deprecated(
"Use `Orientation::kLeftToRight` instead.")]]
44 [[
deprecated(
"Use `Orientation::kRightToLeft` instead.")]]
46 [[
deprecated(
"Use `Orientation::kTopToBottom` instead.")]]
48 [[
deprecated(
"Use `Orientation::kBottomToTop` instead.")]]
83 return Default().rotateClockwise(count);
126 static const bool mirrored[8] = {0, 1, 1, 0, 1, 0, 0, 1};
170 return counts[orientation_ >> 1];
185 static const char*
names[] = {
"RightDown",
"DownRight",
"LeftDown",
186 "DownLeft",
"RightUp",
"UpRight",
188 return names[orientation_];
197 uint8_t orientation_;
201 return a.orientation_ == b.orientation_;
205 return a.orientation_ != b.orientation_;
Represents the orientation of a display device.
static constexpr Orientation UpLeft()
Return orientation where x increases upward and y increases to the left.
Orientation rotateClockwise(int turns) const
Rotate clockwise by turns * 90 degrees.
bool isMirrored() const
Return whether text would appear mirrored in this orientation.
static constexpr VerticalDirection BOTTOM_TO_TOP
static constexpr Orientation RightDown()
Return a specific orientation value.
int getRotationCount() const
Return how many right rotations reach this orientation from default.
friend bool operator==(Orientation a, Orientation b)
VerticalDirection getVerticalDirection() const
Return the vertical direction.
Orientation rotateRight() const
Rotate 90 degrees clockwise.
static constexpr Orientation UpRight()
Return orientation where x increases upward and y increases to the right.
Orientation swapXY() const
Swap the mapping between x/y and horizontal/vertical directions.
static constexpr Orientation DownLeft()
Return orientation where x increases downward and y increases to the left.
static constexpr Orientation LeftUp()
Return orientation where x increases to the left and y increases upward.
HorizontalDirection
Horizontal direction of the display.
static constexpr VerticalDirection TOP_TO_BOTTOM
bool isRightToLeft() const
Return whether horizontal direction is right-to-left.
bool isLeftToRight() const
Return whether horizontal direction is left-to-right.
Orientation rotateUpsideDown() const
Rotate 180 degrees.
Orientation flipHorizontally() const
Flip the horizontal direction.
Orientation rotateLeft() const
Rotate 90 degrees counter-clockwise.
bool isTopToBottom() const
Return whether vertical direction is top-to-bottom.
static Orientation RotatedByCount(int count)
Return the default orientation rotated by count * 90 degrees.
static constexpr HorizontalDirection kRightToLeft
static constexpr Orientation RightUp()
Return orientation where x increases to the right and y increases upward.
static constexpr HorizontalDirection LEFT_TO_RIGHT
static constexpr HorizontalDirection RIGHT_TO_LEFT
const char * asString() const
Return a common name for this orientation.
Orientation flipVertically() const
Flip the vertical direction.
friend bool operator!=(Orientation a, Orientation b)
static constexpr Orientation LeftDown()
Return orientation where x increases to the left and y increases downward.
Orientation flipX() const
Flip along the x axis (horizontal or vertical depending on swap).
Orientation rotateCounterClockwise(int turns) const
Rotate counter-clockwise by turns * 90 degrees.
Orientation flipY() const
Flip along the y axis (vertical or horizontal depending on swap).
static constexpr VerticalDirection kBottomToTop
VerticalDirection
Vertical direction of the display.
static constexpr VerticalDirection kTopToBottom
static constexpr Orientation DownRight()
Return orientation where x increases downward and y increases to the right.
static constexpr Orientation Default()
Return the default orientation (RightDown).
static constexpr HorizontalDirection kLeftToRight
bool isBottomToTop() const
Return whether vertical direction is bottom-to-top.
bool isXYswapped() const
Return whether x maps to the vertical direction.
HorizontalDirection getHorizontalDirection() const
Return the horizontal direction.
Defines 140 opaque HTML named colors.
constexpr bool operator==(const Color &a, const Color &b)
Equality operator for colors.
constexpr bool operator!=(const Color &a, const Color &b)
Inequality operator for colors.