當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。