Skip to main content

Module layout

Module layout 

Source
Expand description

Layout constraint computation and pipeline planning for resize operations.

This module re-exports types from zenlayout. See that crate for full documentation.

§Example

use zenresize::layout::{Constraint, ConstraintMode, Size};

let layout = Constraint::new(ConstraintMode::FitCrop, 400, 300)
    .compute(1000, 500)
    .unwrap();

// Source cropped to 4:3 aspect ratio, then resized to 400×300
assert_eq!(layout.resize_to, Size::new(400, 300));
assert!(layout.source_crop.is_some());

Modules§

constraint
Layout constraint computation for resize operations.
orientation
Orientation (D4 dihedral group), EXIF mapping, and coordinate transforms.
plan
Command pipeline and decoder negotiation.

Structs§

CodecLayout
Codec-ready geometry for a YCbCr image.
Constraint
Layout constraint specification.
DecoderOffer
What the decoder actually did.
DecoderRequest
What the layout engine wants the decoder to do.
IdealLayout
Result of the first phase of layout planning.
Layout
Computed layout from applying a Constraint to source dimensions.
LayoutPlan
Final layout plan after decoder negotiation.
OutputLimits
Post-computation safety limits applied after all layout computation.
Padding
Explicit padding specification.
Pipeline
Builder for image processing pipelines.
PlaneLayout
Geometry for a single image plane (luma or chroma).
Rect
Axis-aligned rectangle in pixel coordinates.
Region
A viewport rectangle in source coordinates defining a window into an infinite canvas.
RegionCoord
A coordinate in the region viewport, expressed as a percentage of the source dimension plus a pixel offset.
Size
Width × height dimensions in pixels.

Enums§

Align
How to align output dimensions to codec-required multiples.
CanvasColor
Canvas background color for pad modes.
Command
A single image processing command.
ConstraintMode
How to fit a source image into target dimensions.
FlipAxis
Axis for manual flip commands.
Gravity
Where to position the image when cropping or padding.
LayoutError
Layout computation error.
Orientation
Image orientation as an element of the D4 dihedral group.
Rotation
Rotation amount for manual rotation commands.
SourceCrop
Region of source image to use before applying the constraint.
Subsampling
Chroma subsampling scheme.

Functions§

compute_layout
Compute ideal layout from commands and source image dimensions.
compute_layout_sequential
Compute layout from command sequence with sequential evaluation.