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


Java Canvas.drawPicture方法代碼示例

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


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

示例1: createBitmap

import android.graphics.Canvas; //導入方法依賴的package包/類
public static Bitmap createBitmap(InputStream in, int w, int h, boolean closeStream) {
		if (in == null) {
			return null;
		}
		com.larvalabs.svgandroid.SVG svg;
		svg = new SVGBuilder().readFromInputStream(in).build();
		
		Bitmap bitmap = Bitmap.createBitmap(w, h, Config.ARGB_8888);
		Canvas canvas = new Canvas(bitmap);
		Picture pic = svg.getPicture();
//	      svg.renderToCanvas(canvas/*, new RectF(0f, 0f, (float)w, (float)h)*/);
//	      svg.renderToCanvas(canvas, new RectF(0f, 0f, (float)w, (float)h));
		canvas.drawPicture(pic, new Rect(0, 0, w, h));
		if (closeStream) {
			try {
				in.close();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return bitmap;
	}
 
開發者ID:eduyayo,項目名稱:gamesboard,代碼行數:23,代碼來源:ImageUtils.java

示例2: draw

import android.graphics.Canvas; //導入方法依賴的package包/類
/**
 * Original author nimingtao wrote that this method may not work on devices with Ice Cream Sandwich (Android v4.0).<br/>
 * See: http://stackoverflow.com/q/10384613/1084488<br/>
 * Apparently this is because canvas.drawPicture is not supported with hardware acceleration. If the problem occurs
 * and solved by programmatically turning off hardware acceleration only on the view that will draw the Picture:
 * view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);<br/>
 * <br/>
 * However, I (mstevens83) was unable to reproduce this problem on an emulator running Ice Cream Sandwich, nor on
 * physical devices running Jelly Bean (v4.1.2 and v4.3 tested).
 */
@Override
public void draw(Canvas canvas) {
	if (getPicture() != null) {
		Rect bounds = getBounds();
		canvas.save();
		// draw picture to fit bounds!
		canvas.drawPicture(getPicture(), bounds);
		canvas.restore();
	}
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:21,代碼來源:SVGDrawable.java

示例3: draw

import android.graphics.Canvas; //導入方法依賴的package包/類
@Override
public int draw(Canvas canvas) {
    if (destF != null) {
        canvas.drawPicture(picture, destF);
    } else if (dest != null) {
        canvas.drawPicture(picture, dest);
    } else {
        canvas.drawPicture(picture);
    }
    return NO_SAVE;
}
 
開發者ID:52inc,項目名稱:CanvasScript,代碼行數:12,代碼來源:PictureParams.java


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