Skip to main content

Class: InkLayer

(abstract) Rendering.WebGL.InkLayer(inkGLContext, options)

WebGL primitives controller

Constructor

(abstract) new InkLayer(inkGLContext, options)

Parameters:
NameTypeDescription
inkGLContextRendering.WebGL.InkGLContext
optionsRendering.WebGL.InkLayerOptions
Properties:
NameTypeDescription
widthintLayer width
heightintLayer height
graphicsBoundsRendering.WebGL.RectGLRectGL(0, 0, width, height)
storageWidthintLayer width * InkLayerOptions.scaleFactor
storageHeightintLayer height * InkLayerOptions.scaleFactor
storageBoundsRendering.WebGL.RectGLRectGL(0, 0, storageWidth, storageHeight)
framebufferWebGLFramebufferAttached framebuffer if availble
renderbufferWebGLRenderbufferAttached renderbuffer if availble
textureWebGLTextureAttached texture if availble. Not availble when the layer uses a renderbuffer as a storage.

Extends

Methods

delete()

Release allocated WebGL resources

(async, abstract) getExportCanvas()

Overrides:

isDeleted() → {boolean}

Returns:

Is underlying WebGL resources are deleted

Type

boolean

resize(width, height)

Resize layer

Parameters:
NameTypeDescription
widthint
heightint

setTransform(matrix)

Configures ink transformation over underlying layer

Parameters:
NameTypeDescription
matrixCommon.Matrix

Overrides:

(async) toBlob(rectopt, mimeTypeopt, qualityopt) → {Blob}

Exports layer content. Compatible in web environment.

Parameters:
NameTypeAttributesDefaultDescription
rectCommon.Rect<optional>boundsArea to read
mimeTypestring<optional>image/pngSupported values are image/png, image/jpeg and image/webp.
qualityfloat<optional>0.92A Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp.If this argument is anything else, the default values 0.92 and 0.80 are used for image/jpeg and image/webp respectively.

Overrides:

Returns:

Layer content

Type

Blob

(async) toBuffer(rectopt, mimeTypeopt, options) → {Buffer}

Exports layer content. Compatible in nodejs environment.

Parameters:
NameTypeAttributesDefaultDescription
rectCommon.Rect<optional>boundsArea to read
mimeTypestring<optional>image/pngSupported values are image/png and image/jpeg.
optionsRendering.Layer.PNGOptions|Rendering.Layer.JPEGOptions

Overrides:

Returns:

Layer content

Type

Buffer

Home