-
-
Notifications
You must be signed in to change notification settings - Fork 890
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUGandRELEASEmode - I have searched open and closed issues to ensure it has not already been reported
Description
In same cases, we can have a collection of images with varying pixel types, and with the current API implementation it's difficult to have a collection of varying pixel types, the only way to do it now is to cast down to Object collections.
I propose these interfaces:
public interface IImage
{
Type PixelType { get; }
int Width { get; }
int Height { get; }
ImageMetaData MetaData { get; }
}
this would allow to do Linq queries over image collections like:
var imageCollection = new List<IImage>();
...
var metadataCollection = imageCollection
.Where(img=>Width > 100)
.Where(img => img.PixelType == typeof(rgba32) || img.PixelType == (argb32))
.Select(img => img.MetaData);
Also, an interface like this:
public interface IImage<TPixel> : IImage
{
TPixel this[int x, int y] {get;set;}
}
Would be helpful, in case we want to abstract the concept of "image"
Useful cases I can think about:
- TiledImage : IImage ; image composed of multiple, smaller images
- X,Y coordinate wrapping for Feature proposal: handling tileable images #427
- Conditional per pixel access.
Reactions are currently unavailable