Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Bitmap;
import android.graphics.Canvas;

import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;

public class Main {

    public static Bitmap highSaturationImage(Bitmap bm) {
        Bitmap bitmap = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        Paint paint = new Paint();

        float[] matrixs = new float[] { 1.438f, -0.122f, -0.016f, 0, -0.03f, -0.062f, 1.378f, -0.016f, 0, 0.05f,
                -0.062f, -0.122f, 1.438f, 0, -0.02f, 0, 0, 0, 1, 0 };

        ColorMatrix colorMatrix = new ColorMatrix();
        colorMatrix.set(matrixs);
        paint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));

        canvas.drawBitmap(bm, 0, 0, paint);

        return bitmap;
    }
}