pencil.js
Version:
Nice modular interactive 2D drawing library.
64 lines (63 loc) • 1.89 kB
TypeScript
/**
* Image class
* <br><img src="./media/examples/image.png" alt="image demo"/>
* @class
* @extends Rectangle
*/
export default class Image extends Rectangle {
/**
* @inheritDoc
* @param {Object} definition - Image definition
* @return {Image}
*/
static from(definition: any): Image;
/**
* Promise to load an image file.
* @param {String|Array<String>} url - Link or an array of links to image files
* @return {Promise<HTMLImageElement>}
*/
static load(url: string | Array<string>): Promise<HTMLImageElement>;
/**
* Image constructor
* @param {PositionDefinition} positionDefinition - Top-left corner of the image
* @param {String|Image|HTMLImageElement} source - Link to an image file, another Image instance or the image file itself
* @param {ComponentOptions} [options] - Drawing options
*/
constructor(positionDefinition: any, source: string | Image | HTMLImageElement, options?: any);
/**
* @type {HTMLImageElement}
*/
file: HTMLImageElement;
/**
* @type {Boolean}
*/
isLoaded: boolean;
/**
* Change the image URL
* @param {String|Image|HTMLImageElement} source - Link to an image file, another Image instance or the image file itself
*/
set url(arg: string);
/**
* Get the image URL
* @return {String}
*/
get url(): string;
/**
* Draw the image itself
* @param {CanvasRenderingContext2D} ctx - Drawing context
* @return {Image} Itself
*/
draw(ctx: CanvasRenderingContext2D): Image;
/**
* @type {String}
* @private
*/
private [urlKey];
}
export type ImageOptions = any;
import Rectangle from "@pencil.js/rectangle";
/**
* @module Image
*/
declare const urlKey: unique symbol;
export {};