Constructor
new module:Image(positionDefinition, source, optionsopt)
Image constructor
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
positionDefinition | PositionDefinition | Top-left corner of the image | |
source | String | | Link to an image file, another Image instance or the image file itself | |
options | ComponentOptions | <optional> | Drawing options |
- Source
Extends
Members
(static) defaultOptions :ImageOptions
Type:
- ImageOptions
- Source
file :HTMLImageElement
Type:
- HTMLImageElement
- Source
isLoaded :Boolean
Type:
- Boolean
- Source
url
Change the image URL
- Source
url
Get the image URL
- Source
Methods
(static) from(definition) → {Image}
Parameters:
Name | Type | Description |
---|---|---|
definition | Object | Image definition |
- Source
Returns:
- Type:
- Image
(static) load(url) → {Promise.<HTMLImageElement>}
Promise to load an image file.
Parameters:
Name | Type | Description |
---|---|---|
url | String | | Link or an array of links to image files |
- Source
Returns:
- Type:
- Promise.<HTMLImageElement>
draw(ctx) → {Image}
Draw the image itself
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Drawing context |
- Source
Returns:
Itself
- Type:
- Image
makePath(ctx) → {Image}
Draw it on a context
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Drawing context |
- Overrides
- Source
Returns:
Itself
- Type:
- Image
Type Definitions
ImageOptions
Type:
Properties- Object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fill | String | | <optional> | null | Color used as background |
description | String | <optional> | "" | Description of the image (can be used to for better accessibility) |
- Source