Skip to content

Interface: CanvasRenderOptions ​

Extends ​

  • Pick<RenderOptions, | "images" | "repeatImages" | "contentCells" | "placement" | "imageAspects" | "choose" | "imageFit" | "containWithin" | "imageFocus" | "fill" | "stroke" | "strokeWidth" | "background">

Extended by ​

Properties ​

backdrop? ​

ts
optional backdrop?: string;

One image across all the cells (a URL), as for SVG.


background? ​

ts
optional background?: string;

Color painted over the whole region. Omit for transparent.

Inherited from ​

RenderOptions.background


choose? ​

ts
optional choose?: "placement" | "shape";

With imageAspects: "shape" also picks which cells get images by their shape.

Inherited from ​

RenderOptions.choose


containWithin? ​

ts
optional containWithin?: "tile" | "visible";

With imageFit: "contain", for cells an edges: "window" layout cuts: fit the image in the whole tile ("tile", the default; partly hidden like the tile) or in the part that shows ("visible"). See SafeAreaOptions.within.

Inherited from ​

RenderOptions.containWithin


contentCells? ​

ts
optional contentCells?: ContentCells;

Which cells may hold an image from the images array (default "all").

Inherited from ​

RenderOptions.contentCells


fill? ​

ts
optional fill?: FillSource;

Cell color when there is no image: a color, a palette (neighboring cells get different entries), or a function. Defaults to defaultPalette.

Inherited from ​

RenderOptions.fill


imageAspects? ​

ts
optional imageAspects?: readonly number[];

Width / height of each image in images. When given, each image goes in a cell of similar shape, to crop as little as possible (see matchSlots). Ignored with repeatImages.

Inherited from ​

RenderOptions.imageAspects


imageFit? ​

ts
optional imageFit?: "cover" | "contain";

How each image fills its cell: "cover" (default) fills the cell's bounding box and is cropped to the cell's shape; "contain" shows the whole image inside the cell's safe area (see safeArea), uncropped. Give imageAspects so the safe area has each image's shape.

Inherited from ​

RenderOptions.imageFit


imageFocus? ​

ts
optional imageFocus?: readonly (Focus | undefined)[];

Focal point of each image in images (by position; fractions of its width and height, see estimateFocus): what to keep in view when "cover" crops it. It goes as near the middle of what shows of its cell as covering the cell allows (see coverRect). Needs each image's shape, from imageAspects or the focus's aspect (the canvas renderers measure the images themselves).

Inherited from ​

RenderOptions.imageFocus


images? ​

ts
optional images?: ImageSource;

Images: an array assigned in reading order, or a function per cell.

Inherited from ​

RenderOptions.images


loaded? ​

ts
optional loaded?: ReadonlyMap<string, CanvasImage>;

Loaded images by URL (see loadImages). Images not in it are skipped and their cells show fill. renderToCanvas and renderToPng load them for you.


placement? ​

ts
optional placement?: ContentPlacement;

Where the images go when there are fewer than cells (default "reading").

Inherited from ​

RenderOptions.placement


relief? ​

ts
optional relief?: boolean | ReliefOptions;

Raised tiles, as for SVG.


repeatImages? ​

ts
optional repeatImages?: boolean;

Reuse the images array from the start when there are more cells than images.

Inherited from ​

RenderOptions.repeatImages


stroke? ​

ts
optional stroke?: string;

Outline drawn on top of each cell.

Inherited from ​

RenderOptions.stroke


strokeWidth? ​

ts
optional strokeWidth?: number;

Inherited from ​

RenderOptions.strokeWidth

Hat tiling and isohedral tilings after Craig S. Kaplan's hatviz and Tactile (BSD 3-Clause).