public Texture newTexture(Pixmap pixmap, PixmapFormat format) { var rawPixmap = pixmap.getPixels(); SurfaceFormat destFormat; if (format == PixmapFormat.ALPHA) { destFormat = SurfaceFormat.Alpha8; } else if (format == PixmapFormat.RGBA8888) { destFormat = SurfaceFormat.ColorSRgb; } else { throw new ArgumentException("format not supported"); } var texture = new Texture2D(_graphicsDevice, pixmap.getWidth(), pixmap.getHeight(), false, destFormat); texture.SetData(rawPixmap); return(new MonoGameTexture(texture)); }
public static IEnumerator getPixels(Pixmap pixmap) { return pixmap.getPixels(); }