diva.whiteboard
Class HighlightInterpreter

java.lang.Object
  extended by diva.canvas.interactor.AbstractInteractor
      extended by diva.sketch.BasicInterpreter
          extended by diva.whiteboard.HighlightInterpreter
All Implemented Interfaces:
LayerListener, LayerMotionListener, Interactor, EventListener

public class HighlightInterpreter
extends BasicInterpreter

This interpreter highlights, meaning that it puts ink at the back of the drawing rather than at the front.

Version:
$Revision: 1.5 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Field Summary
 
Fields inherited from class diva.sketch.BasicInterpreter
_controller, _curStroke, _curSymbol, _strokeBuffer
 
Constructor Summary
HighlightInterpreter(SketchController c)
          Create a HighlightInterpreter which is used by the specified controller to interpret sketch input.
 
Method Summary
protected  void appendStroke(LayerEvent e)
          Append the given new point/timestamp to the current stroke.
protected  void finishStroke(LayerEvent e)
          Called at the end of the mouseReleased method to finish the drawing of a stroke.
protected  void startStroke(LayerEvent e)
          This method is invoked upon mouse down.
 
Methods inherited from class diva.sketch.BasicInterpreter
getController, getCurrentStroke, getCurrentSymbol, isMotionEnabled, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, removeCurrentSymbol
 
Methods inherited from class diva.canvas.interactor.AbstractInteractor
accept, getMouseFilter, isConsuming, isEnabled, mouseClicked, setConsuming, setEnabled, setMotionEnabled, setMouseFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HighlightInterpreter

public HighlightInterpreter(SketchController c)
Create a HighlightInterpreter which is used by the specified controller to interpret sketch input.

Method Detail

appendStroke

protected final void appendStroke(LayerEvent e)
Append the given new point/timestamp to the current stroke. Consume the event when done.

Overrides:
appendStroke in class BasicInterpreter

finishStroke

protected final void finishStroke(LayerEvent e)
Called at the end of the mouseReleased method to finish the drawing of a stroke.

Overrides:
finishStroke in class BasicInterpreter

startStroke

protected final void startStroke(LayerEvent e)
Description copied from class: BasicInterpreter
This method is invoked upon mouse down. Reset the _strokeBuffer to clear the previou stroke. Set the current stroke (_curStroke) to point to the stroke buffer, and instantiate a StrokeSymbol (_curSymbol) that paints the stroke with outline/fill color and line width specified in the controller. If a SketchPane is used, get the SketchLayer and call startStroke, this will set the starting point of the line segment to be drawn. SketchLayer will take care of drawing the last line segment in the current stroke, the prior segments stay on the canvas, they are not being rerendered. If a SketchPane is not being used, then add _curSymbol to the sketch model so that it can be rendered ('cause there will be no SketchLayer).

Overrides:
startStroke in class BasicInterpreter


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.