Struct Canvas

Source
pub struct Canvas<T: CanvasBackend> { /* private fields */ }

Implementations§

Source§

impl<T: CanvasBackend> Canvas<T>

Source

pub fn from_layer( context: Option<&DeviceContext<T::DeviceContextType>>, layer: &Layer<T::LayerType>, ) -> Result<Self, GraphicsError>

Source

pub fn from_window( context: Option<&DeviceContext<T::DeviceContextType>>, window: &Window, ) -> Result<Self, GraphicsError>

Source

pub fn device_context(&self) -> Option<DeviceContext<T::DeviceContextType>>

Source

pub fn size(&self) -> FSize

Source

pub fn pixel_size(&self) -> ISize

Source

pub fn bounds(&self) -> FRect

Source

pub fn save(&mut self) -> bool

Source

pub fn restore(&mut self) -> bool

Source

pub fn begin_draw(&mut self)

Source

pub fn end_draw(&mut self)

Source

pub fn get_opacity(&self) -> Float

Source

pub fn set_opacity(&mut self, opacity: Float)

Source

pub fn get_blend_mode(&self) -> BlendMode

Source

pub fn set_blend_mode(&mut self, mode: BlendMode)

Source

pub fn get_draw_mode(&self) -> DrawMode

Source

pub fn set_draw_mode(&mut self, mode: DrawMode)

Source

pub fn get_line_dash(&self) -> (Option<Vec<Float>>, Float)

Source

pub fn set_line_dash(&mut self, dashes: &[Float], offset: Float)

Source

pub fn get_matrix(&self) -> Matrix<T::MatrixType>

Source

pub fn set_matrix(&mut self, matrix: &Matrix<T::MatrixType>)

Source

pub fn concat_matrix(&mut self, matrix: &Matrix<T::MatrixType>)

Source

pub fn get_miter_limit(&self) -> Float

Source

pub fn set_miter_limit(&mut self, miter_limit: Float)

Source

pub fn get_smooth(&self) -> bool

Source

pub fn set_smooth(&mut self, smooth: bool)

Source

pub fn get_stroke_cap(&self) -> Cap

Source

pub fn set_stroke_cap(&mut self, cap: Cap)

Source

pub fn get_stroke_join(&self) -> Join

Source

pub fn set_stroke_join(&mut self, join: Join)

Source

pub fn get_stroke_width(&self) -> Float

Source

pub fn set_stroke_width(&mut self, width: Float)

Source

pub fn set_brush(&mut self, brush: &Brush<T::BrushType>)

Source

pub fn get_font_family(&self) -> &str

Source

pub fn set_font_family(&mut self, family: &str)

Source

pub fn get_font_size(&self) -> Float

Source

pub fn set_font_size(&mut self, size: Float)

Source

pub fn get_font_style(&self) -> FontStyle

Source

pub fn set_font_style(&mut self, style: FontStyle)

Source

pub fn get_font_weight(&self) -> FontWeight

Source

pub fn set_font_weight(&mut self, weight: FontWeight)

Source

pub fn get_text_alignment(&self) -> TextAlignment

Source

pub fn set_text_alignment(&mut self, alignment: TextAlignment)

Source

pub fn get_text_color(&self) -> Color

Source

pub fn set_text_color(&mut self, color: Color)

Source

pub fn rotate(&mut self, angle: Float)

Source

pub fn scale(&mut self, x: Float, y: Float)

Source

pub fn translate(&mut self, x: Float, y: Float)

Source

pub fn clear(&mut self, color: Color)

Source

pub fn clip_to_rect(&mut self, rect: FRect)

Source

pub fn clip_to_path(&mut self, path: &Path<T::PathType>)

Source

pub fn draw_line(&mut self, x1: Float, y1: Float, x2: Float, y2: Float) -> bool

Source

pub fn draw_rect( &mut self, x: Float, y: Float, width: Float, height: Float, ) -> bool

Source

pub fn draw_rounded_rect( &mut self, x: Float, y: Float, width: Float, height: Float, radius: Float, ) -> bool

Source

pub fn draw_circle(&mut self, x: Float, y: Float, radius: Float) -> bool

Source

pub fn draw_ellipse( &mut self, x: Float, y: Float, width: Float, height: Float, ) -> bool

Source

pub fn draw_path(&mut self, path: &Path<T::PathType>) -> bool

Source

pub fn draw_bitmap( &mut self, bitmap: &Bitmap<T::BitmapType>, source_rect: Option<FRect>, dest_rect: FRect, ) -> bool

Source

pub fn draw_layer( &mut self, layer: &Layer<T::LayerType>, dest_rect: FRect, ) -> bool

Source

pub fn draw_text(&mut self, text: &str, rect: FRect) -> bool

Source

pub fn draw_text_at(&mut self, text: &str, x: Float, y: Float) -> bool

Source

pub fn map_rect(&self, rect: FRect) -> FRect

Source

pub fn fill_rect( &mut self, x: Float, y: Float, width: Float, height: Float, mask: Option<&Bitmap<T::BitmapType>>, ) -> bool

Source§

impl Canvas<DefaultCanvas>

Auto Trait Implementations§

§

impl<T> Freeze for Canvas<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Canvas<T>
where T: RefUnwindSafe,

§

impl<T> Send for Canvas<T>
where T: Send,

§

impl<T> Sync for Canvas<T>
where T: Sync,

§

impl<T> Unpin for Canvas<T>
where T: Unpin,

§

impl<T> UnwindSafe for Canvas<T>
where T: UnwindSafe,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more