更改矩阵的背景颜色

时间:2019-01-31 10:46:38

标签: android-imageview

我已经使用矩阵在imageView中实现了偏斜。一切运行正常,但是在顶部和底部都有黑色。请帮我改变颜色。

ScreenShot

Bitmap bitmap = originalBitmap;
            Matrix matrix2 = new Matrix();
            int oldw = bitmap.getWidth();
            int oldh = bitmap.getHeight();
            float d_up = oldh / 20;
            float d_down = d_up + 10;
            float[] src2 = new float[]{0, 0, oldw, 0, oldw,
                    oldh, 0, oldh};
            float[] dst2 = new float[]{0, 0, oldw, d_down,
                    oldw, oldh - d_down, 0, oldh};
            matrix2.setPolyToPoly(src2, 0, dst2, 0,
                    src2.length >> 1);
            Bitmap bMatrix2 = Bitmap.createBitmap(bitmap, 0, 0,
                    bitmap.getWidth(), bitmap.getHeight(),
                    matrix2, true);
            imageViewOriginal.setImageBitmap(bMatrix2);

0 个答案:

没有答案