Skip to main content

TilingPattern

Struct TilingPattern 

Source
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: bool

Whether 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: f32

The horizontal spacing, already absolute-valued.

§y_step: f32

The vertical spacing, already absolute-valued.

§bbox: Rect

The tile’s clipping rectangle. Requires exactly four elements or it is all zeros.

§matrix: Affine

The pattern’s space composed with the parent matrix.

§resources: Option<Dict>

The tile’s /Resources.

§content: ByteSpan

The 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

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> TilingPattern

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TilingPattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TilingPattern

Source§

fn eq(&self, other: &TilingPattern) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TilingPattern

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.