Beispiel #1
0
 public WicDecoder(IPixelSource imgSource, WicProcessingContext ctx)
 {
     init(null, ctx);
     ContainerFormat = FileFormat.Unknown;
     FrameCount      = 1;
     ctx.Source      = imgSource.AsPixelSource();
 }
        /// <inheritdoc cref="BuildPipeline(string, ProcessImageSettings)" />
        /// <param name="imgSource">A custom pixel source to use as input.</param>
        public static ProcessingPipeline BuildPipeline(IPixelSource imgSource, ProcessImageSettings settings)
        {
            if (imgSource is null)
            {
                throw new ArgumentNullException(nameof(imgSource));
            }

            var ctx = new PipelineContext(settings)
            {
                ImageContainer = new PixelSourceContainer(imgSource),
                Source         = imgSource.AsPixelSource()
            };

            buildPipeline(ctx, false);
            return(new ProcessingPipeline(ctx));
        }
        /// <inheritdoc cref="ProcessImage(string, Stream, ProcessImageSettings)" />
        /// <param name="imgSource">A custom pixel source to use as input.</param>
        public static ProcessImageResult ProcessImage(IPixelSource imgSource, Stream outStream, ProcessImageSettings settings)
        {
            if (imgSource is null)
            {
                throw new ArgumentNullException(nameof(imgSource));
            }
            checkOutStream(outStream);

            using var ctx = new PipelineContext(settings)
                  {
                      ImageContainer = new PixelSourceContainer(imgSource),
                      Source         = imgSource.AsPixelSource()
                  };

            buildPipeline(ctx);
            return(WriteOutput(ctx, outStream));
        }