Surface

Struct Surface 

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

Implementations§

Source§

impl Surface

Source

pub fn from_canvas(element_id: &str) -> Surface

Source

pub fn from_size(width: usize, height: usize) -> Surface

Source

pub fn from_image(image_url: &str) -> Surface

Source

pub fn loaded(&self) -> bool

Source

pub fn width(&self) -> usize

Source

pub fn height(&self) -> usize

Source

pub fn get_pixel(&self, x: usize, y: usize) -> [u8; 4]

Source

pub fn resize(&self, width: usize, height: usize) -> Surface

Source

pub fn draw_surface( &self, src: &Surface, alpha: u8, x: f32, y: f32, w: f32, h: f32, )

Source

pub fn draw_surface_rotated( &self, src: &Surface, alpha: u8, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn draw_subsurface( &self, src: &Surface, alpha: u8, src_x: usize, src_y: usize, src_w: usize, src_h: usize, x: f32, y: f32, w: f32, h: f32, )

Source

pub fn draw_subsurface_rotated( &self, src: &Surface, alpha: u8, src_x: usize, src_y: usize, src_w: usize, src_h: usize, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn draw_rect( &self, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, w: f32, h: f32, )

Source

pub fn draw_rect_rotated( &self, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn clear_rect(&self, x: f32, y: f32, w: f32, h: f32)

Source

pub fn clear_rect_rotated( &self, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn draw_oval( &self, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, w: f32, h: f32, )

Source

pub fn draw_oval_rotated( &self, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn clear_oval(&self, x: f32, y: f32, w: f32, h: f32)

Source

pub fn clear_oval_rotated( &self, x: f32, y: f32, w: f32, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn draw_line( &self, red: u8, green: u8, blue: u8, alpha: u8, x1: f32, y1: f32, x2: f32, y2: f32, w: f32, )

Source

pub fn clear_line(&self, x1: f32, y1: f32, x2: f32, y2: f32, w: f32)

Source

pub fn draw_quadratic_bezier( &self, red: u8, green: u8, blue: u8, alpha: u8, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, w: f32, )

Source

pub fn clear_quadratic_bezier( &self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, w: f32, )

Source

pub fn draw_cubic_bezier( &self, red: u8, green: u8, blue: u8, alpha: u8, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, x4: f32, y4: f32, w: f32, )

Source

pub fn clear_cubic_bezier( &self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32, x4: f32, y4: f32, w: f32, )

Source

pub fn draw_text( &self, text: &str, font: &str, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, align: TextAlign, h: f32, )

Source

pub fn clear_text( &self, text: &str, font: &str, x: f32, y: f32, align: TextAlign, h: f32, )

Source

pub fn draw_text_rotated( &self, text: &str, font: &str, red: u8, green: u8, blue: u8, alpha: u8, x: f32, y: f32, align: TextAlign, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn clear_text_rotated( &self, text: &str, font: &str, x: f32, y: f32, align: TextAlign, h: f32, rot_x: f32, rot_y: f32, rot_angle: f32, )

Source

pub fn fill(&self, red: u8, green: u8, blue: u8, alpha: u8)

Trait Implementations§

Source§

impl Drop for Surface

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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