Struct surf_n_term::image::OcTree[][src]

pub struct OcTree { /* fields omitted */ }

Oc(tet)Tree used for color quantization

References:

Implementations

impl OcTree[src]

pub fn new() -> Self[src]

Create empty OcTree

pub fn find(&self, color: RGBA) -> Option<(usize, RGBA)>[src]

Find nearest color inside the octree

NOTE:

  • to get correct palette index call build_palette first.
  • prefer ColorPalette::find as it produces better result, and can not return None.

pub fn build_palette(&mut self) -> Vec<RGBA>[src]

Exteract all colors present in the octree and update leaf color indices

pub fn insert(&mut self, color: RGBA)[src]

Insert color into the octree

pub fn prune_until(&mut self, color_count: usize)[src]

Prune until desired number of colors is left

pub fn prune(&mut self)[src]

Remove the node with minimal number of colors in the it

pub fn to_digraph<W: Write>(&self, out: W) -> Result<()>[src]

Render octree as graphviz digraph (for debugging)

Trait Implementations

impl Clone for OcTree[src]

fn clone(&self) -> OcTree[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for OcTree[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for OcTree[src]

fn default() -> Self[src]

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

impl Extend<RGBA> for OcTree[src]

fn extend<T: IntoIterator<Item = RGBA>>(&mut self, colors: T)[src]

Extends a collection with the contents of an iterator. Read more

fn extend_one(&mut self, item: A)[src]

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

fn extend_reserve(&mut self, additional: usize)[src]

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

impl FromIterator<RGBA> for OcTree[src]

fn from_iter<T: IntoIterator<Item = RGBA>>(iter: T) -> Self[src]

Creates a value from an iterator. Read more

Auto Trait Implementations

impl RefUnwindSafe for OcTree

impl Send for OcTree

impl Sync for OcTree

impl Unpin for OcTree

impl UnwindSafe for OcTree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.