Struct Texture

Source
pub struct Texture { /* private fields */ }

Implementations§

Source§

impl Texture

Source

pub fn new( gl: Gl, width: u32, height: u32, data_type: TextureType, format: TextureFormat, data: TextureContent, ) -> Result<Texture, GlError>

Source

pub fn gl(&self) -> Gl

Source

pub fn width(&self) -> u32

Source

pub fn height(&self) -> u32

Source

pub fn data_type(&self) -> TextureType

Source

pub fn format(&self) -> TextureFormat

Source

pub fn size(&self) -> (u32, u32)

Source

pub fn filter(&self) -> TextureFilter

Source

pub fn set_filter(&self, filter: TextureFilter)

Source

pub fn write_image(&self, image: &HtmlImageElement) -> Result<(), GlError>

Source

pub fn write_bytes(&self, bytes: &Vec<u8>) -> Result<(), GlError>

Source

pub fn read_pixels_into_array(&self, array: &mut [u8]) -> Result<(), GlError>

Read RGBA 8-bit data into vector

Source

pub fn read_pixels_into_buffer( &self, buffer: &Uint8Array, ) -> Result<(), GlError>

Read RGBA 8-bit data into UInt8Array

Source

pub fn read_pixels_array(&self) -> Result<Vec<u8>, GlError>

Source

pub fn read_pixels_buffer(&self) -> Result<Uint8Array, GlError>

Source

pub fn clear(&self, r: f32, g: f32, b: f32, a: f32) -> Result<(), GlError>

Trait Implementations§

Source§

impl Clone for Texture

Source§

fn clone(&self) -> Texture

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Texture

Source§

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

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

impl IntoUniform for Texture

Source§

impl PartialEq for Texture

Source§

fn eq(&self, other: &Texture) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TypeMark for Texture

Source§

impl Eq for Texture

Source§

impl StructuralPartialEq for Texture

Auto Trait Implementations§

§

impl Freeze for Texture

§

impl !RefUnwindSafe for Texture

§

impl !Send for Texture

§

impl !Sync for Texture

§

impl Unpin for Texture

§

impl !UnwindSafe for Texture

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.