I have a bitmap. I would like to draw this bitmap into a trapezoid, anchoring the four corners of the original bitmap to the corners of the trapezoid. Is this possible in Android?
答案 0 :(得分:1)
您可以使用Matrix.setSkew
。
matrix.setSkew(0.5f, 0.5f, bitmap.getWidth/2, bitmap.getHeight/2);
canvas.drawBitmap(bitmap, matrix, null);
canvas.drawBitmapMesh(bitmap, 1, 1, new float[]{
0.3f, 0,
0.6f, 0,
0, 1,
1, 1,
}, 0, null, 0, null);
您需要尝试使用float []和skew的值。