Andorid Bitmap 重采样

OPEN编辑的头像 OPEN编辑 1 2016-05-05 18:13 2

 基本信息

× 1    × 1   

浏览数: 31777

分享时间: 2 年 前

4
    public Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) {
        int width = bm.getWidth();
        int height = bm.getHeight();
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        // CREATE A MATRIX FOR THE MANIPULATION
        Matrix matrix = new Matrix();
        // RESIZE THE BIT MAP
        matrix.postScale(scaleWidth, scaleHeight);

        // "RECREATE" THE NEW BITMAP
        Bitmap resizedBitmap = Bitmap.createBitmap(
                bm, 0, 0, width, height, matrix, false);
        bm.recycle();
        return resizedBitmap;
    }

 

不错不错
1 年 前 20151313

12 3 [下一页]

  • williams26的头像 williams26 2016-12-23 16:22 代码数:0

    好的。谢谢

  • 2689548458的头像 2689548458 2017-11-20 21:30 代码数:0

    赞一个

  • 威兹曼的头像 威兹曼 2016-05-25 12:32 代码数:0

  • annashetty的头像 annashetty 2018-01-22 11:55 代码数:0

    不错不错 play cool math games

  • aq2130062的头像 aq2130062 2018-02-05 18:21 代码数:0

    好好的讲解阿!

  • AsharSeo的头像 AsharSeo 2018-09-18 01:28 代码数:0

    Aw, i thought this was quite a nice post. In concept I must set up writing like this additionally – spending time and actual effort to make a great article… but exactly what do I say… I procrastinate alot through no means appear to go carried out.

    Amos

  • psncore的头像 psncore 2018-07-15 03:42 代码数:0

    `vey nice too see this i love it better is not possible even now i need to translate everything psn code generator

  • banjue的头像 banjue 2017-04-28 16:46 代码数:0

    学到了

  • Nissan的头像 Nissan 2018-10-01 16:46 代码数:0

     

     Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place.  Honda Odyssey colors

  • trangctp的头像 trangctp 2018-08-16 09:55 代码数:0

    I like to get up early to go out and breathe fresh air. I feel that it is good for health and a good habit 

    Return Man 3

您的评论: