Enum edges::Edges

source ·
pub enum Edges {
    DynamicImage(DynamicImage),
}

Variants§

§

DynamicImage(DynamicImage)

Implementations§

source§

impl Edges

source

pub fn single_image_edge_translated(&self) -> Vec<Vec2>

If there’s only one sprite / object in the image, this returns just one, with coordinates translated to either side of (0, 0)

Examples found in repository?
examples/dynamic-image.rs (line 7)
4
5
6
7
8
fn main() {
    let image = image::open(Path::new("assets/car.png"));
    let edges = Edges::from(image.unwrap());
    println!("{:#?}", edges.single_image_edge_translated());
}
source

pub fn single_image_edge_raw(&self) -> Vec<Vec2>

If there’s only one sprite / object in the image, this returns just one, with coordinates left alone and all in positive x and y

source

pub fn multi_image_edge_translated(&self) -> Vec<Vec<Vec2>>

If there’s more than one sprite / object in the image, this returns all it finds, with coordinates translated to either side of (0, 0)

source

pub fn multi_image_edges_raw(&self) -> Vec<Vec<Vec2>>

If there’s more than one sprite / object in the image, this returns all it finds, with coordinates left alone and all in positive x and y

source

pub fn image_edges(&self, translate: bool) -> Vec<Vec<Vec2>>

Takes a Bevy DynamicImage type and an boolean to indicate whether to translate the points you get back to either side of (0, 0) instead of everything in positive x and y

source

pub fn march_edges( data: &[usize], rows: usize, cols: usize, translate: bool ) -> Vec<Vec<Vec2>>

Marching squares adjacent, walks all the pixels in the provided data and keeps track of any that have at least one transparent / zero value neighbor then, while sorting into drawing order, groups them into sets of connected pixels

Accepts a flag indicating whether or not to translate coordinates to either side of (0,0) or leave it all in positive x,y

source

pub fn translate_vec(v: Vec<Vec2>, rows: usize, cols: usize) -> Vec<Vec2>

Translate vector of points in positive x,y to either side of (0,0)

Trait Implementations§

source§

impl Debug for Edges

source§

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

Formats the value using the given formatter. Read more
source§

impl From<&DynamicImage> for Edges

source§

fn from(i: &DynamicImage) -> Edges

Converts to this type from the input type.
source§

impl From<DynamicImage> for Edges

source§

fn from(i: DynamicImage) -> Edges

Converts to this type from the input type.

Auto Trait Implementations§

§

impl RefUnwindSafe for Edges

§

impl Send for Edges

§

impl Sync for Edges

§

impl Unpin for Edges

§

impl UnwindSafe for Edges

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.