allocPixels

fun allocPixels(info: ImageInfo, rowBytes: Int): Boolean

Sets ImageInfo to info following the rules in setImageInfo() and allocates pixel memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(), or equal zero.

Returns false and calls reset() if ImageInfo could not be set, or memory could not be allocated.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of malloc().

Return

true if pixel storage is allocated

Parameters

info

contains width, height, ColorAlphaType, ColorType, ColorSpace

rowBytes

size of pixel row or larger; may be zero


fun allocPixels(imageInfo: ImageInfo): Boolean

Sets ImageInfo to info following the rules in .setImageInfo and allocates pixel memory.

Returns false and calls reset() if ImageInfo could not be set, or memory could not be allocated.

On most platforms, allocating pixel memory may succeed even though there is not sufficient memory to hold pixels; allocation does not take place until the pixels are written to. The actual behavior depends on the platform implementation of malloc().

Return

true if pixel storage is allocated

Parameters

imageInfo

contains width, height, ColorAlphaType, ColorType, ColorSpace

See also


Allocates pixel memory with HeapAllocator, and replaces existing PixelRef. The allocation size is determined by ImageInfo width, height, and ColorType.

Returns false if info().colorType() is ColorType.UNKNOWN, or allocation fails.

Return

true if the allocation succeeds