[−][src]Struct crow::Texture
A two dimensional texture stored in video memory.
Texture
s are copy-on-write, so cloning a texture is cheap
until the clone or the original is modified.
Transparency is supported.
Methods
impl Texture
[src]
pub fn new(
ctx: &mut Context,
dimensions: (u32, u32)
) -> Result<Self, ErrDontCare>
[src]
ctx: &mut Context,
dimensions: (u32, u32)
) -> Result<Self, ErrDontCare>
Creates a new texture with the given dimensions
.
The content of the texture is undefined after its creation.
pub fn from_image(
ctx: &mut Context,
image: RgbaImage
) -> Result<Self, ErrDontCare>
[src]
ctx: &mut Context,
image: RgbaImage
) -> Result<Self, ErrDontCare>
pub fn load<P: AsRef<Path>>(
ctx: &mut Context,
path: P
) -> Result<Texture, LoadTextureError>
[src]
ctx: &mut Context,
path: P
) -> Result<Texture, LoadTextureError>
Loads a texture from an image located at path
.
pub fn get_section(&self, position: (u32, u32), size: (u32, u32)) -> Texture
[src]
Returns the part of self
specified by position
and size
as a Texture
.
Panics
This function panics if part of the requested section would be outside of the original texture.
pub fn dimensions(&self) -> (u32, u32)
[src]
pub fn width(&self) -> u32
[src]
pub fn height(&self) -> u32
[src]
pub fn get_image_data(&self, ctx: &mut Context) -> RgbaImage
[src]
Stores the current state of this Texture
in an image.
This function is fairly slow and should not be used carelessly.
pub fn clear_depth(&mut self, ctx: &mut Context) -> Result<(), ErrDontCare>
[src]
Resets the depth buffer to 1.0
for every pixel.
Trait Implementations
impl Clone for Texture
[src]
impl Debug for Texture
[src]
impl DrawTarget for Texture
[src]
fn receive_draw(
&mut self,
ctx: &mut Context,
texture: &Texture,
position: (i32, i32),
config: &DrawConfig
) -> Result<(), ErrDontCare>
[src]
&mut self,
ctx: &mut Context,
texture: &Texture,
position: (i32, i32),
config: &DrawConfig
) -> Result<(), ErrDontCare>
Draws the texture
onto self
.
This permanently alters self
, in case
the original is still required,
consider cloning this Texture
first.
It is recommended to call Context::draw
instead of
using this method directly.
fn receive_clear_color(
&mut self,
ctx: &mut Context,
color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>
[src]
&mut self,
ctx: &mut Context,
color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>
fn receive_line(
&mut self,
ctx: &mut Context,
from: (i32, i32),
to: (i32, i32),
color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>
[src]
&mut self,
ctx: &mut Context,
from: (i32, i32),
to: (i32, i32),
color: (f32, f32, f32, f32)
) -> Result<(), ErrDontCare>
Auto Trait Implementations
impl !RefUnwindSafe for Texture
impl !Send for Texture
impl !Sync for Texture
impl Unpin for Texture
impl UnwindSafe for Texture
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> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,