Android Bitmap shaped Rhomboid
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.
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).
精彩评论