setImageInfo

fun setImageInfo(imageInfo: ImageInfo): Boolean

Sets width, height, ColorAlphaType, ColorType, ColorSpace. Frees pixels, and returns true if successful.

imageInfo.getAlphaType() may be altered to a value permitted by imageInfo.getColorSpace(). If imageInfo.getColorType() is ColorType.UNKNOWN, imageInfo.getAlphaType() is set to ColorAlphaType.UNKNOWN. If imageInfo.colorType() is ColorType.ALPHA_8 and imageInfo.getAlphaType() is ColorAlphaType.UNPREMUL, imageInfo.getAlphaType() is replaced by ColorAlphaType.PREMUL. If imageInfo.colorType() is ColorType.RGB_565 or ColorType.GRAY_8, imageInfo.getAlphaType() is set to ColorAlphaType.OPAQUE. If imageInfo.colorType() is ColorType.ARGB_4444, ColorType.RGBA_8888, ColorType.BGRA_8888, or ColorType.RGBA_F16: imageInfo.getAlphaType() remains unchanged.

Calls reset() and returns false if:

  • rowBytes exceeds 31 bits

  • imageInfo.getWidth() is negative

  • imageInfo.getHeight() is negative

  • rowBytes is positive and less than imageInfo.getWidth() times imageInfo.getBytesPerPixel()

Return

true if ImageInfo set successfully

Parameters

imageInfo

contains width, height, AlphaType, ColorType, ColorSpace

See also


fun setImageInfo(imageInfo: ImageInfo, rowBytes: Int): Boolean

Sets width, height, ColorAlphaType, ColorType, ColorSpace, and optional rowBytes. Frees pixels, and returns true if successful.

imageInfo.getAlphaType() may be altered to a value permitted by imageInfo.getColorSpace(). If imageInfo.getColorType() is ColorType.UNKNOWN, imageInfo.getAlphaType() is set to ColorAlphaType.UNKNOWN. If imageInfo.colorType() is ColorType.ALPHA_8 and imageInfo.getAlphaType() is ColorAlphaType.UNPREMUL, imageInfo.getAlphaType() is replaced by ColorAlphaType.PREMUL. If imageInfo.colorType() is ColorType.RGB_565 or ColorType.GRAY_8, imageInfo.getAlphaType() is set to ColorAlphaType.OPAQUE. If imageInfo.colorType() is ColorType.ARGB_4444, ColorType.RGBA_8888, ColorType.BGRA_8888, or ColorType.RGBA_F16: imageInfo.getAlphaType() remains unchanged.

rowBytes must equal or exceed imageInfo.getMinRowBytes(). If imageInfo.getColorSpace() is ColorType.UNKNOWN, rowBytes is ignored and treated as zero; for all other ColorSpace values, rowBytes of zero is treated as imageInfo.getMinRowBytes().

Calls reset() and returns false if:

  • rowBytes exceeds 31 bits

  • imageInfo.getWidth() is negative

  • imageInfo.getHeight() is negative

  • rowBytes is positive and less than imageInfo.getWidth() times imageInfo.getBytesPerPixel()

Return

true if ImageInfo set successfully

Parameters

imageInfo

contains width, height, AlphaType, ColorType, ColorSpace

rowBytes

imageInfo.getMinRowBytes() or larger; or zero

See also