0

如何从设备屏幕中的 html 创建位图?

我试过了,但它给了我一个黑色的图像输出

Webview mAppView = this.webView;
float appScale = mAppView.getScale();

int scaledViewHeight = (int)(webViewHeight * appScale);
int scaledViewWidth = (int)(webViewWidth * appScale);

bmp = Bitmap.createBitmap(scaledViewWidth, scaledViewHeight, Bitmap.Config.RGB_565);

try {
    os = new FileOutputStream(Environment.getExternalStorageDirectory()+"/DCIM/Camera/" + "canvas.png");
    bmp.compress(CompressFormat.PNG, 90, os);

    } catch(IOException e) {
        Log.v("save image", "fail"); 
    }
4

0 回答 0