颤抖,新的画布呈现在图片上

时间:2020-07-29 09:17:17

标签: android flutter canvas

我在绘图板上工作,需要在Picture / PictureRecorder上附加一些线或点。

如下所示:

PictureRecorder pictureRecorder = new PictureRecorder();
Canvas canvas = new Canvas(pictureRecorder);
canvas.draw....

Picture picture = pictureRecorder.endRecording();


// than, use pictureRecorder again
Canvas canvas2 = new Canvas(pictureRecorder);
canvas2.draw....
Picture picture2 = pictureRecorder.endRecording();
// picture2 is base on picture

在具有canvas / bitmap的Android java中,会这样

Canvas canvas = new Canvas();
Bitmap bitmap = Bitmap.createBitmap(w, h, config);
canvas.setBitmap(bitmap);
canvas.drawLine(...)
...

// and some where, use bitmap again
Canvas canvas2 = new Canvas();
canvas2.setBitmap(bitmap);
canvas2.drawRect(...);
// after these, bitmap will has line and rect

有人可以帮助我吗?非常感谢。

0 个答案:

没有答案