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.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;

public class Main {
    public static Paint getPaintFromColor(int color) {
        final float[] array = new float[20];
        array[18] = 1;
        array[1] = (float) Color.red(color) / 255;
        array[6] = (float) Color.green(color) / 255;
        array[11] = (float) Color.blue(color) / 255;
        final Paint paint = new Paint();
        paint.setColorFilter(new ColorMatrixColorFilter(array));
        return paint;
    }
}