convert Bitmap To Alpha Mask - Android Graphics

Android examples for Graphics:Bitmap Color

Description

convert Bitmap To Alpha Mask

Demo Code


//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.Canvas;

public class Main {
    public static Bitmap convertToAlphaMask(final Bitmap b) {
        final Bitmap a = Bitmap.createBitmap(b.getWidth(), b.getHeight(),
                Bitmap.Config.ALPHA_8);/*from  w ww  . j  ava  2s . co  m*/
        final Canvas c = new Canvas(a);
        c.drawBitmap(b, 0.0f, 0.0f, null);
        return a;
    }
}

Related Tutorials