Canvas Toolkit
← Class index

CPixmap

Painting

Raster image together with its logical dimensions.

import { CPixmap } from "canvas-toolkit-lib";

Declared members

constructor(image: CanvasImageSource, width: number, height: number);

Creates a pixmap from an existing canvas image source. @param image Underlying image source. @param width Pixmap width in pixels. @param height Pixmap height in pixels.

image(): CanvasImageSource;

Returns the underlying canvas image source.

width(): number;

Returns the pixmap width in pixels.

height(): number;

Returns the pixmap height in pixels.

isNull(): boolean;

Returns whether the pixmap has non-positive dimensions.

static fromUrl(url: string): Promise<CPixmap>;

Loads an image URL and creates a pixmap using its natural dimensions. @param url Image URL to load. @returns A promise resolving to the loaded pixmap.