Struct greenglas::image::Image

source ·
pub struct Image { /* private fields */ }
Expand description

The Transformable Data Type Image

Implementations§

source§

impl Image

source

pub fn new(image: DynamicImage) -> Image

Create a new Image from a DynamicImage

source

pub fn from_path<P>(path: P) -> Image
where P: AsRef<Path>,

Create a new Image from a Path

source

pub fn from_buffer(buf: &[u8]) -> Image

Create a new Image from Buffer

source

pub fn from_rgb_pixels( w: u32, h: u32, buf: Vec<u8> ) -> Result<Image, TransformerError>

Create a new Image from RGB style pixel container such as Vec

source

pub fn from_rgba_pixels( w: u32, h: u32, buf: Vec<u8> ) -> Result<Image, TransformerError>

Create a new Image from RGBa style pixel container such as Vec

source

pub fn from_luma_pixels( w: u32, h: u32, buf: Vec<u8> ) -> Result<Image, TransformerError>

Create a new Image from Luma (greyscale) style pixel container such as Vec

source

pub fn from_lumaa_pixels( w: u32, h: u32, buf: Vec<u8> ) -> Result<Image, TransformerError>

Create a new Image from LumaA style pixel container such as Vec

Trait Implementations§

source§

impl Modifier<Image> for Crop

source§

fn modify(self, image: &mut Image)

Modify F with self.
source§

impl Modifier<Image> for Grayscale

source§

fn modify(self, image: &mut Image)

Modify F with self.
source§

impl Modifier<Image> for Resize

source§

fn modify(self, image: &mut Image)

Modify F with self.
source§

impl Set for Image

§

fn set<M>(self, modifier: M) -> Self
where M: Modifier<Self>, Self: Sized,

Modify self using the provided modifier.
§

fn set_mut<M>(&mut self, modifier: M) -> &mut Self
where M: Modifier<Self>,

Modify self through a mutable reference with the provided modifier.
source§

impl Transformer for Image

source§

fn transform_to_vec(&self) -> Vec<f32>

Transforms the non-numeric data into a numeric Vec
source§

fn transform( &self, shape: &[usize] ) -> Result<SharedTensor<f32>, TransformerError>

Transforms non-numeric data into a numeric SharedTensor Read more
source§

fn write_to_memory<T: NumCast + Copy>( mem: &mut FlatBox, data: &[T] ) -> Result<(), TransformerError>

Write into a native Coaster Memory.
source§

fn write_to_memory_offset<T: NumCast + Copy>( mem: &mut FlatBox, data: &[T], offset: usize ) -> Result<(), TransformerError>

Write into a native Coaster Memory with a offset.

Auto Trait Implementations§

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

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.