/// <summary> /// Converts a <see cref="GenericImage{T}"/> to an array of <see cref="UnityEngine.Color"/>. /// </summary> /// <param name="image">The image to be converted.</param> /// <returns>Returns a new array of <see cref="UnityEngine.Color"/>.</returns> public static UnityEngine.Color[] ToUnityColorArray(this GenericImage <Color> image) { var colorArray = new UnityEngine.Color[image.Width * image.Height]; var position = 0; for (var y = 0; y < image.Height; y++) { for (var x = 0; x < image.Width; x++) { colorArray[position++] = image[x, y]; } } return(colorArray); }
/// <summary> /// Converts a <see cref="GenericImage{T}"/> to an array of <see cref="UnityEngine.Color"/>. /// </summary> /// <param name="image">The image to be converted.</param> /// <returns>Returns a new array of <see cref="UnityEngine.Color"/>.</returns> public static UnityEngine.Color[] ToUnityColorArray(this GenericImage<Color> image) { var colorArray = new UnityEngine.Color[image.Width * image.Height]; var position = 0; for (var y = 0; y < image.Height; y++) { for (var x = 0; x < image.Width; x++) { colorArray[position++] = image[x, y]; } } return colorArray; }