pub struct TilingPattern {
pub colored: bool,
pub x_step: f32,
pub y_step: f32,
pub bbox: Rect,
pub matrix: Affine,
pub resources: Option<Dict>,
pub content: ByteSpan,
pub objects: Vec<PageObject>,
}Expand description
A /PatternType 1 pattern.
Fields§
§colored: boolWhether the tile supplies its own colour (/PaintType 1). Anything
else, including /PaintType 2, a zero, and a missing key, is
uncoloured and takes its colour from the scn operands.
x_step: f32The horizontal spacing, already absolute-valued.
y_step: f32The vertical spacing, already absolute-valued.
bbox: RectThe tile’s clipping rectangle. Requires exactly four elements or it is all zeros.
matrix: AffineThe pattern’s space composed with the parent matrix.
resources: Option<Dict>The tile’s /Resources.
content: ByteSpanThe tile’s content stream, still filtered.
objects: Vec<PageObject>The cell’s own page objects, interpreted from content.
A tile is a content stream like any other, so what it paints is a page object list; expanding it at load time is what lets the renderer walk a cell with the same code that walks a page. The tile inherits the painting object’s general state — its alpha, blend mode and soft mask — and default colour, text and path state, which is why the cell is interpreted where the pattern is installed rather than where it is declared.
Implementations§
Source§impl TilingPattern
impl TilingPattern
Sourcepub fn steps_are_drawable(&self) -> bool
pub fn steps_are_drawable(&self) -> bool
Whether the steps allow the pattern to be drawn at all.
A zero or non-finite step means it paints nothing — silently, in the C++, and with a diagnostic here.
Sourcepub fn tile_range(
&self,
clip: Rect,
diags: &mut Diagnostics,
) -> Option<TileRange>
pub fn tile_range( &self, clip: Rect, diags: &mut Diagnostics, ) -> Option<TileRange>
The tile indices covering clip, in the pattern’s own space.
None when the steps are unusable or an index does not fit an i32,
both of which abort the whole pattern.
Sourcepub fn cell_size(&self, to_device: Affine) -> Option<(i32, i32)>
pub fn cell_size(&self, to_device: Affine) -> Option<(i32, i32)>
The tile’s pixel size in the device space matrix maps to, clamped to
at least one by one.
A degenerate /BBox still produces a tile; only a size that will not
fit an i32 aborts.
The two edges narrow to f32 before the ceiling, because
CFX_FloatRect is single-precision and the ceiling is exactly where
that precision shows. A /Matrix scale of 0.4 over a 100-unit
/BBox is the case: the nearest f32 to 0.4 is a shade above it, so
the edge is 40.000001 in double precision and ceils to 41, while the
same product rounded to f32 is exactly 40 and ceils to 40. One
extra row and column stretches the whole cell by a fortieth and
smears every tile’s contents against its neighbours.
Trait Implementations§
Source§impl Clone for TilingPattern
impl Clone for TilingPattern
Source§fn clone(&self) -> TilingPattern
fn clone(&self) -> TilingPattern
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more