Пример #1
0
        public void AddTransform(IPixelTransform transform)
        {
            if (source.IsValueCreated)
            {
                throw new NotSupportedException("A Transform cannot be added once the Pipeline Source is materialized");
            }

            if (transform is IPixelTransformInternal tint)
            {
                tint.Init(Context);
                return;
            }

            transform.Init(Context.Source.AsIPixelSource());
            Context.Source = transform.AsPixelSource();
        }
Пример #2
0
        /// <summary>Adds a new transform filter to the pipeline.  Because a filter may alter dimensions or pixel format of an image, filters may not be added once the <see cref="PixelSource" /> has been retrieved.</summary>
        /// <param name="transform">The <see cref="IPixelTransform" /> that implements the filter.</param>
        public ProcessingPipeline AddTransform(IPixelTransform transform)
        {
            if (source.IsValueCreated)
            {
                throw new NotSupportedException("A Transform cannot be added once the Pipeline Source is materialized");
            }

            if (transform is IPixelTransformInternal tint)
            {
                tint.Init(Context);
                return(this);
            }

            MagicTransforms.AddExternalFormatConverter(Context);

            transform.Init(Context.Source.AsIPixelSource());
            Context.Source = transform.AsPixelSource();
            return(this);
        }