#[repr(C)]pub(crate) struct CanvasRenderingContext2D {
reflector_: Reflector,
canvas: HTMLCanvasElementOrOffscreenCanvas,
canvas_state: CanvasState,
}Fields§
§reflector_: Reflector§canvas: HTMLCanvasElementOrOffscreenCanvas§canvas_state: CanvasStateImplementations§
Source§impl CanvasRenderingContext2D
impl CanvasRenderingContext2D
fn __assert_parent_type(&self)
Source§impl CanvasRenderingContext2D
impl CanvasRenderingContext2D
pub(crate) fn new_inherited( global: &GlobalScope, canvas: HTMLCanvasElementOrOffscreenCanvas, size: Size2D<u32>, ) -> Option<CanvasRenderingContext2D>
pub(crate) fn new( global: &GlobalScope, canvas: &HTMLCanvasElement, size: Size2D<u32>, can_gc: CanGc, ) -> Option<DomRoot<CanvasRenderingContext2D>>
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)
Trait Implementations§
Source§impl CanvasContext for CanvasRenderingContext2D
impl CanvasContext for CanvasRenderingContext2D
type ID = CanvasId
fn context_id(&self) -> Self::ID
fn canvas(&self) -> Option<HTMLCanvasElementOrOffscreenCanvas<DomTypeHolder>>
Source§fn update_rendering(&self, canvas_epoch: Epoch) -> bool
fn update_rendering(&self, canvas_epoch: Epoch) -> bool
Request that the
CanvasContext update the rendering of its contents,
returning true if new image was produced. Read morefn resize(&self)
fn reset_bitmap(&self)
Source§fn get_image_data(&self) -> Option<Snapshot>
fn get_image_data(&self) -> Option<Snapshot>
Returns none if area of canvas is zero. Read more
fn origin_is_clean(&self) -> bool
fn mark_as_dirty(&self)
fn size(&self) -> Size2D<u32>
fn onscreen(&self) -> bool
Source§impl CanvasRenderingContext2DMethods<DomTypeHolder> for CanvasRenderingContext2D
impl CanvasRenderingContext2DMethods<DomTypeHolder> for CanvasRenderingContext2D
Source§fn Canvas(&self) -> DomRoot<HTMLCanvasElement>
fn Canvas(&self) -> DomRoot<HTMLCanvasElement>
Source§fn SetTransform(
&self,
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
) -> ErrorResult
fn SetTransform( &self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, ) -> ErrorResult
Source§fn SetTransform_(&self, transform: &DOMMatrix2DInit) -> ErrorResult
fn SetTransform_(&self, transform: &DOMMatrix2DInit) -> ErrorResult
Source§fn ResetTransform(&self)
fn ResetTransform(&self)
Source§fn GlobalAlpha(&self) -> f64
fn GlobalAlpha(&self) -> f64
Source§fn SetGlobalAlpha(&self, alpha: f64)
fn SetGlobalAlpha(&self, alpha: f64)
Source§fn GlobalCompositeOperation(&self) -> DOMString
fn GlobalCompositeOperation(&self) -> DOMString
Source§fn SetGlobalCompositeOperation(&self, op_str: DOMString)
fn SetGlobalCompositeOperation(&self, op_str: DOMString)
Source§fn Fill(&self, fill_rule: CanvasFillRule)
fn Fill(&self, fill_rule: CanvasFillRule)
Source§fn Fill_(&self, path: &Path2D, fill_rule: CanvasFillRule)
fn Fill_(&self, path: &Path2D, fill_rule: CanvasFillRule)
Source§fn Clip(&self, fill_rule: CanvasFillRule)
fn Clip(&self, fill_rule: CanvasFillRule)
Source§fn Clip_(&self, path: &Path2D, fill_rule: CanvasFillRule)
fn Clip_(&self, path: &Path2D, fill_rule: CanvasFillRule)
Source§fn IsPointInPath(&self, x: f64, y: f64, fill_rule: CanvasFillRule) -> bool
fn IsPointInPath(&self, x: f64, y: f64, fill_rule: CanvasFillRule) -> bool
Source§fn IsPointInPath_(
&self,
path: &Path2D,
x: f64,
y: f64,
fill_rule: CanvasFillRule,
) -> bool
fn IsPointInPath_( &self, path: &Path2D, x: f64, y: f64, fill_rule: CanvasFillRule, ) -> bool
Source§fn MeasureText(&self, text: DOMString, can_gc: CanGc) -> DomRoot<TextMetrics>
fn MeasureText(&self, text: DOMString, can_gc: CanGc) -> DomRoot<TextMetrics>
Source§fn TextAlign(&self) -> CanvasTextAlign
fn TextAlign(&self) -> CanvasTextAlign
Source§fn SetTextAlign(&self, value: CanvasTextAlign)
fn SetTextAlign(&self, value: CanvasTextAlign)
Source§fn TextBaseline(&self) -> CanvasTextBaseline
fn TextBaseline(&self) -> CanvasTextBaseline
Source§fn SetTextBaseline(&self, value: CanvasTextBaseline)
fn SetTextBaseline(&self, value: CanvasTextBaseline)
Source§fn Direction(&self) -> CanvasDirection
fn Direction(&self) -> CanvasDirection
Source§fn SetDirection(&self, value: CanvasDirection)
fn SetDirection(&self, value: CanvasDirection)
Source§fn DrawImage(
&self,
image: CanvasImageSource<DomTypeHolder>,
dx: f64,
dy: f64,
) -> ErrorResult
fn DrawImage( &self, image: CanvasImageSource<DomTypeHolder>, dx: f64, dy: f64, ) -> ErrorResult
Source§fn DrawImage_(
&self,
image: CanvasImageSource<DomTypeHolder>,
dx: f64,
dy: f64,
dw: f64,
dh: f64,
) -> ErrorResult
fn DrawImage_( &self, image: CanvasImageSource<DomTypeHolder>, dx: f64, dy: f64, dw: f64, dh: f64, ) -> ErrorResult
Source§fn DrawImage__(
&self,
image: CanvasImageSource<DomTypeHolder>,
sx: f64,
sy: f64,
sw: f64,
sh: f64,
dx: f64,
dy: f64,
dw: f64,
dh: f64,
) -> ErrorResult
fn DrawImage__( &self, image: CanvasImageSource<DomTypeHolder>, sx: f64, sy: f64, sw: f64, sh: f64, dx: f64, dy: f64, dw: f64, dh: f64, ) -> ErrorResult
Source§fn Ellipse(
&self,
x: f64,
y: f64,
rx: f64,
ry: f64,
rotation: f64,
start: f64,
end: f64,
ccw: bool,
) -> ErrorResult
fn Ellipse( &self, x: f64, y: f64, rx: f64, ry: f64, rotation: f64, start: f64, end: f64, ccw: bool, ) -> ErrorResult
Source§fn ImageSmoothingEnabled(&self) -> bool
fn ImageSmoothingEnabled(&self) -> bool
Source§fn SetImageSmoothingEnabled(&self, value: bool)
fn SetImageSmoothingEnabled(&self, value: bool)
Source§fn SetStrokeStyle(
&self,
value: StringOrCanvasGradientOrCanvasPattern<DomTypeHolder>,
)
fn SetStrokeStyle( &self, value: StringOrCanvasGradientOrCanvasPattern<DomTypeHolder>, )
Source§fn SetFillStyle(
&self,
value: StringOrCanvasGradientOrCanvasPattern<DomTypeHolder>,
)
fn SetFillStyle( &self, value: StringOrCanvasGradientOrCanvasPattern<DomTypeHolder>, )
Source§fn CreateImageData(
&self,
sw: i32,
sh: i32,
can_gc: CanGc,
) -> Fallible<DomRoot<ImageData>>
fn CreateImageData( &self, sw: i32, sh: i32, can_gc: CanGc, ) -> Fallible<DomRoot<ImageData>>
Source§fn CreateImageData_(
&self,
imagedata: &ImageData,
can_gc: CanGc,
) -> Fallible<DomRoot<ImageData>>
fn CreateImageData_( &self, imagedata: &ImageData, can_gc: CanGc, ) -> Fallible<DomRoot<ImageData>>
Source§fn GetImageData(
&self,
sx: i32,
sy: i32,
sw: i32,
sh: i32,
can_gc: CanGc,
) -> Fallible<DomRoot<ImageData>>
fn GetImageData( &self, sx: i32, sy: i32, sw: i32, sh: i32, can_gc: CanGc, ) -> Fallible<DomRoot<ImageData>>
Source§fn CreateLinearGradient(
&self,
x0: Finite<f64>,
y0: Finite<f64>,
x1: Finite<f64>,
y1: Finite<f64>,
can_gc: CanGc,
) -> DomRoot<CanvasGradient>
fn CreateLinearGradient( &self, x0: Finite<f64>, y0: Finite<f64>, x1: Finite<f64>, y1: Finite<f64>, can_gc: CanGc, ) -> DomRoot<CanvasGradient>
Source§fn CreateRadialGradient(
&self,
x0: Finite<f64>,
y0: Finite<f64>,
r0: Finite<f64>,
x1: Finite<f64>,
y1: Finite<f64>,
r1: Finite<f64>,
can_gc: CanGc,
) -> Fallible<DomRoot<CanvasGradient>>
fn CreateRadialGradient( &self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>, x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>, can_gc: CanGc, ) -> Fallible<DomRoot<CanvasGradient>>
Source§fn CreatePattern(
&self,
image: CanvasImageSource<DomTypeHolder>,
repetition: DOMString,
can_gc: CanGc,
) -> Fallible<Option<DomRoot<CanvasPattern>>>
fn CreatePattern( &self, image: CanvasImageSource<DomTypeHolder>, repetition: DOMString, can_gc: CanGc, ) -> Fallible<Option<DomRoot<CanvasPattern>>>
Source§fn SetLineWidth(&self, width: f64)
fn SetLineWidth(&self, width: f64)
Source§fn LineCap(&self) -> CanvasLineCap
fn LineCap(&self) -> CanvasLineCap
Source§fn SetLineCap(&self, cap: CanvasLineCap)
fn SetLineCap(&self, cap: CanvasLineCap)
Source§fn LineJoin(&self) -> CanvasLineJoin
fn LineJoin(&self) -> CanvasLineJoin
Source§fn SetLineJoin(&self, join: CanvasLineJoin)
fn SetLineJoin(&self, join: CanvasLineJoin)
Source§fn SetMiterLimit(&self, limit: f64)
fn SetMiterLimit(&self, limit: f64)
Source§fn SetLineDash(&self, segments: Vec<f64>)
fn SetLineDash(&self, segments: Vec<f64>)
Source§fn GetLineDash(&self) -> Vec<f64>
fn GetLineDash(&self) -> Vec<f64>
Source§fn LineDashOffset(&self) -> f64
fn LineDashOffset(&self) -> f64
Source§fn SetLineDashOffset(&self, offset: f64)
fn SetLineDashOffset(&self, offset: f64)
Source§fn ShadowOffsetX(&self) -> f64
fn ShadowOffsetX(&self) -> f64
Source§fn SetShadowOffsetX(&self, value: f64)
fn SetShadowOffsetX(&self, value: f64)
Source§fn ShadowOffsetY(&self) -> f64
fn ShadowOffsetY(&self) -> f64
Source§fn SetShadowOffsetY(&self, value: f64)
fn SetShadowOffsetY(&self, value: f64)
Source§fn SetShadowBlur(&self, value: f64)
fn SetShadowBlur(&self, value: f64)
Source§fn ShadowColor(&self) -> DOMString
fn ShadowColor(&self) -> DOMString
Source§fn SetShadowColor(&self, value: DOMString)
fn SetShadowColor(&self, value: DOMString)
fn PutImageData_( &self, imagedata: &ImageData, dx: i32, dy: i32, dirty_x: i32, dirty_y: i32, dirty_width: i32, dirty_height: i32, )
Source§impl DomObject for CanvasRenderingContext2D
impl DomObject for CanvasRenderingContext2D
Source§impl DomObjectWrap<DomTypeHolder> for CanvasRenderingContext2D
impl DomObjectWrap<DomTypeHolder> for CanvasRenderingContext2D
Source§const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::CanvasRenderingContext2DBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::canvas::canvas2d::canvasrenderingcontext2d::CanvasRenderingContext2D>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::canvas::canvas2d::canvasrenderingcontext2d::CanvasRenderingContext2D>>}
const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::CanvasRenderingContext2DBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::canvas::canvas2d::canvasrenderingcontext2d::CanvasRenderingContext2D>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::canvas::canvas2d::canvasrenderingcontext2d::CanvasRenderingContext2D>>}
Function pointer to the general wrap function type
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<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::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
Nodes it’s almost always better to use NodeTraits::owning_global.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