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.Paint;

public class Main {
    public static Bitmap getPaintedBitmap(Bitmap bitmap, Paint paint, boolean deleteOld) {
        final Bitmap colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
        final Canvas c = new Canvas(colorBitmap);
        c.drawBitmap(bitmap, 0, 0, paint);
        if (deleteOld) {
            bitmap.recycle();
        }
        return colorBitmap;
    }
}