iron-software / IronSoftware.System.Drawing

An open-source System.Drawing.Common replacement for .NET 5 and above on all platforms. Bringing together System.Drawing, Maui, and ImageSharp's Bitmap, Image, Font, and Shape types via an agnostic free NuGet package.
Other
114 stars 18 forks source link

Support IEnumerable Casting #31

Open djrecipe opened 1 year ago

djrecipe commented 1 year ago

SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32> imgSharp = SixLabors.ImageSharp.Image.Load<SixLabors.ImageSharp.PixelFormats.Rgba32>(imagePath);

List<SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32>> imgSharpList = new List<Image<Rgba32>>() {imgSharp};

// TODO 1/9/23: support this casting

List<AnyBitmap> anyBitmapList = imgSharpList.Cast<AnyBitmap>().ToList();

// should we also support this?

//List<AnyBitmap> anyBitmapList = imgSharpList;

See this commit for regression test