Draw2D

Struct Draw2D 

Source
pub struct Draw2D {}

Implementations§

Source§

impl Draw2D

Source

pub fn blend_mask( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, mask_frame: &[u8], mask_size: &(usize, usize), color: &[u8; 4], )

Draws the mask

Source

pub fn draw_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], )

Draws the given rectangle

Source

pub fn draw_rect_safe( &self, frame: &mut [u8], rect: &(isize, isize, usize, usize), stride: usize, color: &[u8; 4], safe_rect: &(usize, usize, usize, usize), )

Draws the given rectangle

Source

pub fn blend_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], )

Blend the given rectangle

Source

pub fn draw_rect_outline( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: [u8; 4], )

Draws the outline of a given rectangle

Source

pub fn draw_circle( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f64, )

Draws a circle

Source

pub fn _draw_circle_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f64, border_color: &[u8; 4], border_size: f64, )

Draws a circle with a border of a given size

Source

pub fn draw_rounded_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, size: &(f64, f64), color: &[u8; 4], rounding: &(f64, f64, f64, f64), )

Draws a rounded rect

Source

pub fn blend_rounded_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, size: &(f64, f64), color: &[u8; 4], rounding: &(f64, f64, f64, f64), )

Blends a rounded rect

Source

pub fn draw_rounded_rect_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, size: &(f64, f64), color: &[u8; 4], rounding: &(f64, f64, f64, f64), border_color: &[u8; 4], border_size: f64, )

Draws a rounded rect with a border

Source

pub fn draw_square_pattern( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], line_color: &[u8; 4], pattern_size: usize, )

Draws the given rectangle

Source

pub fn draw_text_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, font: &Font, size: f32, text: &str, color: &[u8; 4], background: &[u8; 4], align: TextAlignment, )

Draws a text aligned inside a rect

Source

pub fn blend_text_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, font: &Font, size: f32, text: &str, color: &[u8; 4], align: TextAlignment, )

Blends a text aligned inside a rect and blends it with the existing background

Source

pub fn draw_text( &self, frame: &mut [u8], pos: &(usize, usize), stride: usize, font: &Font, size: f32, text: &str, color: &[u8; 4], background: &[u8; 4], )

Draws the given text

Source

pub fn get_text_size( &self, font: &Font, size: f32, text: &str, ) -> (usize, usize)

Returns the size of the given text

Source

pub fn copy_slice( &self, dest: &mut [u8], source: &[u8], rect: &(usize, usize, usize, usize), dest_stride: usize, )

Copies rect from the source frame into the dest frame

Source

pub fn blend_slice( &self, dest: &mut [u8], source: &[u8], rect: &(usize, usize, usize, usize), dest_stride: usize, )

Blends rect from the source frame into the dest frame

Source

pub fn blend_slice_safe( &self, dest: &mut [u8], source: &[u8], rect: &(isize, isize, usize, usize), dest_stride: usize, safe_rect: &(usize, usize, usize, usize), )

Blends rect from the source frame into the dest frame and honors the safe rect

Source

pub fn _scale_chunk( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, source_frame: &[u8], source_size: &(usize, usize), )

Scale a chunk to the destination size

Source

pub fn _smoothstep(&self, e0: f64, e1: f64, x: f64) -> f64

Smoothstep for f64

Source

pub fn mix_color(&self, a: &[u8; 4], b: &[u8; 4], v: f64) -> [u8; 4]

Mixes two colors based on v

Source

pub fn length(&self, v: (f64, f64)) -> f64

Source

pub fn draw_hover_help( &self, frame: &mut [u8], pos: (usize, usize), font: &Font, title: Option<String>, text: String, safe_rect: (usize, usize, usize, usize), )

Draw hover help

Auto Trait Implementations§

§

impl Freeze for Draw2D

§

impl RefUnwindSafe for Draw2D

§

impl Send for Draw2D

§

impl Sync for Draw2D

§

impl Unpin for Draw2D

§

impl UnwindSafe for Draw2D

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.