Exemple #1
0
        internal void Mutate(DnaDrawing drawing, JobInfo info)
        {
            if (info.WillMutate(info.Settings.ColorMutationRate))
            {
                Red = info.GetRandomNumber(0, 255);

                drawing.SetDirty();
            }

            if (info.WillMutate(info.Settings.ColorMutationRate))
            {
                Green = info.GetRandomNumber(0, 255);

                drawing.SetDirty();
            }
            if (info.WillMutate(info.Settings.ColorMutationRate))
            {
                Blue = info.GetRandomNumber(0, 255);

                drawing.SetDirty();
            }

            if (info.WillMutate(info.Settings.ColorMutationRate))
            {
                Alpha = info.GetRandomNumber(info.Settings.AlphaRangeMin, info.Settings.AlphaRangeMax);

                drawing.SetDirty();
            }
        }
Exemple #2
0
        public void Mutate(JobInfo info)
        {
            IsDirty = false;
            while (!IsDirty)
            {
                if (!info.Settings.MuteAddPolygonNew)
                    if (info.WillMutate(info.Settings.AddPolygonMutationRate))
                        AddPolygon(info);

                if (!info.Settings.MuteAddPolygonClone)
                    if (info.WillMutate(info.Settings.AddPolygonCloneMutationRate))
                        AddPolygonClone(info);

                if (!info.Settings.MuteRemovePolygon)
                    if (info.WillMutate(info.Settings.RemovePolygonMutationRate))
                        RemovePolygon(info);

                if (!info.Settings.MuteMovePolygon)
                    if (info.WillMutate(info.Settings.MovePolygonMutationRate))
                        MovePolygon(info);

                foreach (DnaPolygon polygon in Polygons)
                    polygon.Mutate(this, info);
            }
        }
Exemple #3
0
        internal void Mutate(JobInfo info)
        {
            IsDirty = false;
            while (!IsDirty)
            {
                if (!info.Settings.MuteAddPolygonNew)
                    if (info.WillMutate(info.Settings.AddPolygonMutationRate))
                        AddPolygon(info);

                if (!info.Settings.MuteAddPolygonClone)
                    if (info.WillMutate(info.Settings.AddPolygonCloneMutationRate))
                        AddPolygonClone(info);

                if (!info.Settings.MuteRemovePolygon)
                    if (info.WillMutate(info.Settings.RemovePolygonMutationRate))
                        RemovePolygon(info);

                if (!info.Settings.MuteMovePolygon)
                    if (info.WillMutate(info.Settings.MovePolygonMutationRate))
                        MovePolygon(info);

                unchecked
                {
                    for (int i = 0; i < Polygons.Count; i++)
                    {
                        DnaPolygon polygon = Polygons[i];
                        polygon.Mutate(this, info);
                    }
                }
            }
        }
Exemple #4
0
        internal void Mutate(DnaDrawing drawing, JobInfo info)
        {
            if (!info.Settings.MuteMovePointMax)
            {
                if (info.WillMutate(info.Settings.MovePointMaxMutationRate))
                {
                    X = info.GetRandomNumber(0, info.SourceImage.Width);
                    Y = info.GetRandomNumber(0, info.SourceImage.Height);
                    drawing.SetDirty();
                }
            }

            if (!info.Settings.MuteMovePointMid)
            {
                if (info.WillMutate(info.Settings.MovePointMidMutationRate))
                {

                    X = X
                        .Randomize(info ,- info.Settings.MovePointRangeMid, info.Settings.MovePointRangeMid)
                        .Max(0)
                        .Min(info.SourceImage.Width);

                    Y = Y
                        .Randomize(info, -info.Settings.MovePointRangeMid, info.Settings.MovePointRangeMid)
                        .Max(0)
                        .Min(info.SourceImage.Height);

                    drawing.SetDirty();
                }
            }

            if (!info.Settings.MuteMovePointMin)
            {
                if (info.WillMutate(info.Settings.MovePointMinMutationRate))
                {
                    X = X
                        .Randomize(info, -info.Settings.MovePointRangeMin, info.Settings.MovePointRangeMin)
                        .Max(0)
                        .Min(info.SourceImage.Width);

                    Y = Y
                        .Randomize(info, -info.Settings.MovePointRangeMin, info.Settings.MovePointRangeMin)
                        .Max(0)
                        .Min(info.SourceImage.Height);

                    drawing.SetDirty();
                }
           }
        }
Exemple #5
0
        internal void Mutate(DnaDrawing drawing, JobInfo info)
        {
            if (info.WillMutate(info.Settings.AddPointMutationRate))
                AddPoint(drawing, info);

            if (info.WillMutate(info.Settings.RemovePointMutationRate))
                RemovePoint(drawing, info);

            Brush.Mutate(drawing, info);

            unchecked
            {
                for (int i = 0; i < Points.Count;i++)
                {
                    var point = Points[i];
                    point.Mutate(drawing, info);
                }
            }
        }
Exemple #6
0
        public void Mutate(DnaDrawing drawing, JobInfo info)
        {
            if (info.WillMutate(info.Settings.AddPointMutationRate))
                AddPoint(drawing, info);

            if (info.WillMutate(info.Settings.RemovePointMutationRate))
                RemovePoint(drawing, info);

            if (info.WillMutate(info.Settings.FlipSplinesMutationRate))
                FlipSplines(drawing, info);

            if (info.WillMutate(info.Settings.FlipFilledMutationRate))
                FlipFilled(drawing, info);

            if (info.WillMutate(info.Settings.FlipFilledMutationRate))
                Width = info.GetRandomNumber(1, 8);

            Brush.Mutate(drawing, info);
            foreach(var point in Points)
            {
                point.Mutate(drawing, info);
            }

            //IsComplex = false;// checkComplex();
        }