位图剪切参考重载方法4和6,重载方法6比较简单
public static Bitmap createBitmap (Bitmap src)
从原位图src复制出一个新的位图,和原始位图相同
public static Bitmap createBitmap (int[] colors, int width, int height, Bitmap.Config config)
这个函数根据颜色数组来创建位图,注意:颜色数组的长度>=width*height
此函数创建位图的过程可以简单概括为为:更加width和height创建空位图,然后用指定的颜色数组colors来从左到右从上至下一次填充颜色。config是一个枚举,可以用它来指定位图“质量”。
public static Bitmap createBitmap (int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)
此方法与2类似,但我还不明白offset和stride的作用。
public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter)
从原始位图剪切图像,这是一种高级的方式。可以用Matrix(矩阵)来实现旋转等高级方式截图
参数说明:
Bitmap source:要从中截图的原始位图
int x:起始x坐标
int y:起始y坐标
int width:要截的图的宽度
int height:要截的图的宽度
Bitmap.Config config:一个枚举类型的配置,可以定义截到的新位图的质量
返回值:返回一个剪切好的Bitmap
public static Bitmap createBitmap (int width, int height, Bitmap.Config config)
根据参数创建新位图
public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height)
简单的剪切图像的方法,可以参考上面的4.
文章出处:http://www.cnblogs.com/igrl/archive/2010/07/30/Bitmap_createBitmap.html
分享到:
相关推荐
处理bitmap内存溢出问题
android bitmap outofMemory 用来解决android中常见的bitmap outOfMemory
Android Bitmap.getPixels的正确理解演示源码,参考文章《Android Bitmap入门:getPixels的正确理解》
一、Bitmap.create(width, height, bgcolor) 创建一个width x height像素大小的位图,底色为bgcolor所代表的颜色。 如:bitmap.create(10, 10, 0xff0000); // 创建一个10 x 10像素的底色为红色的位图 二、Bitmap.to...
RoaringBitmap.zip
赠送jar包:RoaringBitmap-0.7.45.jar; 赠送原API文档:RoaringBitmap-0.7.45-javadoc.jar; 赠送源代码:RoaringBitmap-0.7.45-sources.jar; 赠送Maven依赖信息文件:RoaringBitmap-0.7.45.pom; 包含翻译后的API...
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap .getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff424242; final Paint paint = new Paint(); final ...
钱萌萌作品集.bitmap.pdf
开源项目-boljen-go-bitmap.zip,go-bitmap - Some simple bitmap utilities - Could someone please review SetAtomic?
开源项目-seiflotfy-s-bitmap.zip,S-Bitmap: Distinct Counting with a Self-Learning Bitmap (an equivalent to HyperLogLog) implemented in Go
初中级Android开发社招面试之Bitmap.pdf后续还有一系列资料,欢迎大家下载
this program is for drawing dialog background using transparent bitmap.
Algorithm-bitmap.zip,C 位图库,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。
//长和宽放大缩小的比例 Bitmap resizeBmp = Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true); return resizeBmp; } /**Bitmap缩小的方法*/ private static Bitmap sm
script src = "lib/Bitmap.js" > < / script > < script > var canvas = document . createElement ( "canvas" ) ; var ctx = canvas . getContext ( "2d" ) ; var imageData = ctx . getImageData ( 0...
赠送jar包:RoaringBitmap-0.7.45.jar; 赠送原API文档:RoaringBitmap-0.7.45-javadoc.jar; 赠送源代码:RoaringBitmap-0.7.45-sources.jar; 赠送Maven依赖信息文件:RoaringBitmap-0.7.45.pom; 包含翻译后的API...
Android开发者学习笔记-View、Canvas、bitmap.pdf
Android开发者学习笔记——View、Canvas、bitmap.doc
图像动画bitmap,这是一个图像动画的例子,可以看一下,一定要耐心了