public static int GetMaxHeaderSize(this IImagingConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } var provider = config.GetModule <ImagingInstanceProvider <IImageFormatDetector> >(); return(provider.GetMaxHeaderSize()); }
public static IEnumerable <IImageFormatDetector> GetFormatDetectors(this IImagingConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } var provider = config.GetModule <ImagingInstanceProvider <IImageFormatDetector> >(); return(provider.Values); }
public static bool TryGetInfoDetector( this IImagingConfig config, ImageFormat format, [MaybeNullWhen(false)] out IImageInfoDetector infoDetector) { if (config == null) { throw new ArgumentNullException(nameof(config)); } var provider = config.GetModule <ImagingInstanceProvider <IImageInfoDetector> >(); return(provider.TryGetValue(format, out infoDetector)); }
public static bool TryCreateDecoder( this IImagingConfig config, Stream stream, ImageFormat format, DecoderOptions?decoderOptions, [MaybeNullWhen(false)] out IImageDecoder decoder) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } var provider = config.GetModule <ImageCoderProvider <IImageDecoder> >(); var factory = provider.GetFactory(format); decoder = factory.Invoke(stream, decoderOptions) ?? throw new ImagingException("Coder factory returned null."); return(true); }