Skip to main content

OffscreenCanvasMethods

pub trait OffscreenCanvasMethods<D: DomTypes> {
    // Required methods
    fn Width(&self) -> u64;
    fn SetWidth(&self, cx: &mut JSContext, value: u64);
    fn Height(&self) -> u64;
    fn SetHeight(&self, cx: &mut JSContext, value: u64);
    fn GetContext(
        &self,
        cx: &mut JSContext,
        contextId: OffscreenRenderingContextId,
        options: HandleValue<'_>,
    ) -> Fallible<Option<OffscreenCanvasRenderingContext2DOrImageBitmapRenderingContextOrWebGLRenderingContextOrWebGL2RenderingContext<D>>>;
    fn TransferToImageBitmap(
        &self,
        cx: &mut JSContext,
    ) -> Fallible<DomRoot<D::ImageBitmap>>;
    fn ConvertToBlob(
        &self,
        cx: &mut JSContext,
        options: &ImageEncodeOptions,
    ) -> Rc<D::Promise>;
    fn Constructor(
        cx: &mut JSContext,
        global: &D::GlobalScope,
        proto: Option<HandleObject<'_>>,
        width: u64,
        height: u64,
    ) -> Fallible<DomRoot<D::OffscreenCanvas>>;
}

Required Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§