Bitmap extractAlpha - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Bitmap extractAlpha method.

This code example shows how to use the following methods:extractAlpha, getHeight, getWidth
	} 
 
	private static Bitmap getDropShadow(final Bitmap src, final float radius, final int color) {
		if (src == null) return null;
		final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		final int width = src.getWidth(), height = src.getHeight();
		final Bitmap dest = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
		final Canvas canvas = new Canvas(dest);
		// Create background 
		final Bitmap alpha = src.extractAlpha();
		paint.setColor(color);
		canvas.drawBitmap(alpha, 0, 0, paint);
		// Create outer blur 
		final BlurMaskFilter filter = new BlurMaskFilter(radius, BlurMaskFilter.Blur.OUTER);
		paint.setMaskFilter(filter);
		canvas.drawBitmap(alpha, 0, 0, paint);
		return dest;
	} 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, getHeight, getWidth, recycle
        // We start by removing most of the alpha channel so as to ignore shadows, and 
        // other types of partial transparency when defining the shape of the object 
        if (alphaClipPaint == null) {
            alphaClipPaint = mAlphaClipPaint;
        } 
        Bitmap glowShape = srcDst.extractAlpha(alphaClipPaint, mTempOffset);
 
        // calculate the outer blur first 
        BlurMaskFilter outerBlurMaskFilter;
        switch (thickness) {
            case EXTRA_THICK:
                outerBlurMaskFilter = sExtraThickOuterBlurMaskFilter;
                break; 
            case THICK:
                outerBlurMaskFilter = sThickOuterBlurMaskFilter;
                break; 
            case MEDIUM:
                outerBlurMaskFilter = sMediumOuterBlurMaskFilter;
                break; 
            default: 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, getHeight, getWidth
 
            // The glow radius 
            int glowRadius = 4;
 
            // Extract the alpha from the source image 
            Bitmap alpha = src.extractAlpha();
 
            // The output bitmap (with the icon + glow) 
            Bitmap bmp = Bitmap.createBitmap(src.getWidth() + margin,
                    src.getHeight() + margin, Bitmap.Config.ARGB_8888);
 
            // The canvas to paint on the image 
            Canvas canvas = new Canvas(bmp);
 
            Paint paint = new Paint();
            paint.setColor(glowColor);
 
            // Outer glow 
            ColorFilter emphasize = new LightingColorFilter(glowColor, 1);
            paint.setColorFilter(emphasize);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, recycle
        final Canvas dest = new Canvas(result);
 
        dest.drawColor(0, PorterDuff.Mode.CLEAR);
 
        int[] xy = new int[2];
        Bitmap mask = src.extractAlpha(mBlurPaint, xy);
 
        dest.drawBitmap(mask, xy[0], xy[1],
                pressed ? mGlowColorPressedPaint : mGlowColorFocusedPaint);
 
        mask.recycle();
 
        dest.drawBitmap(src, 0, 0, mPaint);
        dest.setBitmap(null);
 
        return result;
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, recycle
        final Canvas dest = new Canvas(result);
 
        dest.drawColor(0, PorterDuff.Mode.CLEAR);
 
        int[] xy = new int[2];
        Bitmap mask = src.extractAlpha(mBlurPaint, xy);
 
        dest.drawBitmap(mask, xy[0], xy[1],
                pressed ? mGlowColorPressedPaint : mGlowColorFocusedPaint);
 
        mask.recycle();
 
        dest.drawBitmap(src, 0, 0, mPaint);
        dest.setBitmap(null);
 
        return result;
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, getHeight, getWidth
This code example shows how to use the following methods:extractAlpha, getHeight, getWidth, recycle
        // We start by removing most of the alpha channel so as to ignore shadows, and 
        // other types of partial transparency when defining the shape of the object 
        if (alphaClipPaint == null) {
            alphaClipPaint = mAlphaClipPaint;
        } 
        Bitmap glowShape = srcDst.extractAlpha(alphaClipPaint, mTempOffset);
 
        // calculate the outer blur first 
        BlurMaskFilter outerBlurMaskFilter;
        switch (thickness) {
            case EXTRA_THICK:
                outerBlurMaskFilter = sExtraThickOuterBlurMaskFilter;
                break; 
            case THICK:
                outerBlurMaskFilter = sThickOuterBlurMaskFilter;
                break; 
            case MEDIUM:
                outerBlurMaskFilter = sMediumOuterBlurMaskFilter;
                break; 
            default: 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:extractAlpha, getHeight, getWidth, recycle
        // We start by removing most of the alpha channel so as to ignore shadows, and 
        // other types of partial transparency when defining the shape of the object 
        if (alphaClipPaint == null) {
            alphaClipPaint = mAlphaClipPaint;
        } 
        Bitmap glowShape = srcDst.extractAlpha(alphaClipPaint, mTempOffset);
 
        // calculate the outer blur first 
        BlurMaskFilter outerBlurMaskFilter;
        switch (thickness) {
            case EXTRA_THICK:
                outerBlurMaskFilter = sExtraThickOuterBlurMaskFilter;
                break; 
            case THICK:
                outerBlurMaskFilter = sThickOuterBlurMaskFilter;
                break; 
            case MEDIUM:
                outerBlurMaskFilter = sMediumOuterBlurMaskFilter;
                break; 
            default: 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Bitmap extractAlpha Questions & Answers:

extractAlpha Method Overview
Returns a new bitmap that captures the alpha values of the original.
See Code Examples for other Android Bitmap Methods: