/// <summary>
/// Returns the values of the pixels as an array.
/// </summary>
///<param name="x">The X coordinate of the area.</param>
///<param name="y">The Y coordinate of the area.</param>
///<param name="width">The width of the area.</param>
///<param name="height">The height of the area.</param>
///<param name="mapping">The mapping of the pixels (e.g. RGB/RGBA/ARGB).</param>
public byte[] ToByteArray(int x, int y, int width, int height, string mapping)
{
Throw.IfNullOrEmpty("mapping", mapping);
CheckArea(x, y, width, height);
IntPtr nativeResult = _NativeInstance.ToByteArray(x, y, width, height, mapping);
byte[] result = ByteConverter.ToArray(nativeResult, width * height * mapping.Length);
MagickMemory.Relinquish(nativeResult);
return(result);
}