編輯:高級開發
public static Bitmap createReflectionImageWithOrigin(Bitmap bitmap){
final int reflectionGap = 4;
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.preScale(1, -1);
Bitmap reflectionImage = Bitmap.createBitmap(bitmap,
0, height/2, width, height/2, matrix, false);
Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height/2), Config.ARGB_8888);
Canvas canvas = new Canvas(bitmapWithReflection);
canvas.drawBitmap(bitmap, 0, 0, null);
Paint deafalutPaint = new Paint();
canvas.drawRect(0, height,width,height + reflectionGap,
deafalutPaint);
canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
Paint paint = new Paint();
LinearGradient shader = new LinearGradIEnt(0,
bitmap.getHeight(), 0, bitmapWithReflection.getHeight()
+ reflectionGap, 0x70ffffff, 0x00ffffff, TileMode.CLAMP);
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;
}
android手機作為谷歌企業戰略的重要組成部分,將進一步推進“隨時隨地為每個人提供信息”這一企業目標的實現。我們發現,全球為數眾多的移動電話用戶從未使用過任何基於 a
前幾天,51CTO為大家帶來了《在Ubuntu下建立Eclipse的android開發環境》教程,這次為大家帶來的是《在MyEclipse 8.6上搭建android開
在實現了android系統平台的強大性,現就將引擎的前兩個元素即攝像頭與指南針之後,下一步要做的就是確定位置,要想更好的完成這一項目,我們主要用到android的Loc
Widget是android1.5版所引進的特性之一.Widget,可讓用戶在主屏幕界面及時了解程序顯示的重要信息.標准的android系統已包含幾個Widget的示例