public static IEnumerable <Type> ToTypes(this PixelTypes pixelTypes) { if (pixelTypes == PixelTypes.None) { return(Enumerable.Empty <Type>()); } else if (pixelTypes == PixelTypes.All) { // TODO: Need to return unknown types here without forcing CLR to load all types in ImageSharp assembly return(PixelTypes2ClrTypes.Values); } return(PixelTypesExpanded.Where(pt => pixelTypes.HasFlag(pt)).Select(pt => pt.ToType())); }
public static IEnumerable <KeyValuePair <PixelTypes, Type> > ExpandAllTypes(this PixelTypes pixelTypes) { if (pixelTypes == PixelTypes.Undefined) { return(Enumerable.Empty <KeyValuePair <PixelTypes, Type> >()); } else if (pixelTypes == PixelTypes.All) { // TODO: Need to return unknown types here without forcing CLR to load all types in ImageSharp assembly return(PixelTypes2ClrTypes); } return(AllConcretePixelTypes .Where(pt => pixelTypes.HasFlag(pt)) .Select(pt => new KeyValuePair <PixelTypes, Type>(pt, pt.ToType()))); }