Exemple #1
0
        //sepia si prietenii
        private Android.Graphics.Bitmap createSepia_and_RBG(Android.Graphics.Bitmap src, int choise)
        {
            Android.Graphics.ColorMatrix colorMatrix_Sepia = new Android.Graphics.ColorMatrix();
            colorMatrix_Sepia.SetSaturation(0);

            Android.Graphics.ColorMatrix colorScale = new Android.Graphics.ColorMatrix();


            if (choise == 1)
            {
                colorScale.SetScale(1, 1f, 0.7f, 1); //sepia
            }
            else
            if (choise == 2)
            {
                colorScale.SetScale(1, 1f, 2f, 1); //albastru
            }
            else
            if (choise == 3)
            {
                colorScale.SetScale(1, 2f, 1f, 1); //verde
            }
            else
            if (choise == 4)
            {
                colorScale.SetScale(2f, 1, 1f, 1); //rosu
            }
            //0.7 sepia ch =1
            //0.4 ceva verziu
            //2 albastru fain
            //5 albastru neon

            colorMatrix_Sepia.PostConcat(colorScale);

            Android.Graphics.ColorFilter ColorFilter_Sepia = new Android.Graphics.ColorMatrixColorFilter(
                colorMatrix_Sepia);

            Android.Graphics.Bitmap bitmap = Android.Graphics.Bitmap.CreateBitmap(src.Width, src.Height,
                                                                                  Android.Graphics.Bitmap.Config.Argb8888);
            Android.Graphics.Canvas canvas = new Android.Graphics.Canvas(bitmap);

            Android.Graphics.Paint paint = new Android.Graphics.Paint();

            paint.SetColorFilter(ColorFilter_Sepia);
            canvas.DrawBitmap(src, 0, 0, paint);

            return(bitmap);
        }
Exemple #2
0
        //Gray Filter
        public Android.Graphics.Bitmap toGrayscale(Android.Graphics.Bitmap bmpOriginal)
        {
            int width, height;

            height = bmpOriginal.Height;
            width  = bmpOriginal.Width;

            Android.Graphics.Bitmap      bmpGrayscale = Android.Graphics.Bitmap.CreateBitmap(width, height, Android.Graphics.Bitmap.Config.Argb8888);
            Android.Graphics.Canvas      c            = new Android.Graphics.Canvas(bmpGrayscale);
            Android.Graphics.Paint       paint        = new Android.Graphics.Paint();
            Android.Graphics.ColorMatrix cm           = new Android.Graphics.ColorMatrix();
            cm.SetSaturation(0);
            Android.Graphics.ColorMatrixColorFilter f = new Android.Graphics.ColorMatrixColorFilter(cm);
            paint.SetColorFilter(f);
            c.DrawBitmap(bmpOriginal, 0, 0, paint);
            return(bmpGrayscale);
        }