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

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

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

    Calvin's Tech Space

    成于堅忍,毀于浮躁

       :: 首頁 :: 聯系 :: 聚合  :: 管理

     

    /**
      * 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 閱讀(191) 評論(0)  編輯  收藏 所屬分類: Android
    主站蜘蛛池模板: 日本高清不卡中文字幕免费| 亚洲AV无码一区二区三区人| 日韩精品视频在线观看免费| 日本无吗免费一二区| 亚洲中文无码永久免费| 两个人的视频高清在线观看免费| 亚洲短视频在线观看| 日本免费大黄在线观看| 亚洲性色高清完整版在线观看| 精品香蕉在线观看免费| 亚洲精品人成电影网| 在线天堂免费观看.WWW| 亚洲中文字幕久久精品蜜桃| 国产成人免费片在线观看| 亚洲AV无码男人的天堂| 亚洲?V乱码久久精品蜜桃 | 日韩免费在线视频| 自怕偷自怕亚洲精品| 91福利免费体验区观看区| 亚洲人成电影青青在线播放| 日韩免费a级在线观看| 美女无遮挡免费视频网站| 国产亚洲精品久久久久秋霞| 国产好大好硬好爽免费不卡| 亚洲一区二区三区精品视频| 日本xxwwxxww在线视频免费| 黄色视频在线免费观看| 国精无码欧精品亚洲一区| 最新黄色免费网站| 亚洲AV永久无码精品网站在线观看| 日本中文一区二区三区亚洲| 嫩草在线视频www免费看| 亚洲六月丁香六月婷婷蜜芽| 一级毛片免费一级直接观看| 亚洲日韩在线观看免费视频| 99视频免费观看| 国产精品亚洲а∨无码播放麻豆| 亚洲综合AV在线在线播放| 午夜免费福利片观看| 亚洲欧洲精品成人久久曰| 在线精品亚洲一区二区小说|