pub struct CanvasData<'a> {
    backend: Box<dyn Backend>,
    drawtarget: Box<dyn GenericDrawTarget>,
    path_state: Option<PathState>,
    state: CanvasPaintState<'a>,
    saved_states: Vec<CanvasPaintState<'a>>,
    webrender_api: Box<dyn WebrenderApi>,
    image_key: Option<ImageKey>,
    old_image_key: Option<ImageKey>,
    very_old_image_key: Option<ImageKey>,
    font_cache_thread: Mutex<FontCacheThread>,
}

Fields§

§backend: Box<dyn Backend>§drawtarget: Box<dyn GenericDrawTarget>§path_state: Option<PathState>§state: CanvasPaintState<'a>§saved_states: Vec<CanvasPaintState<'a>>§webrender_api: Box<dyn WebrenderApi>§image_key: Option<ImageKey>§old_image_key: Option<ImageKey>

An old webrender image key that can be deleted when the next epoch ends.

§very_old_image_key: Option<ImageKey>

An old webrender image key that can be deleted when the current epoch ends.

§font_cache_thread: Mutex<FontCacheThread>

Implementations§

source§

impl<'a> CanvasData<'a>

source

pub fn new( size: Size2D<u64>, webrender_api: Box<dyn WebrenderApi>, antialias: AntialiasMode, font_cache_thread: FontCacheThread ) -> CanvasData<'a>

source

pub fn draw_image( &mut self, image_data: &[u8], image_size: Size2D<f64>, dest_rect: Rect<f64>, source_rect: Rect<f64>, smoothing_enabled: bool, premultiply: bool )

source

pub fn save_context_state(&mut self)

source

pub fn restore_context_state(&mut self)

source

pub fn fill_text( &mut self, text: String, x: f64, y: f64, max_width: Option<f64>, is_rtl: bool )

source

fn text_origin( &self, x: f32, y: f32, metrics: &Metrics, width: f32, is_rtl: bool ) -> Point2D<f32>

source

pub fn fill_rect(&mut self, rect: &Rect<f32>)

source

pub fn clear_rect(&mut self, rect: &Rect<f32>)

source

pub fn stroke_rect(&mut self, rect: &Rect<f32>)

source

pub fn begin_path(&mut self)

source

pub fn close_path(&mut self)

source

fn ensure_path(&mut self)

source

fn path(&self) -> &Path

source

pub fn fill(&mut self)

source

pub fn stroke(&mut self)

source

pub fn clip(&mut self)

source

pub fn is_point_in_path( &mut self, x: f64, y: f64, _fill_rule: FillRule, chan: IpcSender<bool> )

source

pub fn move_to(&mut self, point: &Point2D<f32>)

source

pub fn line_to(&mut self, point: &Point2D<f32>)

source

fn path_builder(&mut self) -> PathBuilderRef<'_>

source

pub fn rect(&mut self, rect: &Rect<f32>)

source

pub fn quadratic_curve_to(&mut self, cp: &Point2D<f32>, endpoint: &Point2D<f32>)

source

pub fn bezier_curve_to( &mut self, cp1: &Point2D<f32>, cp2: &Point2D<f32>, endpoint: &Point2D<f32> )

source

pub fn arc( &mut self, center: &Point2D<f32>, radius: f32, start_angle: f32, end_angle: f32, ccw: bool )

source

pub fn arc_to(&mut self, cp1: &Point2D<f32>, cp2: &Point2D<f32>, radius: f32)

source

pub fn ellipse( &mut self, center: &Point2D<f32>, radius_x: f32, radius_y: f32, rotation_angle: f32, start_angle: f32, end_angle: f32, ccw: bool )

source

pub fn set_fill_style(&mut self, style: FillOrStrokeStyle)

source

pub fn set_stroke_style(&mut self, style: FillOrStrokeStyle)

source

pub fn set_line_width(&mut self, width: f32)

source

pub fn set_line_cap(&mut self, cap: LineCapStyle)

source

pub fn set_line_join(&mut self, join: LineJoinStyle)

source

pub fn set_miter_limit(&mut self, limit: f32)

source

pub fn get_transform(&self) -> Transform2D<f32>

source

pub fn set_transform(&mut self, transform: &Transform2D<f32>)

source

pub fn set_global_alpha(&mut self, alpha: f32)

source

pub fn set_global_composition(&mut self, op: CompositionOrBlending)

source

pub fn recreate(&mut self, size: Option<Size2D<u64>>)

source

pub fn send_pixels(&mut self, chan: IpcSender<IpcSharedMemory>)

source

pub fn send_data(&mut self, chan: IpcSender<CanvasImageData>)

source

pub fn put_image_data(&mut self, imagedata: Vec<u8>, rect: Rect<u64>)

source

pub fn set_shadow_offset_x(&mut self, value: f64)

source

pub fn set_shadow_offset_y(&mut self, value: f64)

source

pub fn set_shadow_blur(&mut self, value: f64)

source

pub fn set_shadow_color(&mut self, value: AbsoluteColor)

source

pub fn set_font(&mut self, font_style: FontStyleStruct)

source

pub fn set_text_align(&mut self, text_align: TextAlign)

source

pub fn set_text_baseline(&mut self, text_baseline: TextBaseline)

source

fn need_to_draw_shadow(&self) -> bool

source

fn create_draw_target_for_shadow( &self, source_rect: &Rect<f32> ) -> Box<dyn GenericDrawTarget>

source

fn draw_with_shadow<F>(&self, rect: &Rect<f32>, draw_shadow_source: F)where F: FnOnce(&mut dyn GenericDrawTarget),

source

pub fn read_pixels( &self, read_rect: Rect<u64>, canvas_size: Size2D<u64> ) -> Vec<u8>

It reads image data from the canvas canvas_size: The size of the canvas we’re reading from read_rect: The area of the canvas we want to read from

Trait Implementations§

source§

impl<'a> Drop for CanvasData<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for CanvasData<'a>

§

impl<'a> !Send for CanvasData<'a>

§

impl<'a> !Sync for CanvasData<'a>

§

impl<'a> Unpin for CanvasData<'a>

§

impl<'a> !UnwindSafe for CanvasData<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

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
source§

impl<T> Erased for T

source§

impl<T> ErasedDestructor for Twhere T: 'static,

source§

impl<T> MaybeSendSync for T