开发者

Android Bitmap shaped Rhomboid

开发者 https://www.devze.com 2023-03-19 12:24 出处:网络
I have to implement Bitmap wh开发者_如何学JAVAose shape is like a rhomboid(For ref. I have attached sample image for it.) and the source image is rectangular. I do want to make the image to be skewed,

I have to implement Bitmap wh开发者_如何学JAVAose shape is like a rhomboid(For ref. I have attached sample image for it.) and the source image is rectangular. I do want to make the image to be skewed, cut the image in this shape.

Android Bitmap shaped Rhomboid

Can anyone give me any idea how it can be implemented?


Create a Path of the shape you need and use the canvas.clipPath() method prior to drawing each of the bitmaps.

I have done this with a circle:

Path mPath = new Path();

mPath.addCircle(centerx, centery, radius, Path.Direction.CCW);

canvas.clipPath(mPath, Region.Op.REPLACE);
canvas.drawBitmap(....);

There are various path methods that you can use to create the desired path (path.addArc, path.lineTo, etc).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号