如何将图像分割为2份? [英] How to split image to 2 parts?
本文介绍了如何将图像分割为2份?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是与Android初学者。我想为位图图像划分成块,然后显示以相同的方式在图像但分割
I'm a beginner with android. I want to divide a bitmap image into chunks and then display the image in the same way but divided.
编辑:
这code为我工作
Bitmap.createBitmap(位图源,诠释的x,INT Y,INT宽度,高度INT)
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
推荐答案
下面是一些伪code,我希望你可以使用:
Here's some pseudo code, that I hope you can use:
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×300像素。
So, basically - bm1 is the first half and bm2 is the second half. Both will be 300 x 300 pixels.
这篇关于如何将图像分割为2份?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文