setAlphaType

Sets alpha type, if argument is compatible with current color type. Returns true unless argument is ColorAlphaType.UNKNOWN and current value is ColorAlphaType.UNKNOWN.

Returns true if current color type is ColorType.UNKNOWN. Argument is ignored, and alpha type remains ColorAlphaType.UNKNOWN.

Returns true if current color type is ColorType.RGB_565 or ColorType.GRAY_8. Argument is ignored, and alpha type remains ColorAlphaType.OPAQUE.

If current color type is ColorType.ARGB_4444, ColorType.RGBA_8888, ColorType.BGRA_8888, or ColorType.RGBA_F16: returns true unless argument is ColorAlphaType.UNKNOWN and current alpha type is not ColorAlphaType.UNKNOWN. If current alpha type is ColorAlphaType.UNKNOWN, argument is ignored.

If current color type is ColorType.ALPHA_8, returns true unless argument is ColorAlphaType.UNKNOWN and current alpha type is not ColorAlphaType.UNKNOWN. If current alpha type is ColorAlphaType.UNKNOWN, argument is ignored. If argument is ColorAlphaType.UNPREMUL, it is treated as ColorAlphaType.PREMUL.

This changes alpha type in PixelRef; all bitmaps sharing PixelRef are affected.

Return

true if alpha type is set

See also