Here's my code that draws a BitmapMesh, as well as a circle on canvas.
canvas.drawBitmapMesh(GirlBitmap, WIDTH, HEIGHT, matrixVertsMoved, 0, null, 0, null); // need to offset this by "addOffset"
canvas.drawCircle(pointX+addOffset, pointY, bubbleSize, p3);
Both of which have to be offset by x by addOffset . It wors fine with the circle, but I can't figure out how to make the bitmap offset?
Any ideas? Maybe I should draw it on a separate canvas and then draw it on the old one, with an offset?
Thanks!
Can't you just translate
the Canvas
by (addOffset, 0)
? Like this:
final int saveCount = canvas.save();
try {
canvas.translate(addOffset, 0);
canvas.drawBitmapMesh(GirlBitmap, WIDTH, HEIGHT, matrixVertsMoved, 0, null, 0, null);
canvas.drawCircle(pointX, pointY, bubbleSize, p3);
} finally {
canvas.restoreToCount(saveCount);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.