资源简介
找不到好的拼接demo,自己写的一个图片拼接工具类,4种拼接方式样式,更多样式,自己看了我的代码就可以自己扩展了。
代码片段和文件信息
package com.chushang;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import java.util.List;
/**
* Created by Administrator on 2015/2/27.
*/
public class ImageUtil {
public Bitmap MosaicBitmap(List bitmaps) {
Bitmap result = Bitmap.createBitmap(480 720 Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
if (bitmaps.size() == 4) {
numder4(canvas bitmaps);
} else if (bitmaps.size() == 3) {
numder3(canvas bitmaps);
} else if (bitmaps.size() == 2) {
numder2(canvas bitmaps);
} else {
return Fixed(bitmaps.get(0) 480 720);
}
return result;
}
public void numder2(Canvas canvas List bitmaps) {
canvas.drawBitmap(Fixed(bitmaps.get(0) 480 360) 0 0 null);
canvas.drawBitmap(Fixed(bitmaps.get(1) 480 360) 0 360 null);
}
public void numder3(Canvas canvas List bitmaps) {
canvas.drawBitmap(Fixed(bitmaps.get(0) 48
评论
共有 条评论