[][src]Struct stdweb::web::html_element::CanvasElement

pub struct CanvasElement(_);

The HTML <canvas> element provides an empty graphic zone on which specific JavaScript APIs can draw (such as Canvas 2D or WebGL).

(JavaScript docs)

Methods

impl CanvasElement[src]

pub fn height(&self) -> u32[src]

Returns a positive integer reflecting the height HTML attribute of the element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.

(JavaScript docs)

pub fn set_height(&self, value: u32)[src]

Sets a positive integer reflecting the height HTML attribute of the element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.

(JavaScript docs)

pub fn width(&self) -> u32[src]

Returns a positive integer reflecting the width HTML attribute of the element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.

(JavaScript docs)

pub fn set_width(&self, value: u32)[src]

Sets a positive integer reflecting the width HTML attribute of the element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.

(JavaScript docs)

pub fn get_context<T: RenderingContext>(&self) -> Result<T, T::Error>[src]

Returns a drawing context on the canvas, or None if the context identifier is not supported.

(JavaScript docs)

pub fn to_data_url(
    &self,
    mime_type: Option<&str>,
    quality: Option<f64>
) -> Result<String, TODO>
[src]

Returns a data URI containing a representation of the image in the format specified by the type parameter (defaults to PNG). The returned image is in a resolution of 96 dpi.

(JavaScript docs)

pub fn to_blob<F: FnOnce(Blob) + 'static>(
    &self,
    f: F,
    mime_type: Option<&str>,
    quality: Option<f64>
) -> Result<(), TODO>
[src]

Creates a Blob object representing the image contained in the canvas; this file may be cached on the disk or stored in memory at the discretion of the user agent.

(JavaScript docs)

Trait Implementations

impl JsSerialize for CanvasElement[src]

impl TryFrom<EventTarget> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Node> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Element> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<HtmlElement> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<CanvasElement> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Reference> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Value> for CanvasElement[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for CanvasElement[src]

impl ReferenceType for CanvasElement[src]

impl IEventTarget for CanvasElement[src]

impl INode for CanvasElement[src]

impl IElement for CanvasElement[src]

impl IHtmlElement for CanvasElement[src]

impl AsRef<Reference> for CanvasElement[src]

impl From<CanvasElement> for EventTarget[src]

impl From<CanvasElement> for Node[src]

impl From<CanvasElement> for Element[src]

impl From<CanvasElement> for HtmlElement[src]

impl From<CanvasElement> for Reference[src]

impl Clone for CanvasElement[src]

impl Eq for CanvasElement[src]

impl PartialEq<CanvasElement> for CanvasElement[src]

impl Debug for CanvasElement[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]