/// <summary> /// Creates an image and fills it with the given color. /// </summary> /// <param name="width">The width (in pixels) of the image to create.</param> /// <param name="height">The height (in pixels) of the image to create.</param> /// <param name="color">The color to fill the image with.</param> /// <returns>The newly created image.</returns> public static ImageData CreateImage(int width, int height, ColorUint color) { int colorVal = color.ToBgra(); int nPixels = width * height; int nBytes = nPixels * 4; int[] pxls = new int[nPixels]; for (int i = 0; i < pxls.Length; i++) { pxls[i] = colorVal; } var ret = new ImageData(new byte[nBytes], width, height, new ImagePixelFormat(ColorFormat.RGBA)); Buffer.BlockCopy(pxls, 0, ret.PixelData, 0, nBytes); return(ret); /* * var ret = new ImageData(new byte[width * height*4], width, height, new ImagePixelFormat(ColorFormat.RGBA)); * * MemSet(ret.PixelData, color.ToArray()); * * return ret;*/ }