摘要: // 获得带倒影的图片方法 public static Bitmap createReflectionImageWithOrigin(Bitmap bitmap) { final int reflectionGap = 4; int width = bitmap.getWidth(); int height = bitmap.getHeight(); Matrix matrix = new Matrix(); matrix.preScale(1, -1); Bitmap reflectionImage =... 阅读全文
posted @ 2012-08-08 15:05 语带悠伤 阅读(335) 评论(0) 推荐(0) 编辑
摘要: // 将Drawable转化为Bitmap public static Bitmap drawableToBitmap(Drawable drawable) { int width = drawable.getIntrinsicWidth(); int height = drawable.getIntrinsicHeight(); Bitmap bitmap = Bitmap.createBitmap(width, height, drawable .getOpacity() != PixelFormat.OPAQU... 阅读全文
posted @ 2012-08-08 15:04 语带悠伤 阅读(509) 评论(0) 推荐(0) 编辑
摘要: // 获得圆角图片的方法 public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, float roundPx) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff424242; final... 阅读全文
posted @ 2012-08-08 15:04 语带悠伤 阅读(366) 评论(0) 推荐(0) 编辑
摘要: // 放大缩小图片 public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); Matrix matrix = new Matrix(); float scaleWidht = ((float) w / width); float scaleHeight = ((float) h / height); matrix... 阅读全文
posted @ 2012-08-08 15:03 语带悠伤 阅读(1359) 评论(0) 推荐(0) 编辑
摘要: /** * Save Bitmap to a file.保存图片到SD卡。 * * @param bitmap * @param file * @return error message if the saving is failed. null if the saving is * successful. * @throws IOException */ public static void saveBitmapToFile(Bitmap bitmap, String _file) ... 阅读全文
posted @ 2012-08-08 15:02 语带悠伤 阅读(13847) 评论(0) 推荐(0) 编辑
摘要: // 图片剪切 public static Bitmap cutBitmap(Bitmap mBitmap, Rect r, Bitmap.Config config) { int width = r.width(); int height = r.height(); Bitmap croppedImage = Bitmap.createBitmap(width, height, config); Canvas cvs = new Canvas(croppedImage); Rect dr = new Rect(0, ... 阅读全文
posted @ 2012-08-08 15:02 语带悠伤 阅读(1749) 评论(0) 推荐(0) 编辑
摘要: // 可用于生成缩略图。 /** * Creates a centered bitmap of the desired size. Recycles the input. * * @param source */ public static Bitmap extractMiniThumb(Bitmap source, int width, int height) { return extractMiniThumb(source, width, height, true); } public static Bitmap ex... 阅读全文
posted @ 2012-08-08 15:01 语带悠伤 阅读(5271) 评论(0) 推荐(0) 编辑
摘要: /** * 将多个Bitmap合并成一个图片。 * @param columns 将多个图合成多少列 * @param bitmaps 要合成的图片 * @return */ public static Bitmap combineBitmaps(int columns, Bitmap... bitmaps) { if (columns <= 0 || bitmaps == null || bitmaps.length == 0) { throw new IllegalArgumentException( ... 阅读全文
posted @ 2012-08-08 14:59 语带悠伤 阅读(2604) 评论(0) 推荐(0) 编辑
摘要: // 截屏 public static Bitmap getScreenshotsForCurrentWindow(Activity activity) { View cv = activity.getWindow().getDecorView(); Bitmap bmp = Bitmap.createBitmap(cv.getWidth(), cv.getHeight(), Bitmap.Config.ARGB_4444); cv.draw(new Canvas(bmp)); return bmp; ... 阅读全文
posted @ 2012-08-08 14:59 语带悠伤 阅读(176) 评论(0) 推荐(0) 编辑
摘要: /** * 图片切割方法 * @param bitmap 图片 * @param xPiece 行 * @param yPiece 列 * @return */ public static List<ImagePiece> split(Bitmap bitmap, int xPiece, int yPiece) { List<ImagePiece> pieces = new ArrayList<ImagePiece>(xPiece * yPiece); int width = bitmap.getWidth();... 阅读全文
posted @ 2012-08-08 14:57 语带悠伤 阅读(3582) 评论(0) 推荐(0) 编辑