當前位置: 首頁>>代碼示例>>Java>>正文


Java Picture.getHeight方法代碼示例

本文整理匯總了Java中android.graphics.Picture.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Picture.getHeight方法的具體用法?Java Picture.getHeight怎麽用?Java Picture.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Picture的用法示例。


在下文中一共展示了Picture.getHeight方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: genCaptureBitmap

import android.graphics.Picture; //導入方法依賴的package包/類
/**
 * 截取所有網頁內容到 Bitmap
 *
 * @return Bitmap
 */
Bitmap genCaptureBitmap() throws OutOfMemoryError {
    // @todo Future versions of WebView may not support use on other threads.
    try {
        Picture picture = getWebView().capturePicture();
        int height = picture.getHeight(), width = picture.getWidth();
        if (height == 0 || width == 0) {
            return null;
        }
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        picture.draw(canvas);
        return bitmap;
    } catch (NullPointerException e) {
        return null;
    }
}
 
開發者ID:feelinglucky,項目名稱:iZhihu,代碼行數:22,代碼來源:DetailFragment.java

示例2: getAndroidBitmap

import android.graphics.Picture; //導入方法依賴的package包/類
private static android.graphics.Bitmap getAndroidBitmap(InputStream inputStream, PlatformConnector.SvgScaleType scaleType, float scaleValue) throws IOException {
    synchronized (SVG.getVersion()) {
        try {
            SVG svg = SVG.getFromInputStream(inputStream);
            Picture picture = svg.renderToPicture();

            float scale = 1;

            switch (scaleType) {

                case SCALED_TO_WIDTH:
                    scale = scaleValue / picture.getWidth();
                    break;
                case SCALED_TO_HEIGHT:
                    scale = scaleValue / picture.getHeight();
                    break;
                case DPI_SCALED:
                    scale = CB.getScaledFloat(scaleValue);
                    break;
                case SCALED_TO_WIDTH_OR_HEIGHT:
                    scale = Math.min(scaleValue / picture.getHeight(), scaleValue / picture.getWidth());
                    break;
            }

            float bitmapWidth = picture.getWidth() * scale;
            float bitmapHeight = picture.getHeight() * scale;

            android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap((int) Math.ceil(bitmapWidth),
                    (int) Math.ceil(bitmapHeight), Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(bitmap);
            canvas.drawPicture(picture, new RectF(0, 0, bitmapWidth, bitmapHeight));

            return bitmap;
        } catch (Exception e) {
            throw new IOException(e);
        }
    }
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:39,代碼來源:AndroidRealSvgBitmap.java

示例3: PictureBitmapTextureAtlasSource

import android.graphics.Picture; //導入方法依賴的package包/類
public PictureBitmapTextureAtlasSource(final Picture pPicture, final int pTextureX, final int pTextureY) {
	this(pPicture, pTextureX, pTextureY, pPicture.getWidth(), pPicture.getHeight());
}
 
開發者ID:ArturVasilov,項目名稱:AndroidCourses,代碼行數:4,代碼來源:PictureBitmapTextureAtlasSource.java

示例4: PictureTextureSource

import android.graphics.Picture; //導入方法依賴的package包/類
public PictureTextureSource(final Picture pPicture) {
	this(pPicture, pPicture.getWidth(), pPicture.getHeight());
}
 
開發者ID:liufeiit,項目名稱:itmarry,代碼行數:4,代碼來源:PictureTextureSource.java


注:本文中的android.graphics.Picture.getHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。