Exemplo n.º 1
0
        private IEnumerable <ImageTransform> BuiltImageTransformList()
        {
            ImageTransformCollection retVal = new ImageTransformCollection();

            string copyrightText = this.Copyright;

            if (!string.IsNullOrEmpty(copyrightText))
            {
                int copyrightFontSize = this.CopyrightSize;
                CopyrightTransform copyrightTransform = new CopyrightTransform(copyrightText, copyrightFontSize);
                retVal.Add(copyrightTransform);
            }

            if (this.Grayscale)
            {
                GrayscaleTransform grayscaleTransform = new GrayscaleTransform();
                retVal.Add(grayscaleTransform);
            }

            if (this.Negative)
            {
                NegativeTransform negativeTransform = new NegativeTransform();
                retVal.Add(negativeTransform);
            }

            if (this.Sepia)
            {
                SepiaTransform sepiaTransform = new SepiaTransform();
                retVal.Add(sepiaTransform);
            }

            float brightness = this.Brightness;

            if (brightness != 0)
            {
                BrightnessTransform brightnessTransform = new BrightnessTransform(brightness);
                retVal.Add(brightnessTransform);
            }

            float contrast = this.Contrast;

            if (contrast != 1)
            {
                ContrastTransform contrastTransform = new ContrastTransform(contrast);
                retVal.Add(contrastTransform);
            }

            float opacity = this.Opacity;

            if (opacity != 0)
            {
                OpacityTransform opacityTransform = new OpacityTransform(opacity);
                retVal.Add(opacityTransform);
            }

            return(retVal.Union(CustomTransforms).OrderBy(it => it.Position));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageTransformer"/> class.
 /// </summary>
 public ImageTransformer()
 {
     this.GraphicsQuality = GraphicsQuality.Default;
     this.Contrast        = 1F;
     CustomTransforms     = new ImageTransformCollection();
 }