Example usage for android.graphics Color alpha

List of usage examples for android.graphics Color alpha

Introduction

In this page you can find the example usage for android.graphics Color alpha.

Prototype

@IntRange(from = 0, to = 255)
public static int alpha(int color) 

Source Link

Document

Return the alpha component of a color int.

Usage

From source file:xyz.zpayh.hdimage.HDImageView.java

public final void setMappingBackgroundColor(@ColorInt int tileBgColor) {
    if (Color.alpha(tileBgColor) == 0) {
        mMappingBgPaint = null;/*  w  w w  . ja v a 2s .c  o  m*/
    } else {
        mMappingBgPaint = new Paint();
        mMappingBgPaint.setStyle(Paint.Style.FILL);
        mMappingBgPaint.setColor(tileBgColor);
    }
    invalidate();
}

From source file:com.pdftron.pdf.tools.Tool.java

protected int getInvertColor(int color) {
    int a = Color.alpha(color);
    int r = Color.red(color);
    int g = Color.green(color);
    int b = Color.blue(color);

    int invertColor = Color.argb(a, 255 - r, 255 - g, 255 - b);
    return invertColor;
}

From source file:me.ccrama.redditslide.Views.SubsamplingScaleImageView.java

/**
 * Set a solid color to render behind tiles, useful for displaying transparent PNGs.
 *
 * @param tileBgColor Background color for tiles.
 *//*w ww . j a v  a  2 s  . c om*/
public final void setTileBackgroundColor(int tileBgColor) {
    if (Color.alpha(tileBgColor) == 0) {
        tileBgPaint = null;
    } else {
        tileBgPaint = new Paint();
        tileBgPaint.setStyle(Style.FILL);
        tileBgPaint.setColor(tileBgColor);
    }
    invalidate();
}