public override PointColor Transform(PointColor input)
        {
            input.X = input.X + (RandomNumberProvider.GetDouble() * _maxAmount);
            input.Y = input.Y + (RandomNumberProvider.GetDouble() * _maxAmount);

            return(input);
        }
        public static int GetNumTransforms()
        {
            double voteTotal = 0.0;

            foreach (int numTransform in _numTransformVotes.Keys)
            {
                voteTotal += _numTransformVotes[numTransform];
            }

            double num = RandomNumberProvider.GetDouble() * voteTotal;

            int selectedNumTransform = -1;

            foreach (int numTransform in _numTransformVotes.Keys)
            {
                if (num < _numTransformVotes[numTransform])
                {
                    selectedNumTransform = numTransform;
                    break;
                }

                num = num - _numTransformVotes[numTransform];
            }

            return(selectedNumTransform);
        }
示例#3
0
 public Circle()
 {
     _circleRadius = RandomNumberProvider.GetDouble();
     _circleColor  = DoubleColor.GetRandomColor();
     _circleColor.RandomizeAlpha();
     _circleColor.A = _circleColor.A / 2.0;
 }
        public static TransformParent GetColorTransform()
        {
            double voteTotal = 0.0;

            foreach (string transform in _colorVotes.Keys)
            {
                voteTotal += _colorVotes[transform];
            }

            double num = RandomNumberProvider.GetDouble() * voteTotal;

            string selectedTransform = null;

            foreach (string transform in _colorVotes.Keys)
            {
                if (num < _colorVotes[transform])
                {
                    selectedTransform = transform;
                    break;
                }

                num = num - _colorVotes[transform];
            }

            Type transformType = _colorTransforms[selectedTransform];

            TransformParent ret = (TransformParent)Activator.CreateInstance(transformType);

            return(ret);
        }
示例#5
0
        public static DoubleColor GetRandomColorAlpha()
        {
            DoubleColor color = GetRandomColor();

            color.A = RandomNumberProvider.GetDouble();

            return(color);
        }
        public override PointColor Transform(PointColor input)
        {
            double newAlpha = (RandomNumberProvider.GetDouble() * (_maxValue - _minValue)) + _minValue;

            input.Color = new DoubleColor(input.Color.R, input.Color.G, input.Color.B, newAlpha);

            return(input);
        }
        public FuzzAlpha()
        {
            var value1 = RandomNumberProvider.GetDouble();
            var value2 = RandomNumberProvider.GetDouble();

            _minValue = Math.Min(value1, value2);
            _maxValue = Math.Max(value1, value2);
        }
示例#8
0
        public MoveOrigin()
        {
            _moveX = RandomNumberProvider.GetDouble() - 1.0;
            _moveY = RandomNumberProvider.GetDouble() - 1.0;

            _frameX = false;
            if (RandomNumberProvider.GetDouble() < 0.5)
            {
                _frameX = true;
            }
            _frameY = false;
            if (RandomNumberProvider.GetDouble() < 0.5)
            {
                _frameY = true;
            }
        }
示例#9
0
        public static DoubleColor GetRandomColor()
        {
            if (RandomNumberProvider.GetDouble() < 0.5)
            {
                if (RandomNumberProvider.GetDouble() < 0.5)
                {
                    if (RandomNumberProvider.GetDouble() < 0.5)
                    {
                        return(DoubleColor.WhiteColor());
                    }
                    else
                    {
                        return(DoubleColor.BlackColor());
                    }
                }
                var value = RandomNumberProvider.GetDouble();
                return(new DoubleColor(value, value, value));
            }

            return(new DoubleColor(RandomNumberProvider.GetDouble(), RandomNumberProvider.GetDouble(), RandomNumberProvider.GetDouble()));
        }
        public override PointColor Transform(PointColor input)
        {
            double tempOriginX = RandomNumberProvider.GetDouble() * _originX;
            double tempOriginY = RandomNumberProvider.GetDouble() * _originY;

            double inX = input.X - 0.5;
            double inY = input.Y - 0.5;

            inX = inX % 1.0;
            inY = inY % 1.0;

            double dist = Math.Sqrt(Math.Pow(inX - tempOriginX, 2.0) + Math.Pow(inY - tempOriginY, 2.0));

            dist = dist % 1.0;

            var outColor = _gradient.GetColorAtValue(dist);

            input.Color = outColor;

            return(input);
        }
