Пример #1
0
 public void Setup()
 {
     this.bulk     = new GlowProcessor <Rgba32>(Configuration.Default.MemoryManager, NamedColors <Rgba32> .Beige, 800 * .5f, GraphicsOptions.Default);
     this.parallel = new GlowProcessorParallel <Rgba32>(NamedColors <Rgba32> .Beige)
     {
         Radius = 800 * .5f,
     };
 }
Пример #2
0
 public void Setup()
 {
     this.bulk     = new GlowProcessor(Color.Beige, 800 * .5f, GraphicsOptions.Default);
     this.parallel = new GlowProcessorParallel <Rgba32>(Color.Beige)
     {
         Radius = 800 * .5f,
     };
 }
Пример #3
0
        public void Glow_Radux_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow(3.5f);
            GlowProcessor p = this.Verify <GlowProcessor>();

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, GraphicsOptionsComparer);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.Absolute(3.5f), p.Radius);
        }
Пример #4
0
        public void Glow_Color_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow(Rgba32.Aquamarine);
            GlowProcessor p = this.Verify <GlowProcessor>();

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, GraphicsOptionsComparer);
            Assert.Equal(Color.Aquamarine, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
Пример #5
0
        public void Glow_GlowProcessorWithDefaultValues()
        {
            this.operations.Glow();
            GlowProcessor p = this.Verify <GlowProcessor>();

            Assert.Equal(this.options, p.GraphicsOptions);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
Пример #6
0
        /// <summary>
        /// Applies a radial glow effect to an image.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="source">The image this method extends.</param>
        /// <param name="color">The color to set as the glow.</param>
        /// <param name="radius">The the radius.</param>
        /// <param name="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </param>
        /// <returns>The <see cref="Image{TPixel}"/>.</returns>
        public static Image <TPixel> Glow <TPixel>(this Image <TPixel> source, TPixel color, float radius, Rectangle rectangle)
            where TPixel : struct, IPixel <TPixel>
        {
            GlowProcessor <TPixel> processor = new GlowProcessor <TPixel>(color)
            {
                Radius = radius,
            };

            source.ApplyProcessor(processor, rectangle);
            return(source);
        }
Пример #7
0
        public void Glow_Rect_GlowProcessorWithDefaultValues()
        {
            var rect = new Rectangle(12, 123, 43, 65);

            this.operations.Glow(rect);
            GlowProcessor p = this.Verify <GlowProcessor>(rect);

            Assert.Equal(new GraphicsOptions(), p.GraphicsOptions, GraphicsOptionsComparer);
            Assert.Equal(Color.Black, p.GlowColor);
            Assert.Equal(ValueSize.PercentageOfWidth(.5f), p.Radius);
        }
Пример #8
0
        /// <summary>
        /// Applies a radial glow effect to an image.
        /// </summary>
        /// <typeparam name="TColor">The pixel format.</typeparam>
        /// <param name="source">The image this method extends.</param>
        /// <param name="color">The color to set as the glow.</param>
        /// <param name="radius">The the radius.</param>
        /// <param name="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </param>
        /// <returns>The <see cref="Image{TColor}"/>.</returns>
        public static Image <TColor> Glow <TColor>(this Image <TColor> source, TColor color, float radius, Rectangle rectangle)
            where TColor : struct, IPackedPixel, IEquatable <TColor>
        {
            GlowProcessor <TColor> processor = new GlowProcessor <TColor> {
                Radius = radius,
            };

            if (!color.Equals(default(TColor)))
            {
                processor.GlowColor = color;
            }

            return(source.Apply(rectangle, processor));
        }
Пример #9
0
        /// <summary>
        /// Applies a radial glow effect to an image.
        /// </summary>
        /// <typeparam name="TColor">The pixel format.</typeparam>
        /// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
        /// <param name="source">The image this method extends.</param>
        /// <param name="color">The color to set as the glow.</param>
        /// <param name="radius">The the radius.</param>
        /// <param name="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </param>
        /// <returns>The <see cref="Image{TColor, TPacked}"/>.</returns>
        public static Image <TColor, TPacked> Glow <TColor, TPacked>(this Image <TColor, TPacked> source, TColor color, float radius, Rectangle rectangle)
            where TColor : struct, IPackedPixel <TPacked>
            where TPacked : struct
        {
            GlowProcessor <TColor, TPacked> processor = new GlowProcessor <TColor, TPacked> {
                Radius = radius,
            };

            if (!color.Equals(default(TColor)))
            {
                processor.GlowColor = color;
            }

            return(source.Process(rectangle, processor));
        }
Пример #10
0
        /// <summary>
        /// Applies a radial glow effect to an image.
        /// </summary>
        /// <typeparam name="T">The pixel format.</typeparam>
        /// <typeparam name="TP">The packed format. <example>long, float.</example></typeparam>
        /// <param name="source">The image this method extends.</param>
        /// <param name="color">The color to set as the glow.</param>
        /// <param name="radius">The the radius.</param>
        /// <param name="rectangle">
        /// The <see cref="Rectangle"/> structure that specifies the portion of the image object to alter.
        /// </param>
        /// <param name="progressHandler">A delegate which is called as progress is made processing the image.</param>
        /// <returns>The <see cref="Image{T,TP}"/>.</returns>
        public static Image <T, TP> Glow <T, TP>(this Image <T, TP> source, T color, float radius, Rectangle rectangle, ProgressEventHandler progressHandler = null)
            where T : IPackedVector <TP>
            where TP : struct
        {
            GlowProcessor <T, TP> processor = new GlowProcessor <T, TP> {
                Radius = radius,
            };

            if (!color.Equals(default(T)))
            {
                processor.GlowColor = color;
            }

            processor.OnProgress += progressHandler;

            try
            {
                return(source.Process(rectangle, processor));
            }
            finally
            {
                processor.OnProgress -= progressHandler;
            }
        }