<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
    主站蜘蛛池模板: 亚洲精品蜜夜内射| 在线观看特色大片免费网站| 亚洲6080yy久久无码产自国产| 一级毛片正片免费视频手机看| 一个人免费视频在线观看www | 精品免费国产一区二区| 久久精品国产亚洲精品| 亚洲一区二区三区四区视频| 九九全国免费视频| 免费看污成人午夜网站| 亚洲线精品一区二区三区 | 免费视频成人手机在线观看网址| 亚洲综合AV在线在线播放| 亚洲人成色在线观看| 色欲色香天天天综合网站免费| 亚洲国产成人久久一区WWW| 亚洲国产理论片在线播放| a毛片免费播放全部完整| 免费日韩在线视频| 亚洲AV成人一区二区三区在线看| 无码国产精品一区二区免费3p | 亚洲大片免费观看| 免费精品99久久国产综合精品| 亚洲成a人片77777kkkk| 春意影院午夜爽爽爽免费| 国产综合亚洲专区在线| 日本不卡免费新一区二区三区| 亚洲国产综合久久天堂| 国产精品久久久久久亚洲影视| 一个人在线观看视频免费| 亚洲成人福利在线| 美女被免费视频网站a国产| sss日本免费完整版在线观看| 免费看国产一级片| 少妇性饥渴无码A区免费 | 青青草免费在线视频| 91久久亚洲国产成人精品性色| 免费无码作爱视频| 国产成人精品日本亚洲网址| 国产妇乱子伦视频免费| 亚洲国产精品综合久久网各|