Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
222 views
in Technique[技术] by (71.8m points)

as3 - Fixed the problem of empty spaces between points in the class brush

Can you add code to this class to draw lines continuously?

This is a package for a simple brush on the Swf output. When the mouse moves fast, there are gaps between points. That is, it becomes a point. Can you add code to this class to draw lines continuously?

package tools {
import flash.display.*;
import flash.geom.*;

public class BrushTool implements ITool {
    private var _bitmap:Bitmap;
    private var _bmd:BitmapData;
    private var _brushStroke:Shape;
    public function BrushTool() {
        _bmd = new BitmapData(680, 580, true, 0x00000000);
        _bitmap = new Bitmap(_bmd);
    }
    public function mouseDown(x:Number, y:Number, fillColor:uint):void {
        _brushStroke = new Shape();
        var gradBox:Matrix = new Matrix();
        gradBox.createGradientBox(10, 10, 0, 0, 0);
        _brushStroke.graphics.beginGradientFill(GradientType.RADIAL, [fillColor, fillColor], [1, 0], [127,255], gradBox)
        _brushStroke.graphics.drawCircle(10, 10, 10);
    }
    public function mouseMove(x:Number, y:Number):void {
        var m:Matrix = new Matrix();
        m.translate(x-10, y-10)
        _bmd.draw(_brushStroke, m);
    }
    public function mouseUp(x:Number, y:Number):void {
    }
    public function get art():DisplayObject {
        return _bitmap;
    }
}

}

question from:https://stackoverflow.com/questions/65849570/as3-fixed-the-problem-of-empty-spaces-between-points-in-the-class-brush

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...