MAIDR JavaScript API
    Preparing search index...

    Class TactileCanvasAbstract

    Turns a chart drawn on a canvas into pins.

    A canvas has no shapes to trace, only colours, so this does what the SVG path does by other means: each pin looks at the patch of picture it stands over, decides whether anything is drawn there, and is raised where a drawn thing meets something else -- the page behind it, or a mark of a clearly different colour. Marks come out as outlines, the way the SVG path draws every mark but the focused one, so a hand can trace a bar's edges rather than meet a solid plateau.

    Index

    Methods

    • Whether a pixel is drawn, rather than the background showing.

      Parameters

      • image: PixelImage

        The picture

      • index: number

        Byte offset of the pixel

      • background: readonly number[]

        The background colour

      Returns boolean

    • Draws a picture onto a pin buffer.

      Parameters

      • image: PixelImage

        The chart's pixels

      • cellOf: (x: number, y: number) => PixelRect | null

        The patch of pixels a pin stands over, or null where the pin is outside the picture

      • width: number

        Dots across the display

      • height: number

        Dots down the display

      • masks: readonly PixelRect[] = []

        Areas of the picture to read as background: something the library painted over the data, such as a tooltip

      • strokePixels: number = 0

        Thickest a drawn run can be, in the picture's own pixels, and still be a line rather than a shape

      Returns DotRaster

      The pins, raised along the edges of what is drawn

    • Whether a pixel falls in any of the masked areas.

      Parameters

      • masks: readonly PixelRect[]

        Areas to read as background

      • x: number

        Pixel column

      • y: number

        Pixel row

      Returns boolean