Properties:
| Name | Type | Description | 
|---|---|---|
height | 
            
            
                number | 
                 Height of the canvas.  | 
        
parentNode | 
            
            
                ICanvasParentNode | null | 
                 Parent node of the canvas.  | 
        
style | 
            
            
                ICanvasStyle | 
                 Style of the canvas.  | 
        
width | 
            
            
                number | 
                 Width of the canvas.  | 
        
Extends
- GlobalMixins.ICanvas
 - Partial.<EventTarget>
 
Members
Height of the canvas.
Parent node of the canvas.
Style of the canvas.
Width of the canvas.
Methods
Adds the listener for the specified event.
| Name | Type | Description | 
|---|---|---|
type | 
            
            string | 
                 The type of event to listen for.  | 
        
listener | 
            
            EventListenerOrEventListenerObject | 
                 The callback to invoke when the event is fired.  | 
        
options | 
            
            boolean | AddEventListenerOptions | 
                 The options for adding event listener.  | 
        
Get the content of the canvas as Blob.
| Name | Type | Attributes | Description | 
|---|---|---|---|
options | 
            
            object | 
                
                    <optional> | 
            
            
            
                 The options for creating Blob.  | 
        
options.type | 
            
            string | 
                 The MIME type for the image format to return. If not specify, the default value is image/png.  | 
        |
options.quality | 
            
            string | 
                 The image quality to be used when creating images using file formats that support lossy compression.  | 
        
Returns:
| Type | Description | 
|---|---|
| Promise<Blob> | The content of the canvas as Blob. | 
Dispatches a event.
| Name | Type | Description | 
|---|---|---|
event | 
            
            Event | 
                 The Event object to dispatch. Its Event.target property will be set to the current EventTarget.  | 
        
Returns:
| Type | Description | 
|---|---|
| boolean | Returns false if event is cancelable, and at least one of the event handlers which received event called Event.preventDefault(). Otherwise true. | 
Get the position and the size of the canvas.
Returns:
| Type | Description | 
|---|---|
| ICanvasRect | The smallest rectangle which contains the entire canvas. | 
Get rendering context of the canvas.
| Name | Type | Attributes | Description | 
|---|---|---|---|
contextId | 
            
            ContextIds | 
                 The identifier of the type of context to create.  | 
        |
options | 
            
            ContextSettings | 
                
                    <optional> | 
            
            
            
                 The options for creating context.  | 
        
Returns:
| Type | Description | 
|---|---|
| RenderingContext | unknown | The created context, or null if contextId is not supported. | 
Removes the listener for the specified event.
| Name | Type | Description | 
|---|---|---|
type | 
            
            string | 
                 The type of event to listen for.  | 
        
listener | 
            
            EventListenerOrEventListenerObject | 
                 The callback to invoke when the event is fired.  | 
        
options | 
            
            boolean | EventListenerOptions | 
                 The options for removing event listener.  | 
        
Get the content of the canvas as data URL.
| Name | Type | Attributes | Description | 
|---|---|---|---|
type | 
            
            string | 
                
                    <optional> | 
            
            
            
                 The MIME type for the image format to return. If not specify, the default value is image/png.  | 
        
options | 
            
            any | 
                
                    <optional> | 
            
            
            
                 The options for creating data URL.  | 
        
Returns:
| Type | Description | 
|---|---|
| string | The content of the canvas as data URL. |