<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 閱讀(194) 評論(0)  編輯  收藏 所屬分類: Android
    主站蜘蛛池模板: aa级一级天堂片免费观看| 亚洲精品国产精品乱码在线观看| 色妞WWW精品免费视频| 亚洲偷自拍拍综合网| 亚洲国产精品免费在线观看| 日韩久久无码免费毛片软件| 8x8×在线永久免费视频| 免费女人18毛片a级毛片视频| 亚洲美女在线观看播放| 一个人看的www免费在线视频| 无码人妻久久一区二区三区免费丨| 亚洲精品日韩专区silk| 亚洲精品视频免费观看| 四虎成人精品一区二区免费网站| 亚洲精品人成在线观看| 一本到卡二卡三卡免费高| 亚洲自偷自偷图片| 偷自拍亚洲视频在线观看99| 国拍在线精品视频免费观看| 亚洲AV无码专区国产乱码4SE| 一级毛片a免费播放王色电影| 女人18毛片特级一级免费视频 | 我们的2018在线观看免费高清| 亚洲精品视频在线观看免费 | 日本免费一区尤物| 亚洲乱人伦精品图片| 久久这里只精品99re免费| 久久久久久久亚洲精品| 美女裸免费观看网站| 国产成人精品123区免费视频| 67194在线午夜亚洲| 在线人成精品免费视频| 2020久久精品亚洲热综合一本| 国产精品高清全国免费观看| 中文日本免费高清| 亚洲精品老司机在线观看| 久久亚洲AV成人无码国产电影| 卡1卡2卡3卡4卡5免费视频| 一区二区免费在线观看| 亚洲色图国产精品| 免费h成人黄漫画嘿咻破解版|