-
Notifications
You must be signed in to change notification settings - Fork 0
ImageNode
hhh edited this page Jan 7, 2022
·
6 revisions
/**
* Type of image sources of image nodes.
*/
type ImageNodeSource = Exclude<CanvasImageSource, SVGImageElement>;
/**
* Type of options of {@link ImageNode}.
*/
type ImageNodeOptions<Events extends CanvasNodeEvents> = (CanvasNodeOptions<Events> & Partial<{
/**
* Image source.
* @default null
*/
image: ImageNodeSource | null;
/**
* Offset x in image source.
* @default 0
*/
sourceX: number;
/**
* Offset y in image source.
* @default 0
*/
sourceY: number;
/**
* Image width in source.
* (`image.width` will be used if this is set to zero.)
* @default 0
*/
sourceWidth: number;
/**
* Image height in source.
* (`image.height` will be used if this is set to zero.)
* @default 0
*/
sourceHeight: number;
/**
* Destination width.
* (`image.width` will be used if this is set to zero.)
* @default 0
*/
destinationWidth: number;
/**
* Destination height.
* (`image.height` will be used if this is set to zero.)
* @default 0
*/
destinationHeight: number;
}>);
/**
* Class of image nodes.
*/
class ImageNode<Events extends CanvasNodeEvents = CanvasNodeEvents> extends CanvasNode<Events> {
/**
* Constructor of {@link ImageNode}.
*/
constructor(options?: ImageNodeOptions<Events>);
/**
* Image source.
* @default null
*/
image: ImageNodeSource | null;
/**
* Offset x in image source.
* @default 0
*/
sourceX: number;
/**
* Offset y in image source.
* @default 0
*/
sourceY: number;
/**
* Image width in source.
* (`image.width` will be used if this is set to zero.)
* @default 0
*/
sourceWidth: number;
/**
* Image height in source.
* (`image.height` will be used if this is set to zero.)
* @default 0
*/
sourceHeight: number;
/**
* Destination width.
* (`image.width` will be used if this is set to zero.)
* @default 0
*/
destinationWidth: number;
/**
* Destination height.
* (`image.height` will be used if this is set to zero.)
* @default 0
*/
destinationHeight: number;
/**
* @override CanvasNode.beforeUpdate
*/
protected beforeUpdate(): void;
/**
* @override CanvasNode.renderSelf
*/
protected renderSelf(renderer: Renderer): void;
}