<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Calvin's Tech Space

    成于堅(jiān)忍,毀于浮躁

       :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理

     

    /**
      * This code is courtesy of Neil Davies at http://www.inter-fuser.com
      * @param context the current context
      * @param originalImage The original Bitmap image used to create the reflection
      * @return the bitmap with a reflection
      */
     public static Bitmap createReflectedImage(Context context, Bitmap originalImage) {
              //The gap we want between the reflection and the original image
              final int reflectionGap = 4;
             
                int width = originalImage.getWidth();
                int height = originalImage.getHeight();
                
          
                //This will not scale but will flip on the Y axis
                Matrix matrix = new Matrix();
                matrix.preScale(1, -1);
                
                //Create a Bitmap with the flip matrix applied to it.
                //We only want the bottom half of the image
                Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height/2, width, height/2, matrix, false);
                
                    
                //Create a new bitmap with same width but taller to fit reflection
                Bitmap bitmapWithReflection = Bitmap.createBitmap(width
                  , (height + height/2), Config.ARGB_8888);
              
               //Create a new Canvas with the bitmap that's big enough for
               //the image plus gap plus reflection
               Canvas canvas = new Canvas(bitmapWithReflection);
               //Draw in the original image
               canvas.drawBitmap(originalImage, 0, 0, null);
               //Draw in the gap
               Paint defaultPaint = new Paint();
               canvas.drawRect(0, height, width, height + reflectionGap, defaultPaint);
               //Draw in the reflection
               canvas.drawBitmap(reflectionImage,0, height + reflectionGap, null);
               
               //Create a shader that is a linear gradient that covers the reflection
               Paint paint = new Paint();
               LinearGradient shader = new LinearGradient(0, originalImage.getHeight(), 0,
                 bitmapWithReflection.getHeight() + reflectionGap, 0x70ffffff, 0x00ffffff,
                 TileMode.CLAMP);
              //Set the paint to use this shader (linear gradient)
               paint.setShader(shader);
               //Set the Transfer mode to be porter duff and destination in
               paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
               //Draw a rectangle using the paint with our linear gradient
               canvas.drawRect(0, height, width,
                 bitmapWithReflection.getHeight() + reflectionGap, paint);
              
              return bitmapWithReflection;
      }
    posted on 2010-05-07 18:52 calvin 閱讀(194) 評(píng)論(0)  編輯  收藏 所屬分類: Android
    主站蜘蛛池模板: 伊人久久大香线蕉亚洲| 国产麻豆免费观看91| 国产精品亚洲A∨天堂不卡| 国产精品亚洲五月天高清| 嫩草视频在线免费观看| 亚洲精品一卡2卡3卡四卡乱码| 性做久久久久久免费观看| 亚洲国产成人资源在线软件 | 亚洲综合色丁香麻豆| 97av免费视频| 亚洲国产成人资源在线软件| 特级做A爰片毛片免费69| 亚洲国产精品一区二区三区在线观看| 插B内射18免费视频| 久久精品国产亚洲AV| 亚洲婷婷国产精品电影人久久| 亚洲国产免费综合| 亚洲AV永久无码精品水牛影视| 99久久人妻精品免费二区| 91午夜精品亚洲一区二区三区| 国产一精品一av一免费爽爽 | 亚洲AV午夜成人影院老师机影院| 四虎影视无码永久免费| 91精品国产亚洲爽啪在线观看| 台湾一级毛片永久免费 | 一级毛片免费播放男男| 亚洲一区二区三区偷拍女厕| 国产精品视频白浆免费视频| 亚洲国产视频网站| 国产精品成人无码免费| 99久久免费国产精精品| 亚洲欧洲精品在线| 男人的天堂亚洲一区二区三区| 牛牛在线精品免费视频观看| 亚洲国产精品va在线播放| 1000部拍拍拍18免费网站| 精品久久久久亚洲| 亚洲av无码成人黄网站在线观看| 日本妇人成熟免费中文字幕| 特级毛片aaaa免费观看| 亚洲黄色在线观看网站|