|
roo_display
API Documentation for roo_display
|
Axis-aligned integer rectangle. More...
#include <box.h>
Public Types | |
| enum class | ClipResult { kEmpty = 0 , kReduced , kUnchanged } |
| Result of clipping a box to a clip region. More... | |
Public Member Functions | |
| constexpr | Box (int16_t xMin, int16_t yMin, int16_t xMax, int16_t yMax) |
| Construct a box from inclusive coordinates. | |
| Box (const Box &)=default | |
| Box (Box &&)=default | |
| Box ()=default | |
| Box & | operator= (const Box &)=default |
| Box & | operator= (Box &&)=default |
| bool | empty () const |
| Return whether the box is empty. | |
| int16_t | xMin () const |
| Minimum x (inclusive). | |
| int16_t | yMin () const |
| Minimum y (inclusive). | |
| int16_t | xMax () const |
| Maximum x (inclusive). | |
| int16_t | yMax () const |
| Maximum y (inclusive). | |
| int16_t | width () const |
| Width in pixels (inclusive coordinates). | |
| int16_t | height () const |
| Height in pixels (inclusive coordinates). | |
| int32_t | area () const |
| Area in pixels. | |
| bool | contains (int16_t x, int16_t y) const |
| Return whether the point (x, y) lies within the box. | |
| bool | contains (const Box &other) const |
| Return whether this box fully contains the other box. | |
| bool | intersects (const Box &other) const |
| Return whether this box intersects the other box. | |
| ClipResult | clip (const Box &clip_box) |
| Clip this box to the given clip box. | |
| Box | translate (int16_t x_offset, int16_t y_offset) const |
| Return a translated copy of this box. | |
| Box | scale (int16_t x_scale, int16_t y_scale) const |
| Return a scaled copy of this box. | |
| Box | swapXY () const |
| Return a copy with x and y axes swapped. | |
| Box | flipX () const |
| Return a copy mirrored across the Y-axis. | |
| Box | flipY () const |
| Return a copy mirrored across the X-axis. | |
| Box | rotateUpsideDown () const |
| Return a copy rotated 180 degrees around the origin. | |
| Box | rotateRight () const |
| Return a copy rotated 90 degrees clockwise around the origin. | |
| Box | rotateLeft () const |
| Return a copy rotated 90 degrees counter-clockwise around the origin. | |
| Box | extend (int16_t x, int16_t y) |
| Return the minimal box containing this box and the given point. | |
Static Public Member Functions | |
| static Box | Intersect (const Box &a, const Box &b) |
| Return the intersection of two boxes (may be empty). | |
| static Box | Extent (const Box &a, const Box &b) |
| Return the smallest box that contains both input boxes. | |
| static Box | MaximumBox () |
| Return a large sentinel box used for unbounded extents. | |
Axis-aligned integer rectangle.
Coordinates are inclusive: width is xMax - xMin + 1.
|
default |
|
default |
Referenced by extend(), Extent(), flipX(), flipY(), Intersect(), MaximumBox(), rotateLeft(), rotateRight(), rotateUpsideDown(), scale(), swapXY(), and translate().
|
inline |
Area in pixels.
Definition at line 83 of file box.h.
References height(), and width().
Referenced by roo_display::StreamableStack::createStream(), roo_display::StreamableStack::createStream(), roo_display::internal::fillPaintRectOverBg(), roo_display::internal::fillPaintRectOverOpaqueBg(), roo_display::internal::fillReplaceRect(), roo_display::internal::MakeSubRectangle(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::internal::RectFillerRectangle< RawPixelStream >::operator()(), roo_display::BackgroundFillOptimizer::setAddress(), roo_display::SubRectangle(), roo_display::internal::writeRectVisible(), roo_display::internal::writeRectVisibleOverBg(), and roo_display::internal::writeRectVisibleOverOpaqueBg().
|
inline |
Return whether the point (x, y) lies within the box.
Definition at line 86 of file box.h.
Referenced by roo_display::drawRoundRect(), roo_display::ClippingBufferedPixelFiller::fillPixel(), roo_display::FrontToBackWriter::fillPixels(), roo_display::fillRoundRect(), roo_display::fillRoundRectBg(), roo_display::ClipMask::isMasked(), roo_display::internal::Clipper< RawStreamable, RawStream, typename >::operator()(), roo_display::RasterizableStack::readColorRect(), roo_display::RasterizableStack::readColors(), roo_display::Rasterizable::readColorsMaybeOutOfBounds(), roo_display::ClippingBufferedPixelWriter::writePixel(), and roo_display::FrontToBackWriter::writePixels().
|
inline |
Return whether the box is empty.
Definition at line 62 of file box.h.
Referenced by clip(), roo_display::internal::TileBase::drawInternal(), roo_display::FrontToBackWriter::fillRects(), roo_display::RasterizableStack::readColorRect(), and roo_display::FrontToBackWriter::writeRects().
Return the smallest box that contains both input boxes.
Definition at line 34 of file box.h.
References Box(), xMax(), xMin(), yMax(), and yMin().
Referenced by roo_display::RasterizableStack::naturalExtents(), and roo_display::StreamableStack::naturalExtents().
|
inline |
Return a copy mirrored across the Y-axis.
Definition at line 142 of file box.h.
References Box().
Referenced by roo_display::Transformation::flipX().
|
inline |
Return a copy mirrored across the X-axis.
Definition at line 145 of file box.h.
References Box().
Referenced by roo_display::Transformation::flipY().
|
inline |
Height in pixels (inclusive coordinates).
Definition at line 80 of file box.h.
Referenced by area(), roo_display::TouchCalibration::Calibrate(), roo_display::Display::height(), roo_display::DrawingContext::height(), roo_display::GlyphMetrics::height(), roo_display::FontMetrics::maxHeight(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::SimpleTiledRasterizable< Getter >::readColors(), and roo_display::RoundRectShadow::RoundRectShadow().
Return the intersection of two boxes (may be empty).
Definition at line 25 of file box.h.
References Box(), xMax(), xMin(), yMax(), and yMin().
Referenced by roo_display::RasterizableStack::addInput(), roo_display::RasterizableStack::addInput(), roo_display::StreamableStack::addInput(), roo_display::StreamableStack::addInput(), roo_display::Transformation::clip(), roo_display::Clipping< RawStreamable, RawStream >::CreateClippedRawStream(), roo_display::internal::Superposition< Bg, Fg >::CreateClippedStream(), roo_display::StreamableStack::createStream(), roo_display::StreamableStack::createStream(), roo_display::SmoothFont::drawGlyph(), roo_display::SmoothFontV2::drawGlyph(), roo_display::SmoothFont::drawHorizontalString(), roo_display::SmoothFontV2::drawHorizontalString(), roo_display::internal::TileBase::drawInternal(), roo_display::drawRoundRect(), roo_display::FrontToBackWriter::fillRects(), roo_display::fillRoundRect(), roo_display::fillRoundRectBg(), roo_display::internal::Clipper< RawStreamable, RawStream, typename >::operator()(), roo_display::RasterizableStack::readColorRect(), roo_display::DrawingContext::setClipBox(), roo_display::Display::setExtents(), and roo_display::FrontToBackWriter::writeRects().
Return a large sentinel box used for unbounded extents.
Definition at line 59 of file box.h.
References Box().
Referenced by roo_display::Transformation::clip_box(), roo_display::Fill::extents(), roo_display::Clear::extents(), roo_display::SimpleTiledRasterizable< Getter >::extents(), and roo_display::Transformation::smallestBoundingRect().
|
inline |
Return a copy rotated 90 degrees counter-clockwise around the origin.
Definition at line 154 of file box.h.
References Box().
Referenced by roo_display::Transformation::rotateLeft().
|
inline |
Return a copy rotated 90 degrees clockwise around the origin.
Definition at line 151 of file box.h.
References Box().
Referenced by roo_display::Transformation::rotateRight().
|
inline |
Return a copy rotated 180 degrees around the origin.
Definition at line 148 of file box.h.
References Box().
Referenced by roo_display::Transformation::rotateUpsideDown().
Return a scaled copy of this box.
Definition at line 133 of file box.h.
References Box().
Referenced by roo_display::Transformation::scale().
|
inline |
Return a copy with x and y axes swapped.
Definition at line 139 of file box.h.
References Box().
Referenced by roo_display::Transformation::swapXY().
Return a translated copy of this box.
Definition at line 127 of file box.h.
References Box().
Referenced by roo_display::Surface::clipToExtents(), roo_display::internal::Superposition< Bg, Fg >::CreateClippedStream(), roo_display::StreamableStack::Input::createStream(), roo_display::internal::TileBase::drawInternal(), roo_display::FrontToBackWriter::fillRects(), roo_display::Transformation::translate(), and roo_display::FrontToBackWriter::writeRects().
|
inline |
Width in pixels (inclusive coordinates).
Definition at line 77 of file box.h.
Referenced by area(), roo_display::TouchCalibration::Calibrate(), roo_display::internal::MakeSubRectangle(), roo_display::FontMetrics::maxWidth(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::internal::Clipper< RawStreamable, RawStream, typename >::operator()(), roo_display::RasterizableStack::readColorRect(), roo_display::SimpleTiledRasterizable< Getter >::readColors(), roo_display::RoundRectShadow::RoundRectShadow(), roo_display::SubRectangle(), roo_display::Display::width(), roo_display::DrawingContext::width(), and roo_display::GlyphMetrics::width().
|
inline |
Maximum x (inclusive).
Definition at line 71 of file box.h.
Referenced by roo_display::TouchCalibration::Calibrate(), clip(), roo_display::drawHLine(), roo_display::internal::TileBase::drawInternal(), roo_display::drawVLine(), extend(), Extent(), roo_display::BlendingFilter< Blender >::fill(), roo_display::RectUnionFilter::fill(), roo_display::ClipMaskFilter::fill(), roo_display::TransformedDisplayOutput::fill(), roo_display::ClippingBufferedHLineFiller::fillHLine(), roo_display::ClippingBufferedRectFiller::fillRect(), roo_display::ClippingBufferedVLineFiller::fillVLine(), roo_display::FontMetrics::glyphXMax(), roo_display::GlyphMetrics::glyphXMax(), Intersect(), roo_display::internal::RectFillerVisible< RawPixelStream >::operator()(), roo_display::operator==(), roo_display::RasterizableStack::readColorRect(), roo_display::RoundRectShadow::readColorRect(), roo_display::GlyphMetrics::rsb(), roo_display::DisplayOutput::setAddress(), roo_display::Translation::transformExtents(), roo_display::Scaling::transformExtents(), roo_display::BlendingFilter< Blender >::write(), roo_display::RectUnionFilter::write(), roo_display::ClipMaskFilter::write(), roo_display::TransformedDisplayOutput::write(), roo_display::ClippingBufferedRectWriter::writeRect(), roo_display::internal::writeRectVisible(), roo_display::internal::writeRectVisibleOverBg(), and roo_display::internal::writeRectVisibleOverOpaqueBg().
|
inline |
Minimum x (inclusive).
Definition at line 65 of file box.h.
Referenced by roo_display::GlyphMetrics::bearingX(), roo_display::TouchCalibration::Calibrate(), clip(), roo_display::drawHLine(), roo_display::internal::TileBase::drawInternal(), roo_display::drawVLine(), extend(), Extent(), roo_display::BlendingFilter< Blender >::fill(), roo_display::RectUnionFilter::fill(), roo_display::ClipMaskFilter::fill(), roo_display::TransformedDisplayOutput::fill(), roo_display::ClippingBufferedHLineFiller::fillHLine(), roo_display::FrontToBackWriter::fillPixels(), roo_display::ClippingBufferedRectFiller::fillRect(), roo_display::FrontToBackWriter::fillRects(), roo_display::ClippingBufferedVLineFiller::fillVLine(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::get(), roo_display::FontMetrics::glyphXMin(), roo_display::GlyphMetrics::glyphXMin(), Intersect(), roo_display::ClipMask::isMasked(), roo_display::GlyphMetrics::lsb(), roo_display::internal::MakeSubRectangle(), roo_display::FontMetrics::minLsb(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::internal::Clipper< RawStreamable, RawStream, typename >::operator()(), roo_display::internal::RectFillerVisible< RawPixelStream >::operator()(), roo_display::operator==(), roo_display::RasterizableStack::readColorRect(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::readColorRect(), roo_display::RoundRectShadow::readColorRect(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::readColors(), roo_display::SimpleTiledRasterizable< Getter >::readColors(), roo_display::RoundRectShadow::RoundRectShadow(), roo_display::DisplayOutput::setAddress(), roo_display::FrontToBackWriter::setAddress(), roo_display::SubRectangle(), roo_display::Translation::transformExtents(), roo_display::Scaling::transformExtents(), roo_display::BlendingFilter< Blender >::write(), roo_display::RectUnionFilter::write(), roo_display::ClipMaskFilter::write(), roo_display::TransformedDisplayOutput::write(), roo_display::FrontToBackWriter::writePixels(), roo_display::ClippingBufferedRectWriter::writeRect(), roo_display::FrontToBackWriter::writeRects(), roo_display::internal::writeRectVisible(), roo_display::internal::writeRectVisibleOverBg(), and roo_display::internal::writeRectVisibleOverOpaqueBg().
|
inline |
Maximum y (inclusive).
Definition at line 74 of file box.h.
Referenced by roo_display::TouchCalibration::Calibrate(), clip(), roo_display::drawHLine(), roo_display::internal::TileBase::drawInternal(), roo_display::drawVLine(), extend(), Extent(), roo_display::ClippingBufferedHLineFiller::fillHLine(), roo_display::ClippingBufferedRectFiller::fillRect(), roo_display::ClippingBufferedVLineFiller::fillVLine(), roo_display::FontMetrics::glyphYMax(), roo_display::GlyphMetrics::glyphYMin(), Intersect(), roo_display::internal::RectFillerVisible< RawPixelStream >::operator()(), roo_display::operator==(), roo_display::png_draw(), roo_display::RasterizableStack::readColorRect(), roo_display::RoundRectShadow::readColorRect(), roo_display::DisplayOutput::setAddress(), roo_display::Translation::transformExtents(), roo_display::Scaling::transformExtents(), roo_display::ClippingBufferedRectWriter::writeRect(), roo_display::internal::writeRectVisible(), roo_display::internal::writeRectVisibleOverBg(), and roo_display::internal::writeRectVisibleOverOpaqueBg().
|
inline |
Minimum y (inclusive).
Definition at line 68 of file box.h.
Referenced by roo_display::GlyphMetrics::bearingY(), roo_display::TouchCalibration::Calibrate(), clip(), roo_display::drawHLine(), roo_display::internal::TileBase::drawInternal(), roo_display::drawVLine(), extend(), Extent(), roo_display::ClippingBufferedHLineFiller::fillHLine(), roo_display::FrontToBackWriter::fillPixels(), roo_display::ClippingBufferedRectFiller::fillRect(), roo_display::FrontToBackWriter::fillRects(), roo_display::ClippingBufferedVLineFiller::fillVLine(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::get(), roo_display::GlyphMetrics::glyphYMax(), roo_display::FontMetrics::glyphYMin(), Intersect(), roo_display::ClipMask::isMasked(), roo_display::internal::MakeSubRectangle(), roo_display::Offscreen< ColorMode, pixel_order, byte_order, pixels_per_byte, storage_type >::Offscreen(), roo_display::internal::Clipper< RawStreamable, RawStream, typename >::operator()(), roo_display::internal::RectFillerVisible< RawPixelStream >::operator()(), roo_display::operator==(), roo_display::png_draw(), roo_display::RasterizableStack::readColorRect(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::readColorRect(), roo_display::RoundRectShadow::readColorRect(), roo_display::Raster< PtrTypeT, ColorModeT, pixel_order, byte_order >::readColors(), roo_display::SimpleTiledRasterizable< Getter >::readColors(), roo_display::RoundRectShadow::RoundRectShadow(), roo_display::DisplayOutput::setAddress(), roo_display::FrontToBackWriter::setAddress(), roo_display::SubRectangle(), roo_display::Translation::transformExtents(), roo_display::Scaling::transformExtents(), roo_display::FrontToBackWriter::writePixels(), roo_display::ClippingBufferedRectWriter::writeRect(), roo_display::FrontToBackWriter::writeRects(), roo_display::internal::writeRectVisible(), roo_display::internal::writeRectVisibleOverBg(), and roo_display::internal::writeRectVisibleOverOpaqueBg().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |