[−][src]Struct pel::TextureHandle
GPU texture handle.
All pels are buffered and sent to GPU only once, when this temporary handle is dropped.
It is backed by a normal Surface
, its API is exposed using Deref
and
DerefMut
traits.
Methods from Deref<Target = RawSurface<Pel>>
pub fn width(&self) -> usize
[src]
Surface width.
pub fn height(&self) -> usize
[src]
Surface height.
pub fn size(&self) -> (usize, usize)
[src]
Surface size as a (width, height) tuple.
pub fn as_ptr(&self) -> *const I
[src]
Returns a raw pointer to the surface's internal buffer.
The caller must ensure that the surface outlives the pointer this function returns, or else
it will end up pointing to garbage. The caller must also ensure that the memory the
pointer (non-transitively) points to is never written to (except inside an
UnsafeCell
) using this pointer or any pointer derived from it.
pub fn as_mut_ptr(&mut self) -> *mut I
[src]
Returns an unsafe mutable pointer to the surface's internal buffer.
The caller must ensure that the surface outlives the pointer this function returns, or else it will end up pointing to garbage.
pub fn as_slice(&self) -> &[I]
[src]
Extracts a slice referencing entire underlying buffer.
pub fn as_mut_slice(&mut self) -> &mut [I]
[src]
Extracts a mutable slice referencing entire underlying buffer.
pub fn clear<O: Into<I>>(&mut self, value: O)
[src]
Clears entire surface with pel value.
pub fn for_each<F, O>(&mut self, f: F) where
F: Fn(O) -> O,
O: From<I> + Into<I>,
[src]
F: Fn(O) -> O,
O: From<I> + Into<I>,
Transforms all pels using given function.
pub fn read<O: From<I>>(&self, x: usize, y: usize) -> Result<O>
[src]
pub fn write<O: Into<I>>(&mut self, x: usize, y: usize, value: O) -> Result<()>
[src]
pub unsafe fn read_unchecked<O: From<I>>(&self, x: usize, y: usize) -> O
[src]
Reads pel value.
Safety
It is undefined behaviour to provide indices that are out of surface bounds.
pub unsafe fn write_unchecked<O: Into<I>>(
&mut self,
x: usize,
y: usize,
value: O
)
[src]
&mut self,
x: usize,
y: usize,
value: O
)
Writes pel value.
Safety
It is undefined behaviour to provide indices that are out of surface bounds.
pub fn index(&self, x: usize, y: usize) -> Result<usize>
[src]
Calculates index of a pel at (x, y) of this surface.
(0, 0) is top left of the surface.
Errors
If indices are out of surface bounds, Error::OutOfBounds
is returned.
pub fn index_unchecked(&self, x: usize, y: usize) -> usize
[src]
Calculates index of a pel at (x, y) of this surface.
(0, 0) is top left of the surface.
This function doesn't check if index is in bounds, but is still safe.
Trait Implementations
impl<'s> Deref for TextureHandle<'s>
[src]
type Target = RawSurface<Pel>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'s> DerefMut for TextureHandle<'s>
[src]
impl<'s> Drop for TextureHandle<'s>
[src]
Auto Trait Implementations
impl<'s> RefUnwindSafe for TextureHandle<'s>
impl<'s> !Send for TextureHandle<'s>
impl<'s> !Sync for TextureHandle<'s>
impl<'s> Unpin for TextureHandle<'s>
impl<'s> !UnwindSafe for TextureHandle<'s>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,