Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在位图android上添加水效果_Android_Image Processing_Bitmap_Effect - Fatal编程技术网

在位图android上添加水效果

在位图android上添加水效果,android,image-processing,bitmap,effect,Android,Image Processing,Bitmap,Effect,如何在位图图像中添加水波? 我在这里发现了触摸事件的水涟漪效应:但无法在我的单个位图上实现。 有人能帮我在我的位图上制作水波效果吗? 还是我应该去做图像处理? 先谢谢你。 以下是我的示例代码,我必须在其中创建水反射效果: public static Bitmap reflection(Bitmap mainImage) { int width = mainImage.getWidth(); int height = mainImage.getHeight();

如何在位图图像中添加水波? 我在这里发现了触摸事件的水涟漪效应:但无法在我的单个位图上实现。 有人能帮我在我的位图上制作水波效果吗? 还是我应该去做图像处理? 先谢谢你。 以下是我的示例代码,我必须在其中创建水反射效果:

public static Bitmap reflection(Bitmap mainImage) {
       int width = mainImage.getWidth();
       int height = mainImage.getHeight();

       Matrix matrix = new Matrix();
       matrix.preScale(1, -1);

       reflectionImage = Bitmap.createBitmap(mainImage, 0,
               0, width, height , matrix, false);

        reflectedBitmap = Bitmap.createBitmap(width,
               (height + height), Config.ARGB_8888);

       Canvas canvas = new Canvas(reflectedBitmap);
       canvas.drawBitmap(mainImage, 0, 0, null);
       Paint defaultPaint = new Paint();
       canvas.drawRect(0, height, width, height, defaultPaint);

       canvas.drawBitmap(reflectionImage, 0, height-6 , null);
       Paint paint = new Paint();
       LinearGradient shader = new LinearGradient(0,
               mainImage.getHeight(), 0, reflectedBitmap.getHeight()
                       , 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
       paint.setShader(shader);
       paint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
       canvas.drawRect(0, height, width, reflectedBitmap.getHeight()
                , paint);
           return reflectedBitmap;
}