public void draw(GraphicsWrapper gw) { palette.draw(gw); // draw filled rectangles over the selected strokes gw.setCoordinateSystemToWorldSpaceUnits(); for (Stroke s : selectedStrokes) { AlignedRectangle2D r = s.getBoundingRectangle(); gw.setColor(1.0f, 0.5f, 0, 0.2f); // transparent orange Vector2D diagonal = r.getDiagonal(); gw.fillRect(r.getMin().x(), r.getMin().y(), diagonal.x(), diagonal.y()); } gw.setCoordinateSystemToPixels(); // draw cursors for (int i = 0; i < cursorContainer.getNumCursors(); ++i) { MyCursor cursor = cursorContainer.getCursorByIndex(i); if (cursor.type == MyCursor.TYPE_NOTHING) gw.setColor(0.5f, 0, 0, 0.65f); // red (because this cursor is being ignored) else gw.setColor(0, 0.5f, 0.5f, 0.65f); // cyan gw.fillCircle(cursor.getCurrentPosition().x() - 10, cursor.getCurrentPosition().y() - 10, 10); if (cursor.type == MyCursor.TYPE_INKING) { // draw ink trail gw.setColor(0, 0, 0); gw.drawPolyline(cursor.getPositions()); } else if (cursor.type == MyCursor.TYPE_SELECTION) { if (cursor.doesDragLookLikeLassoGesture()) { // draw filled polygon gw.setColor(0, 0, 0, 0.2f); gw.fillPolygon(cursor.getPositions()); } else { // draw polyline to indicate that a lasso could be started gw.setColor(0, 0, 0); gw.drawPolyline(cursor.getPositions()); // also draw selection rectangle gw.setColor(0, 0, 0, 0.2f); Vector2D diagonal = Point2D.diff(cursor.getCurrentPosition(), cursor.getFirstPosition()); gw.fillRect( cursor.getFirstPosition().x(), cursor.getFirstPosition().y(), diagonal.x(), diagonal.y()); } } } }