Image Effects
Image Effects:android 允許在圖片上做效果。例如:亮度、暗度、灰階…等。
android 提供Bitmap類別處理圖片。可以在android.graphics.bitmap.找到。要建立一個點陣圖在imageView裡。
private Bitmap bmp;
private ImageView img;
img = (ImageView)findViewById(R.id.imageView1);
BitmapDrawableabmp=(BitmapDrawable)img.getDrawable();
getDrawable:取得圖片。
取得點陣圖需要getBitmap()方法。
bmp = abmp.getBitmap();
圖像不過是一個二維矩陣。 相同的方式將處理位圖。 圖像是由像素組成的。 所以,你會從中得到位圖像素,並應用處理它。
for(int i=0; i<bmp.getWidth(); i++){
for(int j=0; j<bmp.getHeight(); j++){
int p = bmp.getPixel(i, j);
}
}
copy(Bitmap.Config config, boolean isMutable):複製此點陣圖的像素到新點陣圖。
createBitmap(DisplayMetrics display, int width, int height, Bitmap.Config config):建立新建的點陣圖,自己設定長、寬。
createBitmap(int width, int height, Bitmap.Config config):建立新建的點陣圖,自己設定長、寬。
createBitmap(Bitmap src):建立跟 src一樣的點陣圖。
extractAlpha():取得原來點陣圖的Alpha值。
getConfig():取得點陣圖格式。例如:ARGB_8888。
getDensity():取得影像或是圖像畫面的密度。
getRowBytes():每一列點陣圖所佔用的Byte數(點陣圖的資料)。
1 pixel=占用4Byte,1 row(列)=4Byte * Width(點陣圖寬度)
1 pixel=占用4Byte,1 row(列)=4Byte * Width(點陣圖寬度)
setPixel(int x, int y, int color):針對點陣圖的一點設定顏色。
setDensity(int density):設定影像或是圖像畫面的密度,會參考手機畫面的密度。
參考文獻
Android - Image Effects
Android圖像效果教程
Android圖片效果
Bitmap API
https://read01.com/NkDQ7a.html
Image Editor(Effects) Tutorial Android
http://www.androidcodec.com/bitmap-image-effects-tutorial-android/
Image Editor(Effects) Tutorial Android
http://www.androidcodec.com/bitmap-image-effects-tutorial-android/
沒有留言:
張貼留言