示例#11
0
        /// <summary>
        /// Generate a random gradient
        /// </summary>
        public Gradient()
        {
            // Add beginning and end points
            _segments.Add(0.0, DoubleColor.GetRandomColorAlpha());
            _segments.Add(1.0, DoubleColor.GetRandomColorAlpha());

            // Determine number of intermediate points
            var loops   = 1;
            var loopVal = RandomNumberProvider.GetDouble();

            while (loopVal < (0.75 / loops))
            {
                var newSegmentIndex = RandomNumberProvider.GetDouble();

                if (!_segments.ContainsKey(newSegmentIndex))
                {
                    _segments.Add(newSegmentIndex, DoubleColor.GetRandomColorAlpha());
                }

                loops++;
            }
        }
示例#12
0
        public Color GetColorFromPointAntiAlias(int x, int y)
        {
            // Let's grab 3 colors, 120 degrees away from the center point, and average the values.
            double xDouble = Convert.ToDouble(x);
            double yDouble = Convert.ToDouble(y);

            List <Color> colors = new List <Color>();

            for (int i = 0; i < NUMBER_OF_AA_POINTS; i++)
            {
                PointColor pc = new PointColor();

                pc.X = xDouble + (RandomNumberProvider.GetDouble() - 0.5);
                pc.Y = yDouble + (RandomNumberProvider.GetDouble() - 0.5);

                Color c = GetColorFromPointColor(pc);

                colors.Add(c);
            }

            int aTotal = 0;
            int rTotal = 0;
            int gTotal = 0;
            int bTotal = 0;

            for (int j = 0; j < NUMBER_OF_AA_POINTS; j++)
            {
                aTotal += colors[j].A;
                rTotal += colors[j].R;
                gTotal += colors[j].G;
                bTotal += colors[j].B;
            }

            Color result = Color.FromArgb(aTotal / NUMBER_OF_AA_POINTS, rTotal / NUMBER_OF_AA_POINTS, gTotal / NUMBER_OF_AA_POINTS, bTotal / NUMBER_OF_AA_POINTS);

            return(result);
        }
示例#13
0
 public Rotate()
 {
     _amount = RandomNumberProvider.GetDouble() * (2 * Math.PI);
 }
示例#14
0
 public AlterRed()
 {
     _amount = (RandomNumberProvider.GetDouble() * 1.5) + 0.5;
 }
示例#15
0
 public Fisheye()
 {
     _amount = RandomNumberProvider.GetDouble() * (2 * Math.PI);
 }
示例#16
0
 public BulgeX()
 {
     _amount = RandomNumberProvider.GetDouble() * 2.0;
 }
示例#17
0
 public GreyscaleX()
 {
     _alpha = RandomNumberProvider.GetDouble();
 }
示例#18
0
        public ZigZagY()
        {
            int numberOfZigs = RandomNumberProvider.GetInt(100);

            _zigAmount = 1.0 / numberOfZigs;
        }
 public ZoomOut()
 {
     _amount = RandomNumberProvider.GetDouble() * 10;
 }
示例#20
0
 public GradientCircle()
 {
     _gradient = new Gradient();
     _originX  = RandomNumberProvider.GetDouble();
     _originY  = RandomNumberProvider.GetDouble();
 }
 public Fuzz()
 {
     _maxAmount = RandomNumberProvider.GetDouble() * 0.05;
 }
示例#22
0
 public Swirl()
 {
     _amountMultiplier = RandomNumberProvider.GetDouble() * (2 * Math.PI);
 }
示例#23
0
 public TiltX()
 {
     _amount = RandomNumberProvider.GetDouble();
 }
示例#24
0
 public VerticalStripe()
 {
     _stripeWidth   = RandomNumberProvider.GetDouble() * 0.25;
     _stripeColor   = DoubleColor.GetRandomColorAlpha();
     _stripeColor.A = _stripeColor.A / 2.0;
 }
 public void RandomizeAlpha()
 {
     A = RandomNumberProvider.GetDouble();
 }