<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
    主站蜘蛛池模板: 亚洲国产成人一区二区三区| 成人精品一区二区三区不卡免费看| 2021在线永久免费视频| 亚洲国产精品无码中文字| 久久国产免费观看精品| 久久亚洲国产视频| 久久99精品国产免费观看| 精品亚洲aⅴ在线观看| 亚洲综合免费视频| 亚洲三级视频在线| 在线免费观看视频你懂的| 国产亚洲精aa在线看| 18禁成年无码免费网站无遮挡| 亚洲精品国产日韩| 国产gav成人免费播放视频| 色费女人18女人毛片免费视频| 又粗又大又长又爽免费视频| 免费看一级高潮毛片| 亚洲五月综合缴情在线观看| 久久成人a毛片免费观看网站| 亚洲日产2021三区在线| 午夜影视在线免费观看| 一级做a爰全过程免费视频毛片| 亚洲国产精品综合久久网络| 香蕉视频在线免费看| 内射少妇36P亚洲区| 成人最新午夜免费视频| 日本高清不卡中文字幕免费| 久久精品国产亚洲综合色| 91大神在线免费观看| 精品国产成人亚洲午夜福利| 亚洲一级特黄大片无码毛片| 久久国产精品萌白酱免费| 亚洲一本到无码av中文字幕| 亚洲精品视频久久久| 4虎1515hh永久免费| 国产精品日本亚洲777| 亚洲成AV人片一区二区| 青青久在线视频免费观看| 乱淫片免费影院观看| 亚洲国产高清美女在线观看|