Bitmap copy 参数

api:


Bitmap copy (Bitmap.Config config,  boolean isMutable)

Tries to make a new bitmap based on the dimensions of this bitmap, setting the new bitmap's config to the one specified, and then copying this bitmap's pixels into the new bitmap. If the conversion is not supported, or the allocator fails, then this returns NULL. The returned bitmap initially has the same density as the original.
试图让一个新的位图基于位图的尺寸,设置新的位图的配置一个指定,然后复制这个位图的像素到新的位图。 如果不支持转换,或者分配程序失败,返回NULL。 返回的位图最初具有相同的密度随着originalTries新建一个位图基于位图的尺寸,设置新的位图的配置一个指定,然后复制这个位图的像素到新的位图。 如果不支持转换,或者分配程序失败,返回NULL。 返回的最初具有相同的密度与原始位图

Parameters

config Bitmap.Config: The desired config for the resulting bitmap  所需的配置为生成的位图
isMutable boolean: True if the resulting bitmap should be mutable (i.e. its pixels can be modified) 如果为true由此产生的位图应该是可变的(即它的像素可以修改)
Returns
Bitmap the new bitmap, or null if the copy could not be made. 新的位图,或null如果不能复制


/**
	 * 复制位图<br>
	 * 根据该位图的大小产生一个新位图,根据指定的结构设置新位图的结构,然后把位图的像素拷贝到新位图中。如果不支持该转换,或者分配内存失败,
	 * 那就返回NULL。返回的位图和原图有同样的像素密度 方 法 名:copy <br>
	 * 创 建 人: <br>
	 * 创建时间:2016-6-7 上午9:38:39 <br>
	 * 修 改 人: <br>
	 * 修改日期: <br>
	 * @param paramBitmap 源
	 * @param config 
	 * @param isMutable
	 * @return Bitmap
	 */
	public static Bitmap copy(Bitmap paramBitmap, Config config, boolean isMutable) {
		Bitmap bitmap;
		try {
			bitmap = paramBitmap.copy(config, isMutable);
		} catch (OutOfMemoryError localOutOfMemoryError) {
			gc();
			bitmap = paramBitmap.copy(config, isMutable);
		}
		return bitmap;
	}


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值