/// <summary> /// Allocates padded buffers for BMP encoder/decoder. (Replacing old PixelRow/PixelArea) /// </summary> /// <param name="memoryAllocator">The <see cref="MemoryAllocator"/></param> /// <param name="width">Pixel count in the row</param> /// <param name="pixelSizeInBytes">The pixel size in bytes, eg. 3 for RGB</param> /// <param name="paddingInBytes">The padding</param> /// <returns>A <see cref="IManagedByteBuffer"/></returns> public static IManagedByteBuffer AllocatePaddedPixelRowBuffer( this MemoryAllocator memoryAllocator, int width, int pixelSizeInBytes, int paddingInBytes) { int length = (width * pixelSizeInBytes) + paddingInBytes; return(memoryAllocator.AllocateManagedByteBuffer(length)); }
public static IManagedByteBuffer AllocateCleanManagedByteBuffer(this MemoryAllocator memoryAllocator, int length) { return(memoryAllocator.AllocateManagedByteBuffer(length, true)); }