<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 閱讀(192) 評論(0)  編輯  收藏 所屬分類: Android
    主站蜘蛛池模板: 中文字幕日韩亚洲| 又粗又硬又黄又爽的免费视频| 国产亚洲?V无码?V男人的天堂 | 中文字幕手机在线免费看电影| 免费一级毛片在线播放不收费| 美女被艹免费视频| 国产成人免费网站在线观看| 亚洲精品动漫免费二区| 日韩精品免费电影| 精品特级一级毛片免费观看| 亚洲国产精品毛片av不卡在线 | 亚洲综合亚洲国产尤物| 69xx免费观看视频| 亚洲熟女综合色一区二区三区| 欧美日韩国产免费一区二区三区| 亚洲免费综合色在线视频| 国产一级淫片免费播放电影| 岛国岛国免费V片在线观看 | 国产午夜亚洲精品不卡免下载| 亚洲精品97久久中文字幕无码| 中文在线免费观看| 亚洲成人免费网站| 国产免费观看视频| 中文字幕无码一区二区免费| 亚洲精品第一国产综合精品| 免费观看的毛片手机视频| 久久WWW免费人成—看片| 97se亚洲综合在线| 国产黄色片在线免费观看| 国产免费内射又粗又爽密桃视频| 午夜影视日本亚洲欧洲精品一区| 永久免费AV无码国产网站| 成年大片免费视频播放一级| 久久亚洲中文字幕精品有坂深雪| 卡一卡二卡三在线入口免费| 羞羞视频免费网站在线看| 亚洲人成在线免费观看| 亚洲第一福利网站在线观看| 先锋影音资源片午夜在线观看视频免费播放 | 亚洲色成人网站WWW永久四虎| 亚洲国产a级视频|