From f931c48a7d0bcf1222cf05787e3294839ed0b9fb Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 29 Feb 2012 09:47:41 -0800 Subject: resample the brush stroke so we don't have gaps if the path is drawn rapidly, and, allow to change the stroke color, and, more efficient stroke rendering by drawing translated radial gradients (instead of creating new gradients for each stroke sample) --- js/tools/BrushTool.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/tools/BrushTool.js') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 9a0ad583..776d914c 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -64,6 +64,11 @@ exports.BrushTool = Montage.create(ShapeTool, { //start a new brush stroke if (this._selectedBrushStroke === null){ this._selectedBrushStroke = new GLBrushStroke(); + if (this.application.ninja.colorController.colorToolbar.stroke.webGlColor){ + this._selectedBrushStroke.setStrokeColor(this.application.ninja.colorController.colorToolbar.stroke.webGlColor); + } + //TODO get these values from the options + this._selectedBrushStroke.setStrokeWidth(20); } NJevent("enableStageMove");//stageManagerModule.stageManager.enableMouseMove(); } //value: function (event) { @@ -132,10 +137,7 @@ exports.BrushTool = Montage.create(ShapeTool, { this._isDrawing = false; this._hasDraw = false; - //TODO get these values from the options - if (this._selectedBrushStroke){ - this._selectedBrushStroke.setStrokeWidth(20); - } + //display the previously drawn stroke in a separate canvas this.RenderCurrentBrushStroke(); @@ -150,7 +152,7 @@ exports.BrushTool = Montage.create(ShapeTool, { //clear the canvas before we draw anything else this.application.ninja.stage.clearDrawingCanvas(); if (this._selectedBrushStroke && this._selectedBrushStroke.getNumPoints()>0){ - this._selectedBrushStroke.computeMetaGeometry(); + //this._selectedBrushStroke.computeMetaGeometry(); var ctx = this.application.ninja.stage.drawingContext;//stageManagerModule.stageManager.drawingContext; if (ctx === null) throw ("null drawing context in Brushtool::ShowCurrentBrushStrokeOnStage"); -- cgit v1.2.3