create Sharp image - Android Media

Android examples for Media:Picture

Description

create Sharp image

Demo Code


//package com.java2s;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;

import android.graphics.Canvas;
import android.graphics.Color;

import android.graphics.Paint;

import android.graphics.Rect;
import android.graphics.RectF;

public class Main {

    public static Bitmap createSharpeimage(Bitmap bitmap) {
        int height = bitmap.getHeight();
        int width = bitmap.getWidth();
        Bitmap bitmapWithReflection = Bitmap.createBitmap(width, height
                + (int) (height * 0.2f), Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmapWithReflection);
        canvas.drawBitmap(bitmap, 0, 0, null);
        Paint paint = new Paint();
        paint.setColor(Color.WHITE);
        paint.setAlpha(15);/*from w  w w  . ja va 2s  .  c o m*/
        int w = width / 2;
        int h = height / 3;
        final Rect rect = new Rect(-w, -2 * h, 3 * w, h);
        final RectF rectF = new RectF(rect);
        canvas.drawOval(rectF, paint);
        return bitmapWithReflection;
    }
}

Related Tutorials