zoukankan      html  css  js  c++  java
  • 拼图效果

    public static Bitmap getComponseBitmap(Bitmap src, Bitmap src2){
    if(src == null || src2 == null)
    return null;

    int width = src.getWidth();
    int height = src.getHeight();
    Bitmap newBitmap = Bitmap.createBitmap(width, height, Config.RGB_565);
    Canvas canvas = new Canvas(newBitmap);
    canvas.drawBitmap(src, 0, 0, null);

    Bitmap zoomBitmap = zoomImage(src2, 640, 360);
    canvas.drawBitmap(zoomBitmap, 200, 200, null);
    canvas.save(Canvas.ALL_SAVE_FLAG );
    canvas.restore();

    return newBitmap;
    }

    //等比缩放图片
    public static Bitmap zoomImage(Bitmap bitmap, int newWidth, int newHeight){
    int width = bitmap.getWidth();
    int height = bitmap.getHeight();
    //计算缩放比例
    float scaleW = (float)newWidth/width;
    float sacleH = (float)newHeight/height;
    //取得缩放Matrix参数
    Matrix matrix = new Matrix();
    matrix.postScale(scaleW, sacleH);
    matrix.postRotate(30);
    //得到新图片
    Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
    return newBitmap;
    }

  • 相关阅读:
    socket通信简介
    存储过程多次遍历
    js动态表格笔记
    Java excel导出笔记
    Eclipse快捷键
    oracle表,视图,存储过程,函数,序列.....查询
    Java基础笔记
    Active MQ学习笔记
    linux svn
    html中submit和button的区别
  • 原文地址:https://www.cnblogs.com/clarence/p/3837417.html
Copyright © 2011-2022 走看看