当前位置: 首页>>代码示例>>Java>>正文


Java Picture.draw方法代码示例

本文整理汇总了Java中android.graphics.Picture.draw方法的典型用法代码示例。如果您正苦于以下问题:Java Picture.draw方法的具体用法?Java Picture.draw怎么用?Java Picture.draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Picture的用法示例。


在下文中一共展示了Picture.draw方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: captureWebViewall

import android.graphics.Picture; //导入方法依赖的package包/类
private Bitmap captureWebViewall(WebView webView) {
    Picture snapShot = webView.capturePicture();
    Bitmap bmp = Bitmap.createBitmap(snapShot.getWidth(),
            snapShot.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bmp);
    snapShot.draw(canvas);
    return bmp;
}
 
开发者ID:shenhuanet,项目名称:ZhidaoDaily-android,代码行数:9,代码来源:DetailActivity.java

示例2: onLoadBitmap

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
	final Picture picture = this.mPicture;
	if (picture == null) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ".");
		return null;
	}

	final Bitmap bitmap = Bitmap.createBitmap(this.mTextureWidth, this.mTextureHeight, pBitmapConfig);
	final Canvas canvas = new Canvas(bitmap);

	final float scaleX = (float)this.mTextureWidth / this.mPicture.getWidth();
	final float scaleY = (float)this.mTextureHeight / this.mPicture.getHeight();
	canvas.scale(scaleX, scaleY, 0, 0);

	picture.draw(canvas);

	return bitmap;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:20,代码来源:PictureBitmapTextureAtlasSource.java

示例3: onLoadBitmap

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
	final Picture picture = this.mPicture;
	if(picture == null) {
		Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ".");
		return null;
	}

	final Bitmap bitmap = Bitmap.createBitmap(this.mTextureWidth, this.mTextureHeight, pBitmapConfig);
	final Canvas canvas = new Canvas(bitmap);

	final float scaleX = (float)this.mTextureWidth / this.mPicture.getWidth();
	final float scaleY = (float)this.mTextureHeight / this.mPicture.getHeight();
	canvas.scale(scaleX, scaleY, 0, 0);

	picture.draw(canvas);

	return bitmap;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:20,代码来源:PictureBitmapTextureAtlasSource.java

示例4: draw

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas) {

    canvas.drawCircle(mBounds.centerX(), mBounds.centerY(), mBounds.centerX(), mBackgroundPaint);
    Picture picture = new Picture() ;
    picture.draw(canvas);
    canvas.save();
    canvas.rotate(180 * mRotation, (x(0) + x(1))/2, (y(0) + y(1))/2);
    canvas.drawLine(x(0), y(0), x(1), y(1), mLinePaint);
    canvas.restore();

    canvas.save();
    canvas.rotate(180 * mRotation, (x(2) + x(3)) / 2, (y(2) + y(3)) / 2);
    canvas.drawLine(x(2), y(2), x(3), y(3), mLinePaint);
    canvas.restore();

    canvas.save();
    canvas.rotate(180 * mRotation, (x(4) + x(5)) / 2, (y(4) + y(5)) / 2);
    canvas.drawLine(x(4), y(4), x(5), y(5), mLinePaint);
    canvas.restore();

}
 
开发者ID:tarek360,项目名称:PlayPauseDrawable,代码行数:23,代码来源:PlayPauseDrawable.java

示例5: onLoadBitmap

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
	final Picture picture = this.mPicture;
	if(picture == null) {
		Debug.e("Failed loading Bitmap in PictureTextureSource.");
		return null;
	}

	final Bitmap bitmap = Bitmap.createBitmap(this.mWidth, this.mHeight, pBitmapConfig);
	final Canvas canvas = new Canvas(bitmap);

	final float scaleX = (float)this.mWidth / this.mPicture.getWidth();
	final float scaleY = (float)this.mHeight / this.mPicture.getHeight();
	canvas.scale(scaleX, scaleY, 0, 0);

	picture.draw(canvas);

	return bitmap;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:20,代码来源:PictureTextureSource.java

示例6: 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

示例7: onClick

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.button:
            String time = Tools.getCurrentTime();
            String version = Tools.getVersion(mContext);
            String name = Tools.getName(mContext);
            String currentUrl = mWebView.getUrl();
            String info = "Application Info: \n\n version: " + version
                    + "\n name: " + name
                    + "\n curTime: " + time
                    + "\n curUrl: " + currentUrl;
            mWebView.loadUrl("javascript:showAlert('" + info + "')");
            break;
        case R.id.save:
            Picture snapShot = mWebView.capturePicture();
            Bitmap bmp = Bitmap.createBitmap(snapShot.getWidth(), snapShot.getHeight(), Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(bmp);
            snapShot.draw(canvas);
            if (!TextUtils.isEmpty(FileUtil.savaBitmap2SDcard(mContext, bmp, "1111"))) {
                T.showSToast(mContext, "success");
            }
            break;
        default:
            break;
    }
}
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:28,代码来源:AllWebViewActivity.java

