pub struct Element<'a> { /* private fields */ }Expand description
Text layout element.
Implementations§
Source§impl Element<'_>
impl Element<'_>
Sourcepub fn is_at_beginning_of(&self, level: LayoutLevel) -> bool
pub fn is_at_beginning_of(&self, level: LayoutLevel) -> bool
Returns true if the element is at the start of the given level.
Sourcepub fn is_at_final_element(
&self,
level: LayoutLevel,
element: LayoutLevel,
) -> bool
pub fn is_at_final_element( &self, level: LayoutLevel, element: LayoutLevel, ) -> bool
Returns true if the element is at the end of the given level.
Sourcepub fn bounding_box(&self, level: LayoutLevel) -> Option<Rectangle>
pub fn bounding_box(&self, level: LayoutLevel) -> Option<Rectangle>
Returns the bounds of the element at the given level of the layout.
Returns None if the given level doesn’t exist.
The box position and dimensions should match the ones of
get_binary_image
but may not match the ones of get_image due to padding.
Sourcepub fn block_type(&self) -> BlockType
pub fn block_type(&self) -> BlockType
Returns block type.
Sourcepub fn get_binary_image(&self, level: LayoutLevel) -> Image
pub fn get_binary_image(&self, level: LayoutLevel) -> Image
Returns a binary image of the element at the given layout level.
Sourcepub fn get_image(
&self,
level: LayoutLevel,
padding: u32,
original: &Image,
) -> (Image, i32, i32)
pub fn get_image( &self, level: LayoutLevel, padding: u32, original: &Image, ) -> (Image, i32, i32)
Returns a grayscale image of the element at the given layout level.
Padding is added to the left-top corner in both dimensions.
If padding is zero, then the returned positions and dimensions should match
the ones of bounding_box.
Sourcepub fn baseline(&self, level: LayoutLevel) -> Option<Line>
pub fn baseline(&self, level: LayoutLevel) -> Option<Line>
Returns the baseline of the element.
Sourcepub fn orientation(&self) -> OrientationParams
pub fn orientation(&self) -> OrientationParams
Returns the element’s block orientation.
Sourcepub fn paragraph_info(&self) -> ParagraphInfo
pub fn paragraph_info(&self) -> ParagraphInfo
Returns the element’s paragraph information.