Struct Definition

Struct Documentation

struct Definition

Row-major cells in image pixel coordinates; origin is the top-left of the first cell.

cell_rect() maps an index to a source rectangle, while the grid geometry builder converts that rectangle to vertices and normalized texture coordinates for the selected backend. Direct fields require representable counts/coordinates; these helpers do not validate image bounds or all manifest constraints. Empty axes have no cells.

Public Functions

std::size_t cell_count() const

Declaration: [[nodiscard]]

Compute rows*columns with explicit size_t overflow rejection.

See also

Detailed guide

Throws:

CE::Exceptions::runtime_exception – For an unrepresentable count; does not validate image bounds.

Returns:

Zero for an empty axis.

CellIndex cell_index(std::size_t row, std::size_t column) const

Declaration: [[nodiscard]]

Convert a valid row/column into a row-major ordinal.

See also

Detailed guide

Parameters:
  • row – Zero-based row less than rows.

  • column – Zero-based column less than columns.

Throws:

CE::Exceptions::bad_request – For coordinates outside the grid. The caller supplies representable grid arithmetic; this helper does not independently call cell_count() to reject multiplication overflow.

CE::Rendering::Geometry::PixelRect cell_rect(CellIndex cell) const

Declaration: [[nodiscard]]

Compute a cell’s top-left source rectangle including preceding spacing.

See also

Detailed guide

Parameters:

cell – Ordinal below cell_count().

Throws:

CE::Exceptions::bad_request – For an out-of-range cell. Count overflow also propagates; image bounds and representable coordinate arithmetic remain caller requirements.

Returns:

Source pixel coordinates and frame size.

std::uint64_t occupied_right() const

Declaration: [[nodiscard]]

Compute the exclusive right occupied pixel edge without a trailing gap.

See also

Detailed guide

Returns:

origin.x for zero columns. Caller supplies representable coordinate arithmetic; no image bounds check occurs.

std::uint64_t occupied_bottom() const

Declaration: [[nodiscard]]

Compute the exclusive bottom occupied pixel edge without a trailing gap.

See also

Detailed guide

Returns:

origin.y for zero rows. Caller supplies representable coordinate arithmetic; no image bounds check occurs.

Public Members

CE::Rendering::Geometry::PixelPoint origin

Top-left source pixel position of the first cell.

CE::Rendering::Geometry::PixelSize frame

Source width/height of each cell in pixels.

CE::Rendering::Geometry::PixelPoint spacing

Horizontal/vertical pixels between neighboring cells, excluding a trailing margin.

std::size_t rows = {}

Number of grid rows; zero makes the grid empty.

std::size_t columns = {}

Number of cells per row; zero makes the grid empty.