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: u32The whole page’s width in pixels, after the view rotation.
page_height: u32The whole page’s height in pixels, after the view rotation.
tile: PixelRectThe tile.
Implementations§
Source§impl TilePlan
impl TilePlan
Sourcepub fn new(
page: &RenderPage,
request: &RenderRequest,
limits: &RenderLimits,
) -> Result<Self, RenderError>
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.
Sourcepub fn page_to_tile(&self, page: &RenderPage, rotation: Rotation) -> Matrix
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.
Sourcepub fn check_buffer(&self, out: &[u8]) -> Result<(), RenderError>
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.