• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            life02

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              197 隨筆 :: 3 文章 :: 37 評論 :: 0 Trackbacks
             1             BitmapDrawable icon= oldIcon; 
             2             final Bitmap.Config c = icon.getOpacity() != PixelFormat.OPAQUE ?
             3             Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
             4             int sIconWidth,sIconHeight ;
             5             sIconWidth = sIconHeight = (int) context.getResources().getDimension(R.dimen.img_width);
             6             
             7             int width = sIconWidth;
             8             int height = sIconHeight;
             9 
            10             Bitmap bmp=BitmapFactory.decodeResource(context.getResources(), R.drawable.tb_25);  
            11             float scale = 1.0f;
            12             int iconWidth = icon.getIntrinsicWidth();
            13             int iconHeight = icon.getIntrinsicHeight();
            14             
            15 //            Log.e("12", "BitmapDrawable:iconwidth"+iconWidth);
            16 //            Log.e("12", "BitmapDrawable:iconHeight"+iconHeight);
            17 //            Log.e("12", "BitmapDrawable:width"+width);
            18 //            Log.e("12", "BitmapDrawable:height"+height);
            19             final Canvas canvas = new Canvas();
            20             Rect sOldBounds = new Rect();
            21             if (width > 0 && height > 0) {
            22 //                if (width < iconWidth || height < iconHeight || scale != 1.0f) {
            23 
            24                     final float ratio = (float) iconWidth / iconHeight;
            25 
            26                     if (iconWidth > iconHeight) {
            27                         height = (int) (width / ratio);
            28                     } else if (iconHeight > iconWidth) {
            29                         width = (int) (height * ratio);
            30                     }
            31 
            32                     final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c);
            33                     canvas.setBitmap(thumb);
            34                     sOldBounds.set(icon.getBounds());
            35                     final int x = (sIconWidth - width) / 2;
            36                     final int y = (sIconHeight - height) / 2;
            37                     icon.setBounds(x, y, x + width, y + height);
            38                     
            39                     canvas.drawBitmap(bmp, new Matrix(), null);
            40                     icon.draw(canvas);
            41                     icon.setBounds(sOldBounds);
            42                     icon = new BitmapDrawable(context.getResources(), thumb);
            43 
            44 //                } else if (iconWidth < width && iconHeight < height) {
            45 //
            46 //                    final Bitmap.Config c1 = Bitmap.Config.ARGB_8888;
            47 //                    final Bitmap thumb = Bitmap.createBitmap(sIconWidth, sIconHeight, c1);
            48 //                    canvas.setBitmap(thumb);
            49 //                    sOldBounds.set(icon.getBounds());
            50 //                    final int x = (width - iconWidth) / 2;
            51 //                    final int y = (height - iconHeight) / 2;
            52 //                    icon.setBounds(x, y, x + iconWidth, y + iconHeight);
            53 //                    canvas.drawBitmap(bmp, new Matrix(), null);
            54 //                    icon.draw(canvas);
            55 //                    icon.setBounds(sOldBounds);
            56 //                    icon = new BitmapDrawable(context.getResources(), thumb);
            57 //                    Log.e("12", "iconWidth < widthBitmapDrawable:iconwidth"+iconWidth);
            58 //                    Log.e("12", "BitmapDrawable:iconHeight"+iconHeight);
            59 //                    Log.e("12", "BitmapDrawable:width"+width);
            60 //                    Log.e("12", "BitmapDrawable:height"+height);
            61 //                }
            62             }
            63             return icon;
            64         }
            posted on 2012-03-14 19:43 life02 閱讀(185) 評論(0)  編輯 收藏 引用 所屬分類: Android開發
            狠狠色丁香婷婷久久综合五月 | 久久66热人妻偷产精品9| 久久久久人妻一区二区三区vr| 亚洲va久久久噜噜噜久久天堂| 91精品国产色综合久久| 中文字幕亚洲综合久久2| 久久天天躁狠狠躁夜夜躁2014| 久久天天躁狠狠躁夜夜96流白浆| 久久久青草久久久青草| 无码任你躁久久久久久老妇| 精品久久久久久亚洲精品| 婷婷久久综合九色综合九七| 国产精品久久久久影院色| 大香伊人久久精品一区二区| 国产巨作麻豆欧美亚洲综合久久 | 久久久久久国产精品免费无码 | 久久福利青草精品资源站免费| 久久精品国产99久久香蕉| 国产美女久久精品香蕉69| 久久久久国色AV免费观看| 国产成年无码久久久久毛片| 一本色道久久88—综合亚洲精品| 久久精品成人免费观看97| 一级做a爰片久久毛片人呢| 国内精品久久久久影院优| 亚洲精品国精品久久99热一| 性做久久久久久久久| 人妻丰满?V无码久久不卡| 国产精品欧美亚洲韩国日本久久| 久久这里只精品国产99热| avtt天堂网久久精品| 精品久久久无码人妻中文字幕豆芽 | 久久精品国产色蜜蜜麻豆| 日韩电影久久久被窝网| 狠狠色综合网站久久久久久久| 久久九九全国免费| 91超碰碰碰碰久久久久久综合| 久久99国产精品二区不卡| 欧美亚洲另类久久综合| 日本免费一区二区久久人人澡| 99久久99久久精品国产片|