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§
- Codec
Layout - Codec-ready geometry for a YCbCr image.
- Constraint
- Layout constraint specification.
- Decoder
Offer - What the decoder actually did.
- Decoder
Request - What the layout engine wants the decoder to do.
- Ideal
Layout - Result of the first phase of layout planning.
- Layout
- Computed layout from applying a
Constraintto source dimensions. - Layout
Plan - Final layout plan after decoder negotiation.
- Output
Limits - Post-computation safety limits applied after all layout computation.
- Padding
- Explicit padding specification.
- Pipeline
- Builder for image processing pipelines.
- Plane
Layout - 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.
- Region
Coord - 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.
- Canvas
Color - Canvas background color for pad modes.
- Command
- A single image processing command.
- Constraint
Mode - How to fit a source image into target dimensions.
- Flip
Axis - Axis for manual flip commands.
- Gravity
- Where to position the image when cropping or padding.
- Layout
Error - Layout computation error.
- Orientation
- Image orientation as an element of the D4 dihedral group.
- Rotation
- Rotation amount for manual rotation commands.
- Source
Crop - 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.