创建bitmap另一种方式
2013-05-15 14:10
239 查看
Bitmap target = Bitmap.createBitmap(size, size, getConfig(bitmap));
int width = Math.round(scale * bitmap.getWidth());
int height = Math.round(scale * bitmap.getHeight());
Canvas canvas = new Canvas(target);
canvas.translate((size - width) / 2f, (size - height) / 2f);//偏移,也可以旋转之类操作
canvas.scale(scale, scale);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG);
canvas.drawBitmap(bitmap, 0, 0, paint);
int width = Math.round(scale * bitmap.getWidth());
int height = Math.round(scale * bitmap.getHeight());
Canvas canvas = new Canvas(target);
canvas.translate((size - width) / 2f, (size - height) / 2f);//偏移,也可以旋转之类操作
canvas.scale(scale, scale);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG);
canvas.drawBitmap(bitmap, 0, 0, paint);
相关文章推荐
- spark的streamingcontext的另一种创建方式
- 创建bitmap index 时对表的加锁方式
- 创建maven项目的另一种方式
- java另一种创建多线程的方式
- 创建索引的另一种方式(index)
- 另一种创建线程的方式
- 另一种方式解决myeclipse10创建activiti diagram文件报错
- Struts1学习笔记(3)-----用另一种方式创建HelloWorld
- 单链表的创建、插入、删除;创建采用两种不同的方式:一种是从表头到表尾,另一种是从表尾到表头!
- Bitmap二次采样以及压缩另一种方式
- 第八十三课、另一种创建线程的方式------------------狄泰软件学院
- android 创建bitmap的多种方式
- Delegate的另一种创建方式
- 创建bitmap index 时对表的加锁方式
- 线程死锁现象和synchronized 用作关键字和线程另一种创建方式
- 线程:创建线程有两种方式,一种是继承Thread类,另一种是实现Runnable接口。代码如下:
- delphi 创建快捷方式
- Android应用添加(创建)和删除及判断是否存在桌面快捷方式
- powershell 将文本转换成表格的另一种方式
- Windows Server 2008 R2组策略创建用户桌面快捷方式