Skip to main content

TilePlan

Struct TilePlan 

Source
pub struct TilePlan {
    pub page_width: u32,
    pub page_height: u32,
    pub tile: PixelRect,
}
Expand description

The geometry of one validated request: the whole page’s pixel size at the scale and view rotation, and the tile inside it. Both backends render from this, so they agree on sizes.

Added in 0.2.0.

Fields§

§page_width: u32

The whole page’s width in pixels, after the view rotation.

§page_height: u32

The whole page’s height in pixels, after the view rotation.

§tile: PixelRect

The tile.

Implementations§

Source§

impl TilePlan

Source

pub fn new( page: &RenderPage, request: &RenderRequest, limits: &RenderLimits, ) -> Result<Self, RenderError>

Validates request against page and limits.

The page’s pixel size is max(1, floor(points × scale)) per side.

§Errors

invalid-argument for a non-finite or non-positive scale, an empty tile or one outside the page, or a page too large to address at this scale; render-too-large above limits.

Added in 0.2.0.

Source

pub fn byte_len(&self) -> usize

The bytes the tile needs: width × height × 4.

Added in 0.2.0.

Source

pub fn page_to_tile(&self, page: &RenderPage, rotation: Rotation) -> Matrix

The affine matrix from the displayed page space of page (points, top-left origin, y down, /Rotate applied: ADR 0027’s page space) to this tile’s pixels: scale to the page’s integer pixel size, apply the view rotation, shift the tile to the origin. Both adapters draw with it, so their tiles agree.

Added in 0.2.0.

Source

pub fn check_buffer(&self, out: &[u8]) -> Result<(), RenderError>

Checks that out has exactly TilePlan::byte_len bytes.

§Errors

invalid-argument (BufferSize) otherwise.

Added in 0.2.0.

Trait Implementations§

Source§

impl Clone for TilePlan

Source§

fn clone(&self) -> Self

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 Copy for TilePlan

Source§

impl Debug for TilePlan

Source§

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

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

impl Eq for TilePlan

Source§

impl PartialEq for TilePlan

Source§

fn eq(&self, other: &Self) -> 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 TilePlan

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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<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.