public static Texture2D CreateTexture(this IImageRead image, GraphicsDevice graphicsDevice) { var size = image.Size; var texture = new Texture2D(graphicsDevice, size.Width, size.Height); texture.SetData(image.AsBgra8888()); return(texture); }
public static ISurface CreateSurface(this IDrawing drawing, IImageRead image) => drawing .CreateSurface(image.Size.Width, image.Size.Height, Xe.Drawing.PixelFormat.Format32bppArgb, SurfaceType.Input, new DataResource { Data = image.AsBgra8888(), Stride = image.Size.Width * 4 });
public static Texture2D CreateTexture(this IImageRead image, GraphicsDevice graphicsDevice) { var size = image.Size; var texture = new Texture2D(graphicsDevice, size.Width, size.Height); if (image.PixelFormat != PixelFormat.Rgba1555) { texture.SetData(image.AsBgra8888()); } else { texture = new Texture2D(graphicsDevice, 1, 1); byte[] pix = new byte[4]; pix[0] = 0xFF; pix[1] = 0xFF; pix[2] = 0xFF; pix[3] = 0xFF; texture.SetData(pix); } return(texture); }