示例8: getScreenView

import android.graphics.Picture; //导入方法依赖的package包/类
public Bitmap getScreenView(){
    Picture snapShot = webView.capturePicture();
    Bitmap bmp = Bitmap.createBitmap(snapShot.getWidth(),snapShot.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bmp);
    snapShot.draw(canvas);
    return bmp;
}
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:8,代码来源:FakeWebView.java

示例9: getBitmapOfWebView

import android.graphics.Picture; //导入方法依赖的package包/类
/**
 * Returns a bitmap of a given WebView.
 *  
 * @param webView the webView to save a bitmap from
 * @return a bitmap of the given web view
 * 
 */

private Bitmap getBitmapOfWebView(final WebView webView){
	Picture picture = webView.capturePicture();
	Bitmap b = Bitmap.createBitmap( picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
	Canvas c = new Canvas(b);
	picture.draw(c);
	return b;
}
 
开发者ID:IfengAutomation,项目名称:test_agent_android,代码行数:16,代码来源:ScreenshotTaker.java

示例10: getBitmapFromWebView

import android.graphics.Picture; //导入方法依赖的package包/类
private Bitmap getBitmapFromWebView(WebView webView) {
    try {
        float scale = 1.0f / getResources().getDisplayMetrics().density;
        Picture picture = webView.capturePicture();
        Bitmap bitmap = Bitmap.createBitmap((int) (picture.getWidth() * scale), (int) (picture.getHeight() * scale), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.scale(scale, scale);
        picture.draw(canvas);
        return bitmap;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:plafue,项目名称:writeily-pro,代码行数:15,代码来源:PreviewActivity.java

示例11: takeScreenshot

import android.graphics.Picture; //导入方法依赖的package包/类
private Bitmap takeScreenshot (WebView page) {
    Picture picture = page.capturePicture();
    Bitmap bitmap   = Bitmap.createBitmap(picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas   = new Canvas(bitmap);

    picture.draw(canvas);

    return bitmap;
}
 
开发者ID:pankajnirwan103,项目名称:cordova-plugin-printer,代码行数:10,代码来源:Printer.java

示例12: getDrawable

import android.graphics.Picture; //导入方法依赖的package包/类
@Override
    public Drawable getDrawable(final InputStream aFileInputStream) {
        // try {
        // default implementation will load the file as a bitmap and create
        // a BitmapDrawable from it
//        Log.d(TAG, "Get Drawable Vector");
        SVG svg = SVGParser.getSVGFromInputStream(aFileInputStream);
       Picture pic = svg.getPicture();
       Bitmap bm = Bitmap.createBitmap(pic.getWidth(), pic.getHeight(), Bitmap.Config.ARGB_8888);
       Canvas c = new Canvas(bm);
       pic.draw(c);
       return new BitmapDrawable(bm);
//       return bm;
       
//        Log.d(TAG, "SVG is create");
//        try {
//            PictureDrawable draw = svg.createPictureDrawable();
//            Log.d(TAG, "Get Drawable Vector : " + draw.getBounds());
//            return draw;
//        } catch (java.lang.UnsupportedOperationException e) {
//            Log.e(TAG, e.getMessage());
//            return null;
//        }
        // final Bitmap bitmap = BitmapFactory.decodeStream(aFileInputStream);
        // if (bitmap != null) {
        // return new ExpirableBitmapDrawable(bitmap);
        // }
        // } catch (final OutOfMemoryError e) {
        // logger.error("OutOfMemoryError loading bitmap");
        // System.gc();
        // throw new LowMemoryException(e);
        // }
        // return null;
    }
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:35,代码来源:CloudmadeTileSourceVector.java

示例13: convertPictureToBitmap

import android.graphics.Picture; //导入方法依赖的package包/类
public static Bitmap convertPictureToBitmap(Picture mCompassRose) {
    Bitmap bm = Bitmap.createBitmap(mCompassRose.getWidth(), mCompassRose.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(bm);
    mCompassRose.draw(c);
    return bm;
}
 
开发者ID:gabuzomeu,项目名称:osmLib,代码行数:7,代码来源:CompassPictureFactory.java


注:本文中的android.graphics.Picture.draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。