FileDocCategorySizeDatePackage
PixelFormat.javaAPI DocAndroid 5.1 API4808Thu Mar 12 22:22:30 GMT 2015android.graphics

PixelFormat

public class PixelFormat extends Object

Fields Summary
public static final int
UNKNOWN
public static final int
TRANSLUCENT
System chooses a format that supports translucency (many alpha bits)
public static final int
TRANSPARENT
System chooses a format that supports transparency (at least 1 alpha bit)
public static final int
OPAQUE
System chooses an opaque format (no alpha bits required)
public static final int
RGBA_8888
public static final int
RGBX_8888
public static final int
RGB_888
public static final int
RGB_565
public static final int
RGBA_5551
public static final int
RGBA_4444
public static final int
A_8
public static final int
L_8
public static final int
LA_88
public static final int
RGB_332
public static final int
YCbCr_422_SP
public static final int
YCbCr_420_SP
public static final int
YCbCr_422_I
public static final int
JPEG
public int
bytesPerPixel
public int
bitsPerPixel
Constructors Summary
Methods Summary
public static booleanformatHasAlpha(int format)

        switch (format) {
            case PixelFormat.A_8:
            case PixelFormat.LA_88:
            case PixelFormat.RGBA_4444:
            case PixelFormat.RGBA_5551:
            case PixelFormat.RGBA_8888:
            case PixelFormat.TRANSLUCENT:
            case PixelFormat.TRANSPARENT:
                return true;
        }
        return false;
    
public static voidgetPixelFormatInfo(int format, android.graphics.PixelFormat info)


           
        switch (format) {
            case RGBA_8888:
            case RGBX_8888:
                info.bitsPerPixel = 32;
                info.bytesPerPixel = 4;
                break;
            case RGB_888:
                info.bitsPerPixel = 24;
                info.bytesPerPixel = 3;
                break;
            case RGB_565:
            case RGBA_5551:
            case RGBA_4444:
            case LA_88:
                info.bitsPerPixel = 16;
                info.bytesPerPixel = 2;
                break;
            case A_8:
            case L_8:
            case RGB_332:
                info.bitsPerPixel = 8;
                info.bytesPerPixel = 1;
                break;
            case YCbCr_422_SP:
            case YCbCr_422_I:
                info.bitsPerPixel = 16;
                info.bytesPerPixel = 1;
                break;
            case YCbCr_420_SP:
                info.bitsPerPixel = 12;
                info.bytesPerPixel = 1;
                break;
            default:
                throw new IllegalArgumentException("unknown pixel format " + format);
        }
    
public static booleanisPublicFormat(int format)
Determine whether or not this is a public-visible and non-deprecated {@code format}.

In particular, {@code @hide} formats will return {@code false}.

Any other indirect formats (such as {@code TRANSPARENT} or {@code TRANSLUCENT}) will return {@code false}.

param
format an integer format
return
a boolean
hide

        switch (format) {
            case RGBA_8888:
            case RGBX_8888:
            case RGB_888:
            case RGB_565:
                return true;
        }

        return false;