編輯:關於Android編程
Bitmap bit=Reflect3DImage.skewImage(bit, 50);
package com.maxway.util; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Camera; import android.graphics.Canvas; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Shader; import android.graphics.Shader.TileMode; public class Reflect3DImage { public static Bitmap createReflectedImage(Bitmap paramBitmap, int paramInt) { int i = paramBitmap.getWidth(); int j = paramBitmap.getHeight(); Matrix localMatrix = new Matrix(); localMatrix.preScale(1.0F, -1.0F); Bitmap localBitmap1 = Bitmap.createBitmap(paramBitmap, 0, j - paramInt, i, paramInt, localMatrix, false); Bitmap localBitmap2 = Bitmap.createBitmap(i, j + paramInt, Bitmap.Config.ARGB_8888); Canvas localCanvas = new Canvas(localBitmap2); Paint localPaint1 = new Paint(); localCanvas.drawBitmap(paramBitmap, 0.0F, 0.0F, localPaint1); localCanvas.drawBitmap(localBitmap1, 0.0F, j, localPaint1); Paint localPaint2 = new Paint(); localPaint2.setShader(new LinearGradient(0.0F, paramBitmap.getHeight(), 0.0F, localBitmap2.getHeight(), 1895825407, 16777215, Shader.TileMode.MIRROR)); localPaint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); localCanvas.drawRect(0.0F, j, i, localBitmap2.getHeight(), localPaint2); localBitmap1.recycle(); return localBitmap2; } public static Bitmap skewImage(Bitmap paramBitmap, int paramInt) { Bitmap localBitmap1 = createReflectedImage(paramBitmap, paramInt); Camera localCamera = new Camera(); localCamera.save(); Matrix localMatrix = new Matrix(); localCamera.rotateY(15.0F); localCamera.getMatrix(localMatrix); localCamera.restore(); localMatrix.preTranslate(-localBitmap1.getWidth() >> 1, -localBitmap1.getHeight() >> 1); Bitmap localBitmap2 = Bitmap.createBitmap(localBitmap1, 0, 0, localBitmap1.getWidth(), localBitmap1.getHeight(), localMatrix, true); Bitmap localBitmap3 = Bitmap.createBitmap(localBitmap2.getWidth(), localBitmap2.getHeight(), Bitmap.Config.ARGB_8888); Canvas localCanvas = new Canvas(localBitmap3); Paint localPaint = new Paint(); localPaint.setAntiAlias(true); localPaint.setFilterBitmap(true); localCanvas.drawBitmap(localBitmap2, 0.0F, 0.0F, localPaint); localBitmap2.recycle(); return localBitmap3; } }
1.前言擁抱開源,熱愛開源,將我們認為不錯的代碼開源到gihtub,將我們的庫發布到jcenter\mevan等。2.准備工作2.1 准備申請倉庫賬號 注意model為a
ContactPicker(選擇聯系人) 詳解 ContactPicker:用戶可以選擇一個聯系人. 1. 創建ContactP
Activity是Android四大組件中最基礎也是最常用的組件之一。Activity作為一個應用程序組件,提供了一個與用戶交互的界面。可以這麼說Activity是和用戶
本文實例為大家分享了android讀取assets中Excel的具體代碼,供大家參考,具體內容如下1.在assets下放的excel表格,命名為excel.xls 2.添