如何在Android中剪切图像? [英] How to shear image in Android?

查看:84
本文介绍了如何在Android中剪切图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Android中剪切图像?似乎找不到任何教程.

is it possible to shear image in Android? Seems I can't find any tutorial of it.

推荐答案

也许您已经找到了解决方案,但以防万一,我认为这是您所需要的:

Perhaps you've found the solution, but just in case, I think this is what you needed:

Bitmap src = BitmapFactory.decodeResource(this.getResources(), drawable.sample);
int width = src.getWidth();
int height = src.getHeight();
float skewX = 5.0;
float skewY = 6.0;
Matrix matrix = new Matrix();
matrix.setSkew(skewX, skewY);
Bitmap img = Bitmap.createBitmap(src, 0, 0, width, height, matrix, true);

这篇关于如何在Android中剪切图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