pub struct Image {
pub bytes: Arc<[u8]>,
pub format: ImageFormat,
pub width_px: u32,
pub height_px: u32,
pub components: u8,
pub common: Common,
}Expand description
A validated, embeddable JPEG or PNG. bytes are the original file
bytes, kept as-is — pixel decoding (only ever needed for PNG, to split
out the alpha channel as a SMask) happens later, in the facade.
Fields§
§bytes: Arc<[u8]>§format: ImageFormat§width_px: u32§height_px: u32§components: u81 = Gray, 3 = RGB, 4 = RGBA (JPEG is always 1 or 3, never 4).
common: CommonImplementations§
Source§impl Image
impl Image
Sourcepub fn new(bytes: impl Into<Arc<[u8]>>) -> Result<Image, ImageError>
pub fn new(bytes: impl Into<Arc<[u8]>>) -> Result<Image, ImageError>
Validates bytes as a supported JPEG or PNG and extracts the
metadata layout needs (dimensions, color components). Rejects
anything outside V1’s explicit scope instead of a silent
best-effort attempt (phases/phase-5-images.md step 2-3).
pub fn width(self, width: f32) -> Image
pub fn height(self, height: f32) -> Image
pub fn flex(self, factor: f32) -> Image
pub fn keep_with_next(self) -> Image
Trait Implementations§
Source§impl Layoutable for Image
impl Layoutable for Image
fn measure(&self, _ctx: &LayoutCtx<'_>, constraints: Constraints) -> Size
fn layout( &self, _ctx: &LayoutCtx<'_>, area: Rect, _warnings: &mut Vec<LayoutWarning>, _page: usize, ) -> LayoutResult
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more