1. Hue/hue--the color of the object passing
ColorMatrix huematrix=new Colormtrix ();
Huematrix.setrotate (0,hue);
Huematrix.setrotate (1,hue);
Huematrix.setrotate (2.hue);
2. Saturation-the purity of the color, from (0) to 100% saturation to describe
ColorMatrix saturationmatrix=new ColorMatrix ();
Saturationmatrix.setsaturation (saturation);
3. Brightness/lightness--the degree of light and shade relative to the color
ColorMatrix lummatrix=new ColorMatrix ();
Lummatrix.setscale (lum,lum,lun,1);
See the main code below
public class Mainactivity extends Activity implements seekbar.onseekbarchangelistener{
Private ImageView ImageView;
Private SeekBar Seekbar1,seekbar2,seekbar3;
private static int max=255;
private static int in=127;
Private MediaPlayer player;
float A,b,c;
Private Bitmap Bitmap;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
Bitmap=bitmapfactory.decoderesource (Getresources (), r.drawable.g);
imageview= (ImageView) Findviewbyid (R.id.imageview);
seekbar1= (SeekBar) Findviewbyid (R.ID.SEEKBAR1);
Seekbar2= (SeekBar) Findviewbyid (R.ID.SEEKBAR2);
seekbar3= (SeekBar) Findviewbyid (R.ID.SEEKBAR3);
Seekbar1.setonseekbarchangelistener (this);
Seekbar2.setonseekbarchangelistener (this);
Seekbar3.setonseekbarchangelistener (this);
Seekbar1.setmax (MAX);
Seekbar2.setmax (MAX);
Seekbar3.setmax (MAX);
Seekbar1.setprogress (in);
Seekbar2.setprogress (in);
Seekbar3.setprogress (in);
Imageview.setimagebitmap (bitmap);
Player=mediaplayer.create (this, R.raw.);
Player.start ();
}
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}
@Override
public void onprogresschanged (SeekBar arg0, int arg1, Boolean arg2) {
TODO auto-generated Method Stub
Switch (Arg0.getid ()) {
Case R.ID.SEEKBAR1:
A= (arg1-in) *1.0f/in*180;
Break
Case R.ID.SEEKBAR2:
b=arg1*1.0f/in;
Break
Case R.ID.SEEKBAR3:
c=arg1*1.0f/in;
Break
}
Imageview.setimagebitmap (New Imagehelper (). Handleimageview (Bitmap, A, B, c));
}
Class Imagehelper {
public static Bitmap Handleimageview (Bitmap bm,float bug,float b,float c) {
Bitmap Bm1=bitmap.createbitmap (Bm.getwidth (), Bm.getheight (), Bitmap.Config.ARGB_8888);
Canvas canvas=new canvas (BM1);
Paint paint=new Paint (paint.anti_alias_flag);
ColorMatrix hm=new ColorMatrix ();
Hm.setrotate (0, bug);
Hm.setrotate (1, bug);
Hm.setrotate (2, bug);
ColorMatrix sm=new ColorMatrix ();
Sm.setsaturation (b);
ColorMatrix lm=new ColorMatrix ();
Lm.setscale (c, C, C, 1);
ColorMatrix imagem=new ColorMatrix ();
Imagem.postconcat (HM);
Imagem.postconcat (SM);
Imagem.postconcat (LM);
Paint.setcolorfilter (New Colormatrixcolorfilter (Imagem));
Canvas.drawbitmap (BM, 0, 0, paint);
return BM1;
}
}
}
Android image processing