<分区>
我是 android 的初学者。我想将位图图像分成 block ,然后以相同的方式但分割显示图像。
编辑:
这段代码对我有用
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
<分区>
我是 android 的初学者。我想将位图图像分成 block ,然后以相同的方式但分割显示图像。
编辑:
这段代码对我有用
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
最佳答案
下面是一些伪代码,希望你能使用:
Bitmap originalBm = BitmapFactory.decodeFile("fileUrl"); // Let's say this bitmap is 300 x 600 pixels
Bitmap bm1 = Bitmap.createBitmap(originalBm, 0, 0, originalBm.getWidth(), (originalBm.getHeight() / 2));
Bitmap bm2 = Bitmap.createBitmap(originalBm, 0, (originalBm.getHeight() / 2), originalBm.getWidth(), (originalBm.getHeight() / 2));
所以,基本上 - bm1 是上半部分,bm2 是下半部分。两者均为 300 x 300 像素。
关于android - 如何将图像分成两部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7234986/
相关文章:
javascript - 在处理 js 时无法从 PImage 获取像素 []
c++ - 尝试在 OpenCv 中使用 sift 匹配两个图像,但匹配太多
java - DialogListener 的 startActivity 导致应用程序崩溃
java - Android - 刷新 AlertDialog 中的数据?
android - 如何知道用户何时关闭了 Android 应用程序?
image-processing - 如何为 ImageNet 加速 "ImageFolder"
android - 使用资源文件的 TabLayout 图标