pub struct Cluster {
    pub indices: Vec<u32>,
    pub holes: Vec<u32>,
    pub num_holes: u32,
    pub depth: u32,
    pub sum: ColorSum,
    pub residue_sum: ColorSum,
    pub rect: BoundingRect,
    pub merged_into: ClusterIndex,
}

Fields§

§indices: Vec<u32>§holes: Vec<u32>§num_holes: u32§depth: u32§sum: ColorSum§residue_sum: ColorSum§rect: BoundingRect§merged_into: ClusterIndex

Implementations§

source§

impl Cluster

source

pub fn new() -> Self

source

pub fn add(&mut self, i: u32, color: &Color, x: i32, y: i32)

source

pub fn area(&self) -> usize

source

pub fn iter(&self) -> impl Iterator<Item = &u32>

source

pub fn color(&self) -> Color

source

pub fn residue_color(&self) -> Color

source

pub fn perimeter(&self, parent: &ClustersView<'_>) -> u32

source

pub fn to_image(&self, parent: &ClustersView<'_>) -> BinaryImage

source

pub fn to_image_with_hole(&self, parent_width: u32, hole: bool) -> BinaryImage

source

pub fn render_to_binary_image( &self, parent: &ClustersView<'_>, image: &mut BinaryImage )

source

pub fn render_to_color_image( &self, parent: &ClustersView<'_>, image: &mut ColorImage )

source

pub fn render_to_color_image_with_color( &self, parent: &ClustersView<'_>, image: &mut ColorImage, color: &Color )

source

pub fn to_shape(&self, parent: &ClustersView<'_>) -> Shape

source

pub fn to_compound_path( &self, parent: &ClustersView<'_>, hole: bool, mode: PathSimplifyMode, corner_threshold: f64, length_threshold: f64, max_iterations: usize, splice_threshold: f64 ) -> CompoundPath

source

pub fn neighbours(&self, parent: &ClustersView<'_>) -> Vec<ClusterIndex>

Trait Implementations§

source§

impl Clone for Cluster

source§

fn clone(&self) -> Cluster

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Cluster

source§

fn default() -> Cluster

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.