Class: WebGLDrawer

OpenSeadragon.WebGLDrawer

Default implementation of WebGLDrawer for an OpenSeadragon.Viewer. The WebGLDrawer loads tile data as textures to the graphics card as soon as it is available (via the tile-ready event), and unloads the data (via the image-unloaded event). The drawer utilizes a context-dependent two pass drawing pipeline. For the first pass, tile composition for a given TiledImage is always done using a canvas with a WebGL context. This allows tiles to be stitched together without seams or artifacts, without requiring a tile source with overlap. If overlap is present, overlapping pixels are discarded. The second pass copies all pixel data from the WebGL context onto an output canvas with a Context2d context. This allows applications to have access to pixel data and other functionality provided by Context2d, regardless of whether the CanvasDrawer or the WebGLDrawer is used. Certain options, including compositeOperation, clip, croppingPolygons, and debugMode are implemented using Context2d operations; in these scenarios, each TiledImage is drawn onto the output canvas immediately after the tile composition step (pass 1). Otherwise, for efficiency, all TiledImages are copied over to the output canvas at once, after all tiles have been composited for all images.

Constructor

new WebGLDrawer(options)

Parameters:
Name Type Description
options Object Options for this Drawer.
Properties
Name Type Attributes Description
viewer OpenSeadragon.Viewer The Viewer that owns this Drawer.
viewport OpenSeadragon.Viewport Reference to Viewer viewport.
element Element Parent element.
debugGridColor Number <optional>
See debugGridColor in OpenSeadragon.Options for details.
Source:

Members

canvas :Element

The HTML element (canvas) that this drawer uses for drawing
Type:
  • Element
Source:

container :Element

The parent element of this Drawer instance, passed in when the Drawer was created. The parent of OpenSeadragon.WebGLDrawer#canvas.
Type:
  • Element
Source:

Methods

(static) isSupported() → {Boolean}

Source:
Returns:
true if canvas and webgl are supported
Type
Boolean

canRotate() → {Boolean}

Source:
Returns:
true
Type
Boolean

destroy()

Clean up the renderer, removing all resources
Source:

draw(tiledImages)

Parameters:
Name Type Description
tiledImages Array Array of TiledImage objects to draw
Source:

drawDebuggingRect(rect)

Draw a rect onto the output canvas for debugging purposes
Parameters:
Name Type Description
rect OpenSeadragon.Rect
Source:

getType()

Source:
Returns:
'webgl'

setImageSmoothingEnabled(enabled)

Sets whether image smoothing is enabled or disabled
Parameters:
Name Type Description
enabled Boolean If true, uses gl.LINEAR as the TEXTURE_MIN_FILTER and TEXTURE_MAX_FILTER, otherwise gl.NEAREST.
Source: