Exemple #1
0
        /// <summary>
        /// Appends an effect to an existing composition pipeline
        /// </summary>
        /// <param name="effect">The <see cref="IPipelineEffect"/> instance to append to the current pipeline</param>
        /// <param name="builder">The target <see cref="PipelineBuilder"/> instance to modify</param>
        /// <returns>The target <see cref="PipelineBuilder"/> instance in use</returns>
        private static PipelineBuilder Append(IPipelineEffect effect, PipelineBuilder builder)
        {
            switch (effect)
            {
            case OpacityEffect opacity:
                return(builder.Opacity((float)opacity.Value));

            case LuminanceToAlphaEffect _:
                return(builder.LuminanceToAlpha());

            case InvertEffect _:
                return(builder.Invert());

            case GrayscaleEffect _:
                return(builder.Grayscale());

            case ExposureEffect exposure:
                return(builder.Exposure((float)exposure.Value));

            case SepiaEffect sepia:
                return(builder.Sepia((float)sepia.Value));

            case ShadeEffect shade:
                return(builder.Shade(shade.Color, (float)shade.Intensity));

            case HueRotationEffect hueRotation:
                return(builder.HueRotation((float)hueRotation.Angle));

            case TintEffect tint:
                return(builder.Tint(tint.Color));

            case TemperatureAndTintEffect temperatureAndTint:
                return(builder.TemperatureAndTint((float)temperatureAndTint.Temperature, (float)temperatureAndTint.Tint));

            case BlurEffect blur:
                return(builder.Blur((float)blur.Value));

            case SaturationEffect saturation:
                return(builder.Saturation((float)saturation.Value));

            case BlendEffect blend:
                return(builder.Blend(Build(blend.Input), (BlendEffectMode)blend.Mode, blend.Placement));

            default:
                throw new ArgumentException($"Invalid pipeline effect: {effect.GetType()}");
            }
        }
Exemple #2
0
 /// <inheritdoc/>
 public PipelineBuilder AppendToPipeline(PipelineBuilder builder)
 {
     return(builder.Exposure((float)Amount));
 }