• <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++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              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 閱讀(189) 評論(0)  編輯 收藏 引用 所屬分類: Android開發(fā)
            午夜视频久久久久一区 | 亚洲成色WWW久久网站| 久久人人青草97香蕉| 亚洲狠狠婷婷综合久久蜜芽| 人人狠狠综合久久亚洲88| 亚洲精品成人网久久久久久| 九九久久自然熟的香蕉图片| 日韩一区二区三区视频久久| 久久精品亚洲中文字幕无码麻豆| 日本久久久久亚洲中字幕| 久久国产精品成人影院| 久久AAAA片一区二区| 久久人人爽人人爽人人片av高请| 久久久久免费视频| 高清免费久久午夜精品| 久久久久波多野结衣高潮| 国产成人精品综合久久久| 久久久噜噜噜久久熟女AA片 | 999久久久国产精品| 99久久精品免费看国产一区二区三区 | 久久伊人中文无码| 97久久国产亚洲精品超碰热| 国内精品伊人久久久久妇| 国产毛片久久久久久国产毛片| 久久久久无码精品国产| 久久大香萑太香蕉av| 亚洲精品国产综合久久一线| Xx性欧美肥妇精品久久久久久 | 久久久精品波多野结衣| 亚洲国产精品一区二区久久| 久久久一本精品99久久精品88| 伊人久久一区二区三区无码| 久久精品国产国产精品四凭| 国产成人精品久久亚洲| 久久综合综合久久97色| 国产精品99久久久久久人| 国产成人久久AV免费| 91精品国产乱码久久久久久| 91精品国产高清91久久久久久| 99久久无色码中文字幕| 久久久久中文字幕|