android-paint

How tro draw fading path

偶尔善良 提交于 2019-12-08 03:31:00
问题 How can I draw Path with fading (opacity or thicknes) line? Something like this. I know there is LinearGradient shader for Paint , but it won't bend along the Path . One possible solution might be to get points along the Path and just draw it by myself through the segments`. But I coouldn't find any method for that either. 回答1: I came up with the following code. The mos important thing is PathMeasure's getPosTan() method. if (getGesturePath() != null) { final short steps = 150; final byte

Custom Brush with Undo/Redo operation in Android Canvas

笑着哭i 提交于 2019-12-02 23:17:16
问题 I want to implement a canvas drawing application with custom brush & undo/redo operation. First of all my code works perfectly without using the custom brush (including the undo/redo operation). According to this answer How to make custom brush for canvas in android? I used simple image spikes for bitmap draw. Now the issue are, The undo, redo operation doesn't works, custom brush paints over and over again whenever moving the touch points. Q: How to make the undo/redo operation work? The