roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
roo_display::Tile Class Reference

Rectangular drawable with background and aligned interior. More...

#include <tile.h>

Inheritance diagram for roo_display::Tile:
[legend]
Collaboration diagram for roo_display::Tile:
[legend]

Public Member Functions

 Tile (const Drawable *interior, Box extents, Alignment alignment, Color bgcolor=color::Background)
 Create a tile with the specified interior, extents, and alignment.
 
void drawTo (const Surface &s) const override
 Draw this object's content, respecting the fill mode.
 
- Public Member Functions inherited from roo_display::internal::TileBase
 TileBase (const Drawable &interior, Box extents, Alignment alignment, Color bgcolor=color::Background)
 
void setBgColor (Color bgcolor)
 
void setBackground (const Rasterizable *background)
 
Box extents () const override
 Return the bounding box encompassing all pixels that need to be drawn.
 
- Public Member Functions inherited from roo_display::Drawable
virtual ~Drawable ()
 
virtual Box anchorExtents () const
 Return the bounds used for alignment.
 

Additional Inherited Members

- Static Public Member Functions inherited from roo_display::Drawable
static const DrawableEmpty ()
 A singleton representing a no-op drawable with no bounding box.
 
- Protected Member Functions inherited from roo_display::internal::TileBase
void draw (const Surface &s, const Drawable &interior) const
 
void drawInternal (const Surface &s, const Drawable &interior) const
 

Detailed Description

Rectangular drawable with background and aligned interior.

Useful for UI widgets (icons, text boxes, etc.). Handles alignment and flicker-minimized redraws.

Alignment: the interior is positioned inside the tile using the alignment specification (horizontal and vertical anchors plus optional offsets).

Flickerless redraws: the tile is drawn as up to 5 non-overlapping sections (top, left, interior, right, bottom) to avoid double draws.

Semi-transparent backgrounds are supported. The tile background is alpha-blended over the draw-time background color.

Definition at line 85 of file tile.h.

Constructor & Destructor Documentation

◆ Tile()

roo_display::Tile::Tile ( const Drawable interior,
Box  extents,
Alignment  alignment,
Color  bgcolor = color::Background 
)
inline

Create a tile with the specified interior, extents, and alignment.

Definition at line 88 of file tile.h.

Member Function Documentation

◆ drawTo()

void roo_display::Tile::drawTo ( const Surface s) const
inlineoverridevirtual

Draw this object's content, respecting the fill mode.

If s.fill_mode() == FillMode::kExtents, the method must fill the entire (clipped) extents() rectangle (using s.bgcolor() for transparent parts).

The default implementation fills the clipped extents() rectangle with bgcolor and then calls drawInteriorTo(). That can cause flicker, so override this method if a better implementation is possible.

The implementation must respect surface parameters, particularly clip_box(), and must not draw outside it. The surface clip box is pre-clipped to fit within this drawable's extents().

Reimplemented from roo_display::Drawable.

Definition at line 93 of file tile.h.


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