#[repr(C)]pub(crate) struct CanvasRenderingContext2D {
reflector_: Reflector,
canvas: Option<Dom<HTMLCanvasElement>>,
canvas_state: CanvasState,
}
Fields§
§reflector_: Reflector
§canvas: Option<Dom<HTMLCanvasElement>>
For rendering contexts created by an HTML canvas element, this is Some, for ones created by a paint worklet, this is None.
canvas_state: CanvasState
Implementations§
source§impl CanvasRenderingContext2D
impl CanvasRenderingContext2D
fn __assert_parent_type(&self)
source§impl CanvasRenderingContext2D
impl CanvasRenderingContext2D
pub(crate) fn new_inherited( global: &GlobalScope, canvas: Option<&HTMLCanvasElement>, size: Size2D<u32>, ) -> CanvasRenderingContext2D
pub(crate) fn new( global: &GlobalScope, canvas: &HTMLCanvasElement, size: Size2D<u32>, ) -> Root<Dom<CanvasRenderingContext2D>>
pub(crate) fn set_bitmap_dimensions(&self, size: Size2D<u32>)
fn reset_to_initial_state(&self)
pub(crate) fn set_canvas_bitmap_dimensions(&self, size: Size2D<u64>)
pub(crate) fn mark_as_dirty(&self)
pub(crate) fn take_missing_image_urls(&self) -> Vec<ServoUrl>
pub(crate) fn get_canvas_id(&self) -> CanvasId
pub(crate) fn send_canvas_2d_msg(&self, msg: Canvas2dMsg)
pub(crate) fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg>
pub(crate) fn origin_is_clean(&self) -> bool
pub(crate) fn get_rect(&self, rect: Rect<u32>) -> Vec<u8> ⓘ
Trait Implementations§
source§impl CanvasRenderingContext2DMethods<DomTypeHolder> for CanvasRenderingContext2D
impl CanvasRenderingContext2DMethods<DomTypeHolder> for CanvasRenderingContext2D
fn Canvas(&self) -> Root<Dom<HTMLCanvasElement>>
fn Save(&self)
fn Restore(&self)
fn Scale(&self, x: f64, y: f64)
fn Rotate(&self, angle: f64)
fn Translate(&self, x: f64, y: f64)
fn Transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)
fn GetTransform(&self, can_gc: CanGc) -> Root<Dom<DOMMatrix>>
fn SetTransform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)
fn ResetTransform(&self)
fn GlobalAlpha(&self) -> f64
fn SetGlobalAlpha(&self, alpha: f64)
fn GlobalCompositeOperation(&self) -> DOMString
fn SetGlobalCompositeOperation(&self, op_str: DOMString)
fn FillRect(&self, x: f64, y: f64, width: f64, height: f64)
fn ClearRect(&self, x: f64, y: f64, width: f64, height: f64)
fn StrokeRect(&self, x: f64, y: f64, width: f64, height: f64)
fn BeginPath(&self)
fn ClosePath(&self)
fn Fill(&self, fill_rule: CanvasFillRule)
fn Stroke(&self)
fn Clip(&self, fill_rule: CanvasFillRule)
fn IsPointInPath(&self, x: f64, y: f64, fill_rule: CanvasFillRule) -> bool
fn FillText( &self, text: DOMString, x: f64, y: f64, max_width: Option<f64>, can_gc: CanGc, )
fn MeasureText(&self, text: DOMString, can_gc: CanGc) -> Root<Dom<TextMetrics>>
fn Font(&self) -> DOMString
fn SetFont(&self, value: DOMString, can_gc: CanGc)
fn TextAlign(&self) -> CanvasTextAlign
fn SetTextAlign(&self, value: CanvasTextAlign)
fn TextBaseline(&self) -> CanvasTextBaseline
fn SetTextBaseline(&self, value: CanvasTextBaseline)
fn Direction(&self) -> CanvasDirection
fn SetDirection(&self, value: CanvasDirection)
fn DrawImage( &self, image: CanvasImageSource, dx: f64, dy: f64, ) -> Result<(), Error>
fn DrawImage_( &self, image: CanvasImageSource, dx: f64, dy: f64, dw: f64, dh: f64, ) -> Result<(), Error>
fn DrawImage__( &self, image: CanvasImageSource, sx: f64, sy: f64, sw: f64, sh: f64, dx: f64, dy: f64, dw: f64, dh: f64, ) -> Result<(), Error>
fn MoveTo(&self, x: f64, y: f64)
fn LineTo(&self, x: f64, y: f64)
fn Rect(&self, x: f64, y: f64, width: f64, height: f64)
fn QuadraticCurveTo(&self, cpx: f64, cpy: f64, x: f64, y: f64)
fn BezierCurveTo( &self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64, )
fn Arc( &self, x: f64, y: f64, r: f64, start: f64, end: f64, ccw: bool, ) -> Result<(), Error>
fn ArcTo( &self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, r: f64, ) -> Result<(), Error>
fn Ellipse( &self, x: f64, y: f64, rx: f64, ry: f64, rotation: f64, start: f64, end: f64, ccw: bool, ) -> Result<(), Error>
fn ImageSmoothingEnabled(&self) -> bool
fn SetImageSmoothingEnabled(&self, value: bool)
fn StrokeStyle(&self) -> StringOrCanvasGradientOrCanvasPattern
fn SetStrokeStyle( &self, value: StringOrCanvasGradientOrCanvasPattern, can_gc: CanGc, )
fn FillStyle(&self) -> StringOrCanvasGradientOrCanvasPattern
fn SetFillStyle( &self, value: StringOrCanvasGradientOrCanvasPattern, can_gc: CanGc, )
fn CreateImageData( &self, sw: i32, sh: i32, can_gc: CanGc, ) -> Result<Root<Dom<ImageData>>, Error>
fn CreateImageData_( &self, imagedata: &ImageData, can_gc: CanGc, ) -> Result<Root<Dom<ImageData>>, Error>
fn GetImageData( &self, sx: i32, sy: i32, sw: i32, sh: i32, can_gc: CanGc, ) -> Result<Root<Dom<ImageData>>, Error>
fn PutImageData(&self, imagedata: &ImageData, dx: i32, dy: i32)
fn PutImageData_( &self, imagedata: &ImageData, dx: i32, dy: i32, dirty_x: i32, dirty_y: i32, dirty_width: i32, dirty_height: i32, )
fn CreateLinearGradient( &self, x0: Finite<f64>, y0: Finite<f64>, x1: Finite<f64>, y1: Finite<f64>, ) -> Root<Dom<CanvasGradient>>
fn CreateRadialGradient( &self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>, x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>, ) -> Result<Root<Dom<CanvasGradient>>, Error>
fn CreatePattern( &self, image: CanvasImageSource, repetition: DOMString, ) -> Result<Option<Root<Dom<CanvasPattern>>>, Error>
fn LineWidth(&self) -> f64
fn SetLineWidth(&self, width: f64)
fn LineCap(&self) -> CanvasLineCap
fn SetLineCap(&self, cap: CanvasLineCap)
fn LineJoin(&self) -> CanvasLineJoin
fn SetLineJoin(&self, join: CanvasLineJoin)
fn MiterLimit(&self) -> f64
fn SetMiterLimit(&self, limit: f64)
fn ShadowOffsetX(&self) -> f64
fn SetShadowOffsetX(&self, value: f64)
fn ShadowOffsetY(&self) -> f64
fn SetShadowOffsetY(&self, value: f64)
fn ShadowBlur(&self) -> f64
fn SetShadowBlur(&self, value: f64)
fn ShadowColor(&self) -> DOMString
fn SetShadowColor(&self, value: DOMString, can_gc: CanGc)
source§impl DomObject for CanvasRenderingContext2D
impl DomObject for CanvasRenderingContext2D
source§fn global(&self) -> Root<Dom<GlobalScope>>where
Self: Sized,
fn global(&self) -> Root<Dom<GlobalScope>>where
Self: Sized,
Returns the
GlobalScope
of the realm that the DomObject
was created in. If this
object is a Node
, this will be different from it’s owning Document
if adopted by. For
Node
s it’s almost always better to use NodeTraits::owning_global
.source§impl DomObjectWrap for CanvasRenderingContext2D
impl DomObjectWrap for CanvasRenderingContext2D
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2D_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::canvasrenderingcontext2d::CanvasRenderingContext2D>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::canvasrenderingcontext2d::CanvasRenderingContext2D>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2D_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::canvasrenderingcontext2d::CanvasRenderingContext2D>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::canvasrenderingcontext2d::CanvasRenderingContext2D>>}
Function pointer to the general wrap function type
source§impl Drop for CanvasRenderingContext2D
impl Drop for CanvasRenderingContext2D
source§impl HasParent for CanvasRenderingContext2D
impl HasParent for CanvasRenderingContext2D
source§impl MallocSizeOf for CanvasRenderingContext2D
impl MallocSizeOf for CanvasRenderingContext2D
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl PartialEq for CanvasRenderingContext2D
impl PartialEq for CanvasRenderingContext2D
source§impl Traceable for CanvasRenderingContext2D
impl Traceable for CanvasRenderingContext2D
impl Eq for CanvasRenderingContext2D
Auto Trait Implementations§
impl !Freeze for CanvasRenderingContext2D
impl !RefUnwindSafe for CanvasRenderingContext2D
impl !Send for CanvasRenderingContext2D
impl !Sync for CanvasRenderingContext2D
impl Unpin for CanvasRenderingContext2D
impl !UnwindSafe for CanvasRenderingContext2D
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
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>
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 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>
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert