当前位置: 首页>>代码示例>>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;未经允许,请勿转载。