I have a Bitmap inside a View. Here's my code for drawing it:
@Override protected void onDraw(Canvas canvas) {
canvas.drawColor(0xFFCCCCCC);
int w = mBitmap.getWidth();
int h = mBitmap.getHeight();
float[] mVerts = {
0, 0,
w * 0.8f, 0,
0, h,
w, h * 0.7f
};
canvas.drawBitmapMesh(mBitmap, 1, 1, mVerts, 0, null, 0, null);
}
and it looks like this:
Now, the question is:
If I have an image with some shape and transparent background how can I find a polygon, which is covering the area and will look like this:
And then how should I add all these points to the bitmap mesh so I can let user move them and manipulate an image like in the first example?