Skip to main content

Function: getDraftAsImage()

getDraftAsImage(draft, pix_per_cell, floats, use_color, mats): ImageData

Defined in: draft/draft.ts:393

when drafts are rendered to the screen they are drawn pixel by pixel to an Image element and rendered on the canvas. This is a much faster process than drawing as lines and shapes on a canvas.

Parameters

draft

Draft

the draft we will convert to an image

pix_per_cell

number

the maximum cell size for each interlacement, calculated based on draft size and maximum canvas dimensions

floats

boolean

boolean to render cells of the same value as floats (rather than bounded cells)

use_color

boolean

boolean to render the color of the yarn

mats

Material[]

an array of the materials currently in use in the workspace

Returns

ImageData