pub struct TheDraw2D {
pub mask: Option<Vec<f32>>,
pub mask_size: (usize, usize),
pub fonts: Vec<Font>,
pub code_fonts: Vec<Font>,
}Fields§
§mask: Option<Vec<f32>>§mask_size: (usize, usize)§fonts: Vec<Font>§code_fonts: Vec<Font>Implementations§
Source§impl TheDraw2D
impl TheDraw2D
pub fn new() -> TheDraw2D
Sourcepub fn blend_mask(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
mask_frame: &[u8],
mask_size: &(usize, usize),
color: &[u8; 4],
)
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
Sourcepub fn rect(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
)
pub fn rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], )
Draws the given rectangle
Sourcepub fn rect_safe(
&self,
frame: &mut [u8],
rect: &(isize, isize, usize, usize),
stride: usize,
color: &[u8; 4],
safe_rect: &(usize, usize, usize, usize),
)
pub fn 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 and checks the frame boundaries.
Sourcepub fn blend_rect(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
)
pub fn blend_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], )
Blend the given rectangle
Sourcepub fn rect_outline(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
)
pub fn rect_outline( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], )
Draws the outline of a given rectangle
Sourcepub fn rect_outline_border(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
border: usize,
)
pub fn rect_outline_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], border: usize, )
Draws the outline of a given rectangle
Sourcepub fn rect_outline_border_open(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
border: usize,
)
pub fn rect_outline_border_open( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], border: usize, )
Draws the outline of a given rectangle with the right open
Sourcepub fn rect_outline_border_safe(
&self,
frame: &mut [u8],
rect: &(isize, isize, usize, usize),
stride: usize,
color: &[u8; 4],
border: isize,
safe_rect: &(usize, usize, usize, usize),
)
pub fn rect_outline_border_safe( &self, frame: &mut [u8], rect: &(isize, isize, usize, usize), stride: usize, color: &[u8; 4], border: isize, safe_rect: &(usize, usize, usize, usize), )
Draws the outline of a given rectangle
Sourcepub fn circle(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
radius: f32,
)
pub fn circle( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f32, )
Draws a circle
Sourcepub fn circle_with_border(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
radius: f32,
border_color: &[u8; 4],
border_size: f32,
)
pub fn circle_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], radius: f32, border_color: &[u8; 4], border_size: f32, )
Draws a circle with a border of a given size
Sourcepub fn rounded_rect(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
rounding: &(f32, f32, f32, f32),
)
pub fn rounded_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], rounding: &(f32, f32, f32, f32), )
Draws a rounded rect
Sourcepub fn rounded_rect_with_border(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
rounding: &(f32, f32, f32, f32),
border_color: &[u8; 4],
border_size: f32,
)
pub fn rounded_rect_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], rounding: &(f32, f32, f32, f32), border_color: &[u8; 4], border_size: f32, )
Draws a rounded rect with a border
Sourcepub fn hexagon_with_border(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
border_color: &[u8; 4],
border_size: f32,
)
pub fn hexagon_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], border_color: &[u8; 4], border_size: f32, )
Draws a hexagon with a border
Sourcepub fn rhombus_with_border(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
border_color: &[u8; 4],
border_size: f32,
)
pub fn rhombus_with_border( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], border_color: &[u8; 4], border_size: f32, )
Draws a rhombus rect with a border
Sourcepub fn square_pattern(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
color: &[u8; 4],
line_color: &[u8; 4],
pattern_size: usize,
)
pub fn square_pattern( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, color: &[u8; 4], line_color: &[u8; 4], pattern_size: usize, )
Draws a square pattern
pub fn wavy_line( &self, frame: &mut [u8], left: i32, base: i32, length: usize, amplitude: f32, _period: f32, stride: usize, color: &[u8; 4], )
Sourcepub fn text_rect(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
background: &[u8; 4],
halign: TheHorizontalAlign,
valign: TheVerticalAlign,
)
pub fn text_rect( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], background: &[u8; 4], halign: TheHorizontalAlign, valign: TheVerticalAlign, )
Draws a text aligned inside a rect
Sourcepub fn text_rect_clip(
&self,
frame: &mut [u8],
top_left: &Vec2<i32>,
clip_rect: &(usize, usize, usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
background: &[u8; 4],
halign: TheHorizontalAlign,
valign: TheVerticalAlign,
)
pub fn text_rect_clip( &self, frame: &mut [u8], top_left: &Vec2<i32>, clip_rect: &(usize, usize, usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], background: &[u8; 4], halign: TheHorizontalAlign, valign: TheVerticalAlign, )
Draws a text aligned inside a rect
Sourcepub fn text_rect_blend(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
halign: TheHorizontalAlign,
valign: TheVerticalAlign,
)
pub fn text_rect_blend( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], halign: TheHorizontalAlign, valign: TheVerticalAlign, )
Blends a text aligned inside a rect and blends it with the existing background
Sourcepub fn text_rect_blend_clip(
&self,
frame: &mut [u8],
top_left: &Vec2<i32>,
clip_rect: &(usize, usize, usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
halign: TheHorizontalAlign,
valign: TheVerticalAlign,
)
pub fn text_rect_blend_clip( &self, frame: &mut [u8], top_left: &Vec2<i32>, clip_rect: &(usize, usize, usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], halign: TheHorizontalAlign, valign: TheVerticalAlign, )
Blends a text aligned inside a rect and blends it with the existing background
Sourcepub fn text(
&self,
frame: &mut [u8],
pos: &(usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
background: &[u8; 4],
)
pub fn text( &self, frame: &mut [u8], pos: &(usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], background: &[u8; 4], )
Draws the given text
Sourcepub fn text_blend(
&self,
frame: &mut [u8],
pos: &(usize, usize),
stride: usize,
text: &str,
settings: TheFontSettings,
color: &[u8; 4],
)
pub fn text_blend( &self, frame: &mut [u8], pos: &(usize, usize), stride: usize, text: &str, settings: TheFontSettings, color: &[u8; 4], )
Draws the given text
Sourcepub fn get_text_layout(
&self,
text: &str,
font_settings: &TheFontSettings,
layout_settings: LayoutSettings,
) -> Layout
pub fn get_text_layout( &self, text: &str, font_settings: &TheFontSettings, layout_settings: LayoutSettings, ) -> Layout
Returns the layout of the given text
Sourcepub fn get_text_size(
&self,
text: &str,
settings: &TheFontSettings,
) -> (usize, usize)
pub fn get_text_size( &self, text: &str, settings: &TheFontSettings, ) -> (usize, usize)
Returns the size of the given text
Sourcepub fn copy_slice(
&self,
dest: &mut [u8],
source: &[u8],
rect: &(usize, usize, usize, usize),
dest_stride: usize,
)
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
Sourcepub fn blend_slice(
&self,
dest: &mut [u8],
source: &[u8],
rect: &(usize, usize, usize, usize),
dest_stride: usize,
)
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
Sourcepub fn blend_slice_alpha(
&self,
dest: &mut [u8],
source: &[u8],
rect: &(usize, usize, usize, usize),
dest_stride: usize,
alpha: f32,
)
pub fn blend_slice_alpha( &self, dest: &mut [u8], source: &[u8], rect: &(usize, usize, usize, usize), dest_stride: usize, alpha: f32, )
Blends rect from the source frame into the dest frame
Sourcepub fn blend_slice_f32(
&self,
dest: &mut [u8],
source: &[f32],
rect: &(usize, usize, usize, usize),
dest_stride: usize,
)
pub fn blend_slice_f32( &self, dest: &mut [u8], source: &[f32], rect: &(usize, usize, usize, usize), dest_stride: usize, )
Blends rect from the source frame into the dest frame
Sourcepub fn blend_slice_offset(
&self,
dest: &mut [u8],
source: &[u8],
rect: &(usize, usize, usize, usize),
offset: usize,
dest_stride: usize,
)
pub fn blend_slice_offset( &self, dest: &mut [u8], source: &[u8], rect: &(usize, usize, usize, usize), offset: usize, dest_stride: usize, )
Blends rect from the source frame into the dest frame with a vertical source offset (used by scrolling containers)
Sourcepub fn blend_slice_safe(
&self,
dest: &mut [u8],
source: &[u8],
rect: &(isize, isize, usize, usize),
dest_stride: usize,
safe_rect: &(usize, usize, usize, usize),
)
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
Sourcepub fn scale_chunk(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
source_frame: &[u8],
source_size: &(usize, usize),
blend_factor: f32,
)
pub fn scale_chunk( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, source_frame: &[u8], source_size: &(usize, usize), blend_factor: f32, )
Scale a chunk to the destination size
Sourcepub fn blend_scale_chunk(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
source_frame: &[u8],
source_size: &(usize, usize),
)
pub fn blend_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
Sourcepub fn blend_scale_chunk_alpha(
&self,
frame: &mut [u8],
rect: &(usize, usize, usize, usize),
stride: usize,
source_frame: &[u8],
source_size: &(usize, usize),
alpha: f32,
)
pub fn blend_scale_chunk_alpha( &self, frame: &mut [u8], rect: &(usize, usize, usize, usize), stride: usize, source_frame: &[u8], source_size: &(usize, usize), alpha: f32, )
Scale a chunk to the destination size with a global alpha
Sourcepub fn blend_scale_chunk_linear(
&self,
dest: &mut [u8],
dest_rect: &(usize, usize, usize, usize),
dest_stride: usize,
source: &[u8],
source_size: &(usize, usize),
)
pub fn blend_scale_chunk_linear( &self, dest: &mut [u8], dest_rect: &(usize, usize, usize, usize), dest_stride: usize, source: &[u8], source_size: &(usize, usize), )
Scale a chunk to the destination size with linear interpolation and blend onto destination
pub fn add_font_data<Data>(&mut self, data: Data)
pub fn add_code_font_data<Data>(&mut self, data: Data)
Sourcepub fn mix_color(&self, a: &[u8; 4], b: &[u8; 4], v: f32) -> [u8; 4]
pub fn mix_color(&self, a: &[u8; 4], b: &[u8; 4], v: f32) -> [u8; 4]
Mixes two colors based on v
pub fn length(&self, v: (f32, f32)) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TheDraw2D
impl RefUnwindSafe for TheDraw2D
impl Send for TheDraw2D
impl Sync for TheDraw2D
impl Unpin for TheDraw2D
impl UnsafeUnpin for TheDraw2D
impl UnwindSafe for TheDraw2D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.