Skip to main content

Image

Struct Image 

Source
pub struct Image<T, L = C1> { /* private fields */ }
Expand description

RAII owner for pitched image memory allocated by NPP.

Values are created through Image::create and released with sys::nppiFree from Drop. The raw pointer must not be freed by callers. step is the NPP row pitch in bytes and can be larger than the logical ROI row size.

Implementations§

Source§

impl<T, L> Image<T, L>
where L: ChannelLayout,

Source

pub fn create(size: Size) -> Result<Self>
where T: SupportedImage<L>,

Source

pub fn copy_to_device_memory(&self) -> Result<DeviceMemory<T>>

Source

pub fn copy_to_host_vec(&self) -> Result<Vec<T>>

Source

pub fn copy_into_device_memory( &self, destination: &mut DeviceMemory<T>, ) -> Result<()>

Source

pub const fn size(&self) -> Size

Returns the image ROI size requested at allocation time.

Source

pub const fn step(&self) -> i32

Returns the NPP row pitch in bytes.

Source

pub fn view(&self) -> Result<ImageView<'_, T, L>>

Borrows this allocation as an immutable NPP image view.

§Errors

Returns an error if the stored size or pitch is not valid for an NPP image view.

Source

pub fn view_mut(&mut self) -> Result<ImageViewMut<'_, T, L>>

Borrows this allocation as a mutable NPP image view.

§Errors

Returns an error if the stored size or pitch is not valid for an NPP image view.

Source

pub const fn as_ptr(&self) -> *const T

Returns the raw device pointer owned by this allocation.

The pointer remains owned by self and is freed with nppiFree when the Image is dropped.

Source

pub const fn as_mut_ptr(&mut self) -> *mut T

Returns the mutable raw device pointer owned by this allocation.

The pointer remains owned by self and is freed with nppiFree when the Image is dropped.

Trait Implementations§

Source§

impl<T: Debug, L: Debug> Debug for Image<T, L>

Source§

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

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

impl<T, L> Drop for Image<T, L>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<T, L = C1> !Send for Image<T, L>

§

impl<T, L = C1> !Sync for Image<T, L>

§

impl<T, L> Freeze for Image<T, L>

§

impl<T, L> RefUnwindSafe for Image<T, L>

§

impl<T, L> Unpin for Image<T, L>
where L: Unpin,

§

impl<T, L> UnsafeUnpin for Image<T, L>

§

impl<T, L> UnwindSafe for Image<T, L>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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>,

Source§

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.