pub struct RasterizerCellsAa { /* private fields */ }Expand description
The main rasterization engine that converts line segments (edges) into anti-aliased pixel cells.
Port of C++ rasterizer_cells_aa<Cell> from agg_rasterizer_cells_aa.h.
Instead of the C++ block-based allocator, we use a flat Vec<CellAa>.
Sorted cell access uses indices into this vec rather than raw pointers.
Implementations§
Source§impl RasterizerCellsAa
impl RasterizerCellsAa
Sourcepub fn style(&mut self, style_cell: &CellAa)
pub fn style(&mut self, style_cell: &CellAa)
Set the current style cell (used by compound rasterizer; no-op for basic usage).
pub fn min_x(&self) -> i32
pub fn min_y(&self) -> i32
pub fn max_x(&self) -> i32
pub fn max_y(&self) -> i32
Sourcepub fn total_cells(&self) -> u32
pub fn total_cells(&self) -> u32
Total number of accumulated cells.
Sourcepub fn scanline_num_cells(&self, y: u32) -> u32
pub fn scanline_num_cells(&self, y: u32) -> u32
Number of cells on scanline y (only valid after sort_cells()).
Sourcepub fn scanline_cells(&self, y: u32) -> &[u32]
pub fn scanline_cells(&self, y: u32) -> &[u32]
Get a slice of cell indices for scanline y (only valid after sort_cells()).
Returns indices into the internal cells array.
Sourcepub fn line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
pub fn line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32)
Add a line segment in 24.8 fixed-point coordinates.
This is the primary entry point for the rasterizer. Large dx values are handled by recursive subdivision (matching the C++ implementation).
Sourcepub fn sort_cells(&mut self)
pub fn sort_cells(&mut self)
Sort all accumulated cells by Y then X.
After sorting, cells can be queried per-scanline via
scanline_num_cells() and scanline_cells().