BITMap 倒影
来源:互联网 发布:单片机红外发射电路图 编辑:程序博客网 时间:2024/04/29 22:50
public static Bitmap createReflectedImage(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; }
- BITMap 倒影
- Android Bitmap 倒影
- 得到一个bitmap的倒影
- Android给bitmap图加上倒影效果
- 倒影效果的图片Bitmap的函数
- Android Bitmap图片压缩,图片倒影
- Android Bitmap镜子效果、倒影效果
- 倒影
- 倒影
- Android ,Bitmap ,Drawable,图像缩放,圆角处理,倒影
- Bitmap、Drawable互转、缩放、圆角、倒影图像制作
- [Android] bitmap/drawable/byte的转换和获取圆角/倒影图片
- [Android] bitmap/drawable/byte的转换和获取圆角/倒影图片
- [Android] bitmap/drawable/byte的转换和获取圆角/倒影图片
- [Android] bitmap/drawable/byte的转换和获取圆角/倒影图片
- Bitmap和Drawable的相互转换,图片缩放,倒圆角,倒影等的实现
- Android中常用的位图操作(View与Bitmap转化、圆角、灰化、提取Alpha、旋转、倒影、剪切……)
- Android中常用的位图操作(View与Bitmap转化、圆角、灰化、提取Alpha、旋转、倒影、剪切……)
- 23种设计模式(5):原型模式
- IMSI前5位对应移动运营商名称的列表
- 使用svn在服务器上创建项目
- RMAN catalog 的创建和使用
- __declspec关键字详细用法
- BITMap 倒影
- g729分析笔记
- [C++学习] C++ primer 习题 3.17
- InstallShield2009创建安装程序简易教程六部操作(.net framework,sql2005静默安装)
- Android请求web的方式
- Android中帐户服务部+位置服务
- SNS网站的用户流失率怎么会高得如此惊人?
- ios事件分发
- C++打印“*”图案例子