开发者

Slicing a Picture

开发者 https://www.devze.com 2023-02-02 12:58 出处:网络
I have a Picture pic = webView.capturePicture(); which is potentially huge and needs to be sliced into multiple chunks that will fit the screen.

I have a

Picture pic = webView.capturePicture();

which is potentially huge and needs to be sliced into multiple chunks that will fit the screen.

The naive thing I'm currently doing is

Bitmap bm = Bitmap.createBitmap(screenWidth开发者_如何学Python, screenHeigth, RGB_565);
Canvas canvas = new Canvas(bm);
canvas.drawPicture(pic);
fullScreenImageView.setImageBitmap(bm);

What would be the efficient way to "paginate" the Picture to be displayed on screen (these "pages" will be later replacing one another)?


Can't you just call getDrawingCache() on the webView? You won't be creating any new bitmap because it is the cache of the webview which is uses to scroll.

0

精彩评论

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