Skip to content Skip to sidebar Skip to footer

Blur And Emboss An Image

I'm working on an android application, and I have a drawable that I'm loading up from a source image. On this image i want make a image blur and embross ,i have read How to change

Solution 1:

publicBitmapfudiao(Bitmap bmpOriginal) {
    int width, height, r,g, b, c,a, gry,c1,a1,r1,g1,b1,red,green,blue; 
    height = bmpOriginal.getHeight(); 
    width = bmpOriginal.getWidth(); 
    int depth = 30;

      Bitmap bmpSephia = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
        Canvas canvas = newCanvas(bmpSephia);
        Paint paint = newPaint();
      //  ColorMatrix cm = new ColorMatrix();//  cm.setScale(.3f, .3f, .3f, 1.0f);   //  ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);//  paint.setColorFilter(f);
       canvas.drawBitmap(bmpOriginal, 0, 0, null);
        for(int y=1; y< height-1; y++) {
            for(int x=1; x < width-1; x++) {
                c = bmpOriginal.getPixel(x, y);

                r = Color.red(c);
                g = Color.green(c);
                b = Color.blue(c);

                c1 = bmpOriginal.getPixel(x-1, y-1);

                r1 = Color.red(c1);
                g1 = Color.green(c1);
                b1 = Color.blue(c1);


                red = Math.max(67, Math.min(255, Math.abs(r - r1 + 128)));
                green = Math.max(67, Math.min(255, Math.abs(g - g1 + 128)));
                blue = Math.max(67, Math.min(255, Math.abs(b - b1 + 128))); 
                if (red > 255)
                {
                    red = 255;
                }
                elseif (red < 0)
                {
                    red = 0;
                }

                if (green > 255)
                {
                    green = 255;
                }
                elseif (green < 0)
                {
                    green = 0;
                }

                if (blue > 255)
                {
                    blue = 255;
                }
                elseif (blue < 0)
                {
                    blue = 0;
                }

               bmpSephia.setPixel(x, y, Color.rgb(red, green, blue));
               // bmpSephia.setPixel(x, y, Color.argb(a1, red, green, blue));
            }
        }      
        return bmpSephia;
    }

this only emboss a pic

Solution 2:

I think you are probably looking for something like this: http://code.google.com/p/jjil/

Solution 3:

paint.setColorFilter( <LightingColorFilter> );

Post a Comment for "Blur And Emboss An Image"