[−][src]Struct sdl2::render::Texture
A texture for a rendering context.
Every Texture is owned by a TextureCreator. Internally, a texture is destroyed via its Drop
implementation. A texture can only be used by the Canvas it was originally created from, it
is undefined behavior otherwise.
Methods
impl<'r> Texture<'r>[src]
impl<'r> Texture<'r>pub fn query(&self) -> TextureQuery[src]
pub fn query(&self) -> TextureQueryQueries the attributes of the texture.
pub fn set_color_mod(&mut self, red: u8, green: u8, blue: u8)[src]
pub fn set_color_mod(&mut self, red: u8, green: u8, blue: u8)Sets an additional color value multiplied into render copy operations.
pub fn color_mod(&self) -> (u8, u8, u8)[src]
pub fn color_mod(&self) -> (u8, u8, u8)Gets the additional color value multiplied into render copy operations.
pub fn set_alpha_mod(&mut self, alpha: u8)[src]
pub fn set_alpha_mod(&mut self, alpha: u8)Sets an additional alpha value multiplied into render copy operations.
pub fn alpha_mod(&self) -> u8[src]
pub fn alpha_mod(&self) -> u8Gets the additional alpha value multiplied into render copy operations.
pub fn set_blend_mode(&mut self, blend: BlendMode)[src]
pub fn set_blend_mode(&mut self, blend: BlendMode)Sets the blend mode used for drawing operations (Fill and Line).
pub fn blend_mode(&self) -> BlendMode[src]
pub fn blend_mode(&self) -> BlendModeGets the blend mode used for texture copy operations.
pub fn update<R>(
&mut self,
rect: R,
pixel_data: &[u8],
pitch: usize
) -> Result<(), UpdateTextureError> where
R: Into<Option<Rect>>, [src]
pub fn update<R>(
&mut self,
rect: R,
pixel_data: &[u8],
pitch: usize
) -> Result<(), UpdateTextureError> where
R: Into<Option<Rect>>, Updates the given texture rectangle with new pixel data.
pitch is the number of bytes in a row of pixel data, including padding
between lines
- If
rectisNone, the entire texture is updated.
pub fn update_yuv<R>(
&mut self,
rect: R,
y_plane: &[u8],
y_pitch: usize,
u_plane: &[u8],
u_pitch: usize,
v_plane: &[u8],
v_pitch: usize
) -> Result<(), UpdateTextureYUVError> where
R: Into<Option<Rect>>, [src]
pub fn update_yuv<R>(
&mut self,
rect: R,
y_plane: &[u8],
y_pitch: usize,
u_plane: &[u8],
u_pitch: usize,
v_plane: &[u8],
v_pitch: usize
) -> Result<(), UpdateTextureYUVError> where
R: Into<Option<Rect>>, Updates a rectangle within a planar YV12 or IYUV texture with new pixel data.
pub fn with_lock<F, R, R2>(&mut self, rect: R2, func: F) -> Result<R, String> where
F: FnOnce(&mut [u8], usize) -> R,
R2: Into<Option<Rect>>, [src]
pub fn with_lock<F, R, R2>(&mut self, rect: R2, func: F) -> Result<R, String> where
F: FnOnce(&mut [u8], usize) -> R,
R2: Into<Option<Rect>>, Locks the texture for write-only pixel access. The texture must have been created with streaming access.
F is a function that is passed the write-only texture buffer,
and the pitch of the texture (size of a row in bytes).
Remarks
As an optimization, the pixels made available for editing don't necessarily contain the old texture data. This is a write-only operation, and if you need to keep a copy of the texture data you should do that at the application level.
pub unsafe fn gl_bind_texture(&mut self) -> (f32, f32)[src]
pub unsafe fn gl_bind_texture(&mut self) -> (f32, f32)Binds an OpenGL/ES/ES2 texture to the current context for use with when rendering OpenGL primitives directly.
pub unsafe fn gl_unbind_texture(&mut self)[src]
pub unsafe fn gl_unbind_texture(&mut self)Unbinds an OpenGL/ES/ES2 texture from the current context.
pub fn gl_with_bind<R, F: FnOnce(f32, f32) -> R>(&mut self, f: F) -> R[src]
pub fn gl_with_bind<R, F: FnOnce(f32, f32) -> R>(&mut self, f: F) -> RBinds and unbinds an OpenGL/ES/ES2 texture from the current context.
pub fn raw(&self) -> *mut SDL_Texture[src]
pub fn raw(&self) -> *mut SDL_TextureTrait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId