Struct stdweb::web::html_element::CanvasElement [−][src]
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).
Methods
impl CanvasElement[src]
impl CanvasElementpub fn height(&self) -> u32[src]
pub fn height(&self) -> u32Returns a positive integer reflecting the height HTML attribute of the
pub fn set_height(&self, value: u32)[src]
pub fn set_height(&self, value: u32)Sets a positive integer reflecting the height HTML attribute of the
pub fn width(&self) -> u32[src]
pub fn width(&self) -> u32Returns a positive integer reflecting the width HTML attribute of the
pub fn set_width(&self, value: u32)[src]
pub fn set_width(&self, value: u32)Sets a positive integer reflecting the width HTML attribute of the
pub fn get_context<T: RenderingContext>(&self) -> Result<T, T::Error>[src]
pub fn get_context<T: RenderingContext>(&self) -> Result<T, T::Error>Returns a drawing context on the canvas, or None if the context identifier is not supported.
pub fn to_data_url(
&self,
mime_type: Option<&str>,
quality: Option<f64>
) -> Result<String, TODO>[src]
pub fn to_data_url(
&self,
mime_type: Option<&str>,
quality: Option<f64>
) -> Result<String, TODO>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.
pub fn to_blob<F: FnOnce(Blob) + 'static>(
&self,
f: F,
mime_type: Option<&str>,
quality: Option<f64>
) -> Result<(), TODO>[src]
pub fn to_blob<F: FnOnce(Blob) + 'static>(
&self,
f: F,
mime_type: Option<&str>,
quality: Option<f64>
) -> Result<(), TODO>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.
Trait Implementations
impl Clone for CanvasElement[src]
impl Clone for CanvasElementfn clone(&self) -> CanvasElement[src]
fn clone(&self) -> CanvasElementReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for CanvasElement[src]
impl Debug for CanvasElementfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for CanvasElement[src]
impl PartialEq for CanvasElementfn eq(&self, other: &CanvasElement) -> bool[src]
fn eq(&self, other: &CanvasElement) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &CanvasElement) -> bool[src]
fn ne(&self, other: &CanvasElement) -> boolThis method tests for !=.
impl Eq for CanvasElement[src]
impl Eq for CanvasElementimpl From<CanvasElement> for EventTarget[src]
impl From<CanvasElement> for EventTargetfn from(value: CanvasElement) -> Self[src]
fn from(value: CanvasElement) -> SelfPerforms the conversion.
impl TryFrom<EventTarget> for CanvasElement[src]
impl TryFrom<EventTarget> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error>[src]
fn try_from(value: EventTarget) -> Result<Self, Self::Error>Performs the conversion.
impl From<CanvasElement> for Node[src]
impl From<CanvasElement> for Nodefn from(value: CanvasElement) -> Self[src]
fn from(value: CanvasElement) -> SelfPerforms the conversion.
impl TryFrom<Node> for CanvasElement[src]
impl TryFrom<Node> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Node) -> Result<Self, Self::Error>[src]
fn try_from(value: Node) -> Result<Self, Self::Error>Performs the conversion.
impl From<CanvasElement> for Element[src]
impl From<CanvasElement> for Elementfn from(value: CanvasElement) -> Self[src]
fn from(value: CanvasElement) -> SelfPerforms the conversion.
impl TryFrom<Element> for CanvasElement[src]
impl TryFrom<Element> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Element) -> Result<Self, Self::Error>[src]
fn try_from(value: Element) -> Result<Self, Self::Error>Performs the conversion.
impl From<CanvasElement> for HtmlElement[src]
impl From<CanvasElement> for HtmlElementfn from(value: CanvasElement) -> Self[src]
fn from(value: CanvasElement) -> SelfPerforms the conversion.
impl TryFrom<HtmlElement> for CanvasElement[src]
impl TryFrom<HtmlElement> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: HtmlElement) -> Result<Self, Self::Error>[src]
fn try_from(value: HtmlElement) -> Result<Self, Self::Error>Performs the conversion.
impl InstanceOf for CanvasElement[src]
impl InstanceOf for CanvasElementfn instance_of(reference: &Reference) -> bool[src]
fn instance_of(reference: &Reference) -> boolChecks whenever a given Reference if of type Self.
impl AsRef<Reference> for CanvasElement[src]
impl AsRef<Reference> for CanvasElementimpl ReferenceType for CanvasElement[src]
impl ReferenceType for CanvasElementunsafe fn from_reference_unchecked(reference: Reference) -> Self[src]
unsafe fn from_reference_unchecked(reference: Reference) -> SelfConverts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<CanvasElement> for Reference[src]
impl From<CanvasElement> for Referencefn from(value: CanvasElement) -> Self[src]
fn from(value: CanvasElement) -> SelfPerforms the conversion.
impl TryFrom<CanvasElement> for Reference[src]
impl TryFrom<CanvasElement> for Referencetype Error = Void
The type returned in the event of a conversion error.
fn try_from(value: CanvasElement) -> Result<Self, Self::Error>[src]
fn try_from(value: CanvasElement) -> Result<Self, Self::Error>Performs the conversion.
impl TryFrom<Reference> for CanvasElement[src]
impl TryFrom<Reference> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>[src]
fn try_from(reference: Reference) -> Result<Self, Self::Error>Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for CanvasElement[src]
impl<'_r> TryFrom<&'_r Reference> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>[src]
fn try_from(reference: &Reference) -> Result<Self, Self::Error>Performs the conversion.
impl TryFrom<Value> for CanvasElement[src]
impl TryFrom<Value> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>[src]
fn try_from(value: Value) -> Result<Self, Self::Error>Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for CanvasElement[src]
impl<'_r> TryFrom<&'_r Value> for CanvasElementtype Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>[src]
fn try_from(value: &Value) -> Result<Self, Self::Error>Performs the conversion.
impl JsSerialize for CanvasElement[src]
impl JsSerialize for CanvasElementimpl IEventTarget for CanvasElement[src]
impl IEventTarget for CanvasElementfn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static, [src]
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static, Adds given event handler to the list of event listeners for the specified EventTarget on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>[src]
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>Dispatches an Event at this EventTarget, invoking the affected event listeners in the appropriate order. Read more
impl INode for CanvasElement[src]
impl INode for CanvasElementfn as_node(&self) -> &Node[src]
fn as_node(&self) -> &NodeCasts a reference to this object into a reference to a Node.
fn append_child<T: INode>(&self, child: &T)[src]
fn append_child<T: INode>(&self, child: &T)Adds a node to the end of the list of children of a specified parent node. Read more
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>[src]
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>Removes a child node from the DOM. Read more
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>[src]
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>Returns a duplicate of the node on which this method was called. Read more
fn contains<T: INode>(&self, node: &T) -> bool[src]
fn contains<T: INode>(&self, node: &T) -> boolChecks whenever a given node is a descendant of this one or not. Read more
fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U
) -> Result<Node, InsertNodeError>[src]
fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U
) -> Result<Node, InsertNodeError>Inserts the specified node before the reference node as a child of the current node. Read more
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>[src]
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>Replaces one hild node of the specified node with another. Read more
fn parent_node(&self) -> Option<Node>[src]
fn parent_node(&self) -> Option<Node>Returns the parent of this node in the DOM tree. Read more
fn first_child(&self) -> Option<Node>[src]
fn first_child(&self) -> Option<Node>Returns the node's first child in the tree, or None if the node is childless. Read more
fn last_child(&self) -> Option<Node>[src]
fn last_child(&self) -> Option<Node>Returns the node's last child in the tree, or None if the node is childless. Read more
fn next_sibling(&self) -> Option<Node>[src]
fn next_sibling(&self) -> Option<Node>Returns the node's next sibling in the tree, or None if there isn't such a node. Read more
fn node_name(&self) -> String[src]
fn node_name(&self) -> StringReturns the name of the node. Read more
fn node_type(&self) -> NodeType[src]
fn node_type(&self) -> NodeTypeReturns the type of the node. Read more
fn node_value(&self) -> Option<String>[src]
fn node_value(&self) -> Option<String>Returns the value of the node. Read more
fn set_node_value(&self, value: Option<&str>)[src]
fn set_node_value(&self, value: Option<&str>)Sets the value of the node. Read more
fn owner_document(&self) -> Option<Document>[src]
fn owner_document(&self) -> Option<Document>Returns the Document that this node belongs to. Read more
fn parent_element(&self) -> Option<Element>[src]
fn parent_element(&self) -> Option<Element>Returns an Element that is the parent of this node. Returns null if the node has no parent or the parent is not an Element. Read more
fn previous_sibling(&self) -> Option<Node>[src]
fn previous_sibling(&self) -> Option<Node>Returns the node's previous sibling in the tree, or None if there isn't such a node. Read more
fn text_content(&self) -> Option<String>[src]
fn text_content(&self) -> Option<String>A property which represents the text content of a node and its descendants. Read more
fn set_text_content(&self, text: &str)[src]
fn set_text_content(&self, text: &str)Sets the text content of this node; calling thil removes all of node's children and replaces them with a single text node with the given value. Read more
fn child_nodes(&self) -> NodeList[src]
fn child_nodes(&self) -> NodeListReturns a live collection of child nodes of this node. Read more
fn base_uri(&self) -> String[src]
fn base_uri(&self) -> StringGets the base URL. Read more
fn has_child_nodes(&self) -> bool[src]
fn has_child_nodes(&self) -> boolReturns whether this node has children nodes. Read more
fn is_default_namespace(&self, namespace: &str) -> bool[src]
fn is_default_namespace(&self, namespace: &str) -> boolDetermines whether the given namespace is the default namespace of this node. Read more
fn is_equal_node<T: INode>(&self, node: &T) -> bool[src]
fn is_equal_node<T: INode>(&self, node: &T) -> boolTests whether this node is equal to another node. Two nodes are equal if they have the same type, defining characteristics, matching attributes, and so on. Read more
fn is_same_node<T: INode>(&self, node: &T) -> bool[src]
fn is_same_node<T: INode>(&self, node: &T) -> boolTest whether two Node references are the same. Read more
fn lookup_prefix(&self, namespace: &str) -> Option<String>[src]
fn lookup_prefix(&self, namespace: &str) -> Option<String>Returns the prefix for the given namespace URI, if present. Read more
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>[src]
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>Returns the namespace URI for the given prefix. Read more
fn normalize(&self)[src]
fn normalize(&self)Merges any adjacent text nodes and removes empty text nodes under this node. Read more
impl IElement for CanvasElement[src]
impl IElement for CanvasElementfn class_list(&self) -> TokenList[src]
fn class_list(&self) -> TokenListThe Element.classList is a read-only property which returns a live TokenList collection of the class attributes of the element. Read more
fn has_attribute(&self, name: &str) -> bool[src]
fn has_attribute(&self, name: &str) -> boolThe Element.hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not. Read more
fn get_attribute(&self, name: &str) -> Option<String>[src]
fn get_attribute(&self, name: &str) -> Option<String>Element.getAttribute() returns the value of a specified attribute on the element. If the given attribute does not exist, the value returned will either be null or "" (the empty string); Read more
fn set_attribute(
&self,
name: &str,
value: &str
) -> Result<(), InvalidCharacterError>[src]
fn set_attribute(
&self,
name: &str,
value: &str
) -> Result<(), InvalidCharacterError>Sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. Read more
fn scroll_top(&self) -> f64[src]
fn scroll_top(&self) -> f64Gets the the number of pixels that an element's content is scrolled vertically. Read more
fn set_scroll_top(&self, value: f64)[src]
fn set_scroll_top(&self, value: f64)Sets the the number of pixels that an element's content is scrolled vertically. Read more
fn scroll_left(&self) -> f64[src]
fn scroll_left(&self) -> f64Gets the the number of pixels that an element's content is scrolled to the left. Read more
fn set_scroll_left(&self, value: f64)[src]
fn set_scroll_left(&self, value: f64)Sets the the number of pixels that an element's content is scrolled to the left. Read more
fn get_attribute_names(&self) -> Vec<String>[src]
fn get_attribute_names(&self) -> Vec<String>Element.getAttributeNames() returns the attribute names of the element as an Array of strings. If the element has no attributes it returns an empty array. Read more
fn remove_attribute(&self, name: &str)[src]
fn remove_attribute(&self, name: &str)Element.removeAttribute removes an attribute from the specified element. Read more
fn has_attributes(&self) -> bool[src]
fn has_attributes(&self) -> boolThe Element.hasAttributes() method returns Boolean value, indicating if the current element has any attributes or not. Read more
fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>[src]
fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>Designates a specific element as the capture target of future pointer events. Read more
fn release_pointer_capture(
&self,
pointer_id: i32
) -> Result<(), InvalidPointerId>[src]
fn release_pointer_capture(
&self,
pointer_id: i32
) -> Result<(), InvalidPointerId>Releases pointer capture that was previously set for a specific pointer Read more
fn has_pointer_capture(&self, pointer_id: i32) -> bool[src]
fn has_pointer_capture(&self, pointer_id: i32) -> boolReturns a boolean indicating if the element has captured the specified pointer Read more
impl IHtmlElement for CanvasElement[src]
impl IHtmlElement for CanvasElementfn focus(&self)[src]
fn focus(&self)Sets focus on the specified element, if it can be focused. Read more
fn blur(&self)[src]
fn blur(&self)Removes keyboard focus from the current element. Read more
fn dataset(&self) -> StringMap[src]
fn dataset(&self) -> StringMapAllows access, both in reading and writing, to all of the custom data attributes (data-*) set on the element, either in HTML or in the DOM. Read more
fn get_bounding_client_rect(&self) -> Rect[src]
fn get_bounding_client_rect(&self) -> RectReturns the size of an element and its position relative to the viewport. (JavaScript docs) Read more
fn offset_width(&self) -> i32[src]
fn offset_width(&self) -> i32Returns the layout width of an element. Typically, an element's offsetWidth is a measurement which includes the element borders, the element horizontal padding, the element vertical scrollbar (if present, if rendered) and the element CSS width. Read more
fn offset_height(&self) -> i32[src]
fn offset_height(&self) -> i32Returns the height of the element including vertical padding and borders, as an integer. Read more
fn inner_text(&self) -> String[src]
fn inner_text(&self) -> StringA property which represents the "rendered" text content of a node and its descendants. It approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied to the clipboard. Read more
Auto Trait Implementations
impl Send for CanvasElement
impl Send for CanvasElementimpl Sync for CanvasElement
impl Sync for CanvasElement