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