function PencilTool(toolContext, optionProviders, type) {
    /**
     * @type {CanvasRenderingContext2D}
     */
    this.sourceContext = Canvas2DContext(toolContext.sourceCanvas);

    /**
     * @type {HTMLCanvasElement}
     */
    this.sourceCanvas = toolContext.sourceCanvas;

    /**
     * @type {CanvasRenderingContext2D}
     */
    this.brushContext = Canvas2DContext(toolContext.brushCanvas);

    /**
     * Auxiliary canvas to allow for implementation of alpha blending when
     * using drawing tools.
     * @type {HTMLCanvasElement}
     */
    this.brushCanvas = toolContext.brushCanvas;

    /**
     * @type {ColorPalette}
     */
    this.colorPalette = optionProviders.colorPalette;

    /**
     * @type {HTMLInputElement}
     */
    this.sizeSelector = optionProviders.sizeSelector;

    /**
     * Draw display canvas callback.
     * @type {function()}
     */
    this.drawDisplayCanvas = toolContext.drawDisplayCanvas;

    /**
     * Whether the mouse is being held down for a drag.
     * @type {boolean}
     */
    this.dragging = false;

    /**
     * Contains the last MAX_SNAPSHOTS {x,y} coordinate pairs.
     * @type {!Stack.<MouseCoordinates>}
     */
    this.lastPositions = new bitmapper.Stack(bitmapper.ImageFile.MAX_SNAPSHOTS);

    /**
     * The last {x,y} coordinates.
     * @type {MouseCoordinates}
     */
    this.lastCoordinate = null;

    /**
     * Type of pencil tool.
     * @type {PencilTool.ToolType}
     */
    this.type = type;
  }
/**
   * Pencil tool. 1px crisp drawing and replacement of color on canvas to
   * selected color (not additive color drawing).
   * @constructor
   * @struct
   * @implements {Tool}
   * @param {ToolContext} toolContext
   * @param {OptionProviders} optionProviders
   * @param {PencilTool.ToolType} type
   */
Pencil tool. 1px crisp drawing and replacement of color on canvas to
selected color (not additive color drawing).
Pencil tool . 1px crisp drawing and replacement of color on canvas to selected color ( not additive color drawing ) .
function PencilTool(toolContext, optionProviders, type) {
    this.sourceContext = Canvas2DContext(toolContext.sourceCanvas);
    this.sourceCanvas = toolContext.sourceCanvas;
    this.brushContext = Canvas2DContext(toolContext.brushCanvas);
    this.brushCanvas = toolContext.brushCanvas;
    this.colorPalette = optionProviders.colorPalette;
    this.sizeSelector = optionProviders.sizeSelector;
    this.drawDisplayCanvas = toolContext.drawDisplayCanvas;
    this.dragging = false;
    this.lastPositions = new bitmapper.Stack(bitmapper.ImageFile.MAX_SNAPSHOTS);
    this.lastCoordinate = null;
    this.type = type;
  }
function PencilTool ( toolContext , optionProviders , type ) { this . sourceContext = Canvas2DContext ( toolContext . sourceCanvas ) ; this . sourceCanvas = toolContext . sourceCanvas ; this . brushContext = Canvas2DContext ( toolContext . brushCanvas ) ; this . brushCanvas = toolContext . brushCanvas ; this . colorPalette = optionProviders . colorPalette ; this . sizeSelector = optionProviders . sizeSelector ; this . drawDisplayCanvas = toolContext . drawDisplayCanvas ; this . dragging = false ; this . lastPositions = new bitmapper . Stack ( bitmapper . ImageFile . MAX_SNAPSHOTS ) ; this . lastCoordinate = null ; this . type = type ; }
Pencil tool.
Pencil tool .
/**
     * @type {CanvasRenderingContext2D}
     */ /**
     * @type {HTMLCanvasElement}
     */ /**
     * @type {CanvasRenderingContext2D}
     */ /**
     * Auxiliary canvas to allow for implementation of alpha blending when
     * using drawing tools.
     * @type {HTMLCanvasElement}
     */ /**
     * @type {ColorPalette}
     */ /**
     * @type {HTMLInputElement}
     */ /**
     * Draw display canvas callback.
     * @type {function()}
     */ /**
     * Whether the mouse is being held down for a drag.
     * @type {boolean}
     */ /**
     * Contains the last MAX_SNAPSHOTS {x,y} coordinate pairs.
     * @type {!Stack.<MouseCoordinates>}
     */ /**
     * The last {x,y} coordinates.
     * @type {MouseCoordinates}
     */ /**
     * Type of pencil tool.
     * @type {PencilTool.ToolType}
     */