开发者

How to split image to 2 parts? [closed]

It's difficult to tell what is bei开发者_开发百科ng asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

Edit:

This code has worked for me

Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)


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));

So, basically - bm1 is the first half and bm2 is the second half. Both will be 300 x 300 pixels.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