public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP,object Extra=null)
 {
     if (FAP == null) throw new ArgumentNullException("FAP не содержить значения!");
     if (!IsCompatible(FAP)) throw new ArgumentException("Переданный FractalAssociationParameters не совместим с данной цветовой моделью, используйте другую цветовую модель!");
     if (_color_array == null) throw new InvalidOperationException("Требуеться задать массив цветов (используйте CreateRandColorArray).");
     if (_color_array.Length < 1) throw new InvalidOperationException("Нельзя использовать пустой массив цветов (используйте CreateRandColorArray).");
     int width = FAP.Width, height = FAP.Height;
     Bitmap Result = new Bitmap(width, height);
     Graphics g = Graphics.FromImage(Result);
     g.FillRectangle(Brushes.Black, 0, 0, width, height);
     g.Dispose();
     FractalCloudPoint[][][] fcp_matrix = ((FractalCloudPoints)FAP.GetUniqueParameter()).fractalCloudPoint;
     int abciss_step_size = width / fcp_matrix.Length + (width % fcp_matrix.Length != 0 ? 1 : 0);
     int ordinate_step_size = height / fcp_matrix[0].Length + (height % fcp_matrix[0].Length != 0 ? 1 : 0);
     Color using_color;
     int TraceLimit=((FractalCloudPoints)FAP.GetUniqueParameter()).MaxAmmountAtTrace;
     for (int _x = 0; _x < fcp_matrix.Length; _x++)
     {
         for (int _y = 0; _y < fcp_matrix[0].Length; _y++)
         {
             if (fcp_matrix[_x][_y].Length < TraceLimit) continue;
             using_color = _color_array[(_x + _y) % _color_array.Length];
             for (int i = 0; i < fcp_matrix[_x][_y].Length; i++)
             {
                 if (fcp_matrix[_x][_y][i].AbcissLocation < 0 || fcp_matrix[_x][_y][i].OrdinateLocation < 0 || fcp_matrix[_x][_y][i].AbcissLocation >= width || fcp_matrix[_x][_y][i].OrdinateLocation >= height) continue;
                 Result.SetPixel(fcp_matrix[_x][_y][i].AbcissLocation, fcp_matrix[_x][_y][i].OrdinateLocation, using_color);
             }
         }
     }
     return Result;
 }
        /*_________________________________________________________Реализация_асбтрактных_методов_______________________________________________________*/
        #region Realization of abstract methods
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            if (FAP == null)
            {
                throw new ArgumentNullException("FAP не содержить значения!");
            }
            if (!IsCompatible(FAP))
            {
                throw new ArgumentException("Переданный FractalAssociationParameters не совместим с данной цветовой моделью, используйте другую цветовую модель!");
            }
            if (_color_array == null)
            {
                throw new InvalidOperationException("Требуеться задать массив цветов (используйте CreateRandColorArray).");
            }
            if (_color_array.Length < 1)
            {
                throw new InvalidOperationException("Нельзя использовать пустой массив цветов (используйте CreateRandColorArray).");
            }
            int      width = FAP.Width, height = FAP.Height;
            Bitmap   Result = new Bitmap(width, height);
            Graphics g      = Graphics.FromImage(Result);

            g.FillRectangle(Brushes.Black, 0, 0, width, height);
            g.Dispose();
            FractalCloudPoint[][][] fcp_matrix = ((FractalCloudPoints)FAP.GetUniqueParameter()).fractalCloudPoint;
            int   abciss_step_size             = width / fcp_matrix.Length + (width % fcp_matrix.Length != 0 ? 1 : 0);
            int   ordinate_step_size           = height / fcp_matrix[0].Length + (height % fcp_matrix[0].Length != 0 ? 1 : 0);
            Color using_color;
            int   TraceLimit = ((FractalCloudPoints)FAP.GetUniqueParameter()).MaxAmmountAtTrace;

            for (int _x = 0; _x < fcp_matrix.Length; _x++)
            {
                for (int _y = 0; _y < fcp_matrix[0].Length; _y++)
                {
                    if (fcp_matrix[_x][_y].Length < TraceLimit)
                    {
                        continue;
                    }
                    using_color = _color_array[(_x + _y) % _color_array.Length];
                    for (int i = 0; i < fcp_matrix[_x][_y].Length; i++)
                    {
                        if (fcp_matrix[_x][_y][i].AbcissLocation < 0 || fcp_matrix[_x][_y][i].OrdinateLocation < 0 || fcp_matrix[_x][_y][i].AbcissLocation >= width || fcp_matrix[_x][_y][i].OrdinateLocation >= height)
                        {
                            continue;
                        }
                        Result.SetPixel(fcp_matrix[_x][_y][i].AbcissLocation, fcp_matrix[_x][_y][i].OrdinateLocation, using_color);
                    }
                }
            }
            return(Result);
        }
Ejemplo n.º 3
0
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            int width = FAP.Width, height = FAP.Height;
            Bitmap bmp = new Bitmap(width, height);
            double[][] dm = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
            Color cl = Color.Black; ;
            ulong[][] iter_matrix=FAP.Get2DOriginalIterationsMatrix();
            ulong iter;
            int deg;
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    iter = (ulong)(iter_matrix[x][y]*0.8);
                    cl =Color.FromArgb((255 - iter / 1.85) >= 0 ? (int)(255 - iter / 1.85) : 0,
                                                         (255 - iter / 1.4) >= 0 ? (int)(255 - iter / 1.4) : 0,
                                                         (255 - iter / 1.8) >= 0 ? (int)(255 - iter / 1.8) : 0);

                    bmp.SetPixel(x, y,cl);
                    if (iter < 85) {
                        deg = (int)((dm[x][y] / Math.PI) * 180);
                        if (deg < 0) deg = 360 + deg;
                        if (deg < 181) cl = Color.FromArgb(255 - 255 * deg / 180,255- 255 * deg / 180, 255 -255 * deg / 180);
                        else
                        {
                            deg -= 180;
                            cl = Color.FromArgb(255 * deg / 180, 255 * deg / 180,  255 * deg / 180);
                        }

                    bmp.SetPixel(x, y,cl);}

                }
            }
            return bmp;
        }
 public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP,object Extra=null)
 {
     if (FAP == null) throw new ArgumentNullException("FAP не содержить значения!");
     if (!IsCompatible(FAP)) throw new ArgumentException("Переданный FractalAssociationParameters не совместим с данной цветовой моделью, используйте другую цветовую модель!");
     if (FAP.FractalType != FractalType._2DStandartIterationTypeWithCloudPoints) throw new ArgumentException("Данный фрактал не имеет трёхмерную матрицу FractalCloudPoint!");
     int width=FAP.Width, height=FAP.Height;
     Bitmap Result = new Bitmap(width, height);
     Graphics g = Graphics.FromImage(Result);
     g.FillRectangle(Brushes.Black, 0, 0, width, height);
     g.Dispose();
     FractalCloudPoints fcps = (FractalCloudPoints)FAP.GetUniqueParameter();
     FractalCloudPoint[][][] fcp_matrix = (FractalCloudPoint[][][])fcps.fractalCloudPoint;
     Color using_color;
     Random rand = new Random();
     for(int _x=0;_x<fcp_matrix.Length;_x++)
     {
         for(int _y=0;_y<fcp_matrix[0].Length;_y++)
         {
             if (fcp_matrix[_x][_y].Length <fcps.MaxAmmountAtTrace) continue;
             using_color = Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256));
             for(int i=0;i<fcp_matrix[_x][_y].Length;i++)
             {
                 if (fcp_matrix[_x][_y][i].AbcissLocation < 0 || fcp_matrix[_x][_y][i].OrdinateLocation < 0 || fcp_matrix[_x][_y][i].AbcissLocation >=width|| fcp_matrix[_x][_y][i].OrdinateLocation >=height) continue;
                 Result.SetPixel(fcp_matrix[_x][_y][i].AbcissLocation, fcp_matrix[_x][_y][i].OrdinateLocation, using_color);
             }
         }
     }
     return Result;
 }
        /*______________________________________________________Реализация_абстрактных_методов_класса_________________________________________________________*/
        #region Realization of abstract methods of class
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            int    width = FAP.Width, height = FAP.Height;
            Bitmap Result = new Bitmap(width, height);
            ulong  iter, grad_void_iters = _gradient_void_iterations_count + _gradient_iterations_count;

            ulong[][]  iter_matrix   = FAP.Get2DOriginalIterationsMatrix();
            double[][] Radian_matrix = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
            int        deg;
            Color      color;

            _optimizer = _using_mod.Optimize(FAP);
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    deg  = ((int)((Radian_matrix[x][y] / Math.PI) * 180D) + 360) % 360;
                    iter = iter_matrix[x][y];
                    if (iter <= _gradient_iterations_count)
                    {
                        color = cycle_get_gradient_color(_percents, _color, deg);
                    }
                    else if (iter <= grad_void_iters)
                    {
                        color = _gradient_void;
                    }
                    else
                    {
                        color = _using_mod.GetColor(_optimizer, x, y);
                    }
                    Result.SetPixel(x, y, color);
                }
            }
            return(Result);
        }
 public override bool IsCompatible(FractalAssociationParametrs FAP)
 {
     if (FAP == null)
     {
         throw new ArgumentNullException("Нельзя передавать значение null в данный метод!");
     }
     return(FAP.Is2D && (FAP.GetUniqueParameter() is FractalCloudPoints));
 }
        public override Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            check_all_functions();
            int    width = FAP.Width, height = FAP.Height;
            Bitmap Result = new Bitmap(width, height);

            ulong[][] Iter_matrix = FAP.Get2DOriginalIterationsMatrix();
            //double maxiters=
            double[][] Ratio_matrix  = FAP.Get2DRatioMatrix();
            double[][] Radian_Matrix = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
            BitmapData ResultData    = Result.LockBits(new Rectangle(new Point(), Result.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);

            unsafe
            {
                double[] arg = new double[8];
                int      Parameter = -1;
                byte *   blue = (byte *)&Parameter, green = blue + 1, red = green + 1;
                int *    ptr = (int *)ResultData.Scan0.ToPointer();
                int      x, y;
                double * iter, ratio, radian, maxofiter, xloc, yloc;
                fixed(double *iterator = arg)
                {
                    iter      = iterator;
                    ratio     = iter + 1;
                    radian    = ratio + 1;
                    maxofiter = radian + 1;
                    xloc      = maxofiter + 1;
                    yloc      = xloc + 1;
                    arg[7]    = height;
                    arg[6]    = width;
                    *maxofiter = FAP.ItersCount;
                    for (y = 0; y < height; ++y)
                    {
                        for (x = 0; x < width; ++x)
                        {
                            *iter   = Iter_matrix[x][y];
                            *ratio  = Ratio_matrix[x][y];
                            *radian = Radian_Matrix[x][y];
                            *xloc   = x;
                            *yloc   = y;
                            *red    = (byte)(_m_red_func(arg) % 256D);
                            *green  = (byte)(_m_green_func(arg) % 256D);
                            *blue   = (byte)(_m_blue_func(arg) % 256D);
                            *(ptr++) = Parameter;
                        }
                    }
                }
            }
            Result.UnlockBits(ResultData);
            return(Result);
        }
 public override Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
 {
     check_all_functions();
     int width=FAP.Width, height=FAP.Height;
     Bitmap Result = new Bitmap(width, height);
     ulong[][] Iter_matrix = FAP.Get2DOriginalIterationsMatrix();
     //double maxiters=
     double[][] Ratio_matrix = FAP.Get2DRatioMatrix();
     double[][] Radian_Matrix = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
     BitmapData ResultData=Result.LockBits(new Rectangle(new Point(),Result.Size),ImageLockMode.WriteOnly,PixelFormat.Format32bppArgb);
     unsafe
     {
         double[] arg = new double[8];
         int Parameter=-1;
         byte* blue = (byte*)&Parameter, green = blue + 1, red = green + 1;
         int* ptr = (int*)ResultData.Scan0.ToPointer();
         int x, y;
         double* iter, ratio, radian,maxofiter,xloc,yloc;
         fixed(double* iterator = arg)
         {
             iter = iterator;
             ratio = iter + 1;
             radian = ratio + 1;
             maxofiter = radian + 1;
             xloc = maxofiter + 1;
             yloc = xloc + 1;
             arg[7] = height;
             arg[6] = width;
             *maxofiter = FAP.ItersCount;
             for (y = 0; y < height; ++y)
             {
                 for (x = 0; x < width; ++x)
                 {
                     *iter = Iter_matrix[x][y];
                     *ratio = Ratio_matrix[x][y];
                     *radian = Radian_Matrix[x][y];
                     *xloc = x;
                     *yloc = y;
                     *red = (byte)(_m_red_func(arg)%256D);
                     *green = (byte)(_m_green_func(arg) % 256D);
                     *blue = (byte)(_m_blue_func(arg) % 256D);
                     *(ptr++) = Parameter;
                 }
             }
         }
     }
     Result.UnlockBits(ResultData);
     return Result;
 }
 public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
 {
     int width = FAP.Width, height = FAP.Height;
     Bitmap bmp = new Bitmap(width, height);
     double[][] dm = (double[][])FAP.Get2DRatioMatrix();
     double[][][] trio_matrix = (double[][][])FAP.GetUniqueParameter(typeof(double[][][]));
     for (int x = 0; x < width; x++)
     {
         for (int y = 0; y < height; y++)
         {
             bmp.SetPixel(x, y, Color.FromArgb(get_cos_color(trio_matrix[x][y][0],_red, _red_scale), get_cos_color(trio_matrix[x][y][1], _green, _green_scale), get_cos_color(trio_matrix[x][y][2], _blue, _blue_scale)));
         }
     }
     return bmp;
 }
Ejemplo n.º 10
0
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            int    width = FAP.Width, height = FAP.Height;
            Bitmap bmp = new Bitmap(width, height);

            double[][]   dm          = (double[][])FAP.Get2DRatioMatrix();
            double[][][] trio_matrix = (double[][][])FAP.GetUniqueParameter(typeof(double[][][]));
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    bmp.SetPixel(x, y, Color.FromArgb(get_cos_color(trio_matrix[x][y][0], _red, _red_scale), get_cos_color(trio_matrix[x][y][1], _green, _green_scale), get_cos_color(trio_matrix[x][y][2], _blue, _blue_scale)));
                }
            }
            return(bmp);
        }
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            if (FAP == null)
            {
                throw new ArgumentNullException("FAP не содержить значения!");
            }
            if (!IsCompatible(FAP))
            {
                throw new ArgumentException("Переданный FractalAssociationParameters не совместим с данной цветовой моделью, используйте другую цветовую модель!");
            }
            if (FAP.FractalType != FractalType._2DStandartIterationTypeWithCloudPoints)
            {
                throw new ArgumentException("Данный фрактал не имеет трёхмерную матрицу FractalCloudPoint!");
            }
            int      width = FAP.Width, height = FAP.Height;
            Bitmap   Result = new Bitmap(width, height);
            Graphics g      = Graphics.FromImage(Result);

            g.FillRectangle(Brushes.Black, 0, 0, width, height);
            g.Dispose();
            FractalCloudPoints fcps = (FractalCloudPoints)FAP.GetUniqueParameter();

            FractalCloudPoint[][][] fcp_matrix = (FractalCloudPoint[][][])fcps.fractalCloudPoint;
            Color  using_color;
            Random rand = new Random();

            for (int _x = 0; _x < fcp_matrix.Length; _x++)
            {
                for (int _y = 0; _y < fcp_matrix[0].Length; _y++)
                {
                    if (fcp_matrix[_x][_y].Length < fcps.MaxAmmountAtTrace)
                    {
                        continue;
                    }
                    using_color = Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256));
                    for (int i = 0; i < fcp_matrix[_x][_y].Length; i++)
                    {
                        if (fcp_matrix[_x][_y][i].AbcissLocation < 0 || fcp_matrix[_x][_y][i].OrdinateLocation < 0 || fcp_matrix[_x][_y][i].AbcissLocation >= width || fcp_matrix[_x][_y][i].OrdinateLocation >= height)
                        {
                            continue;
                        }
                        Result.SetPixel(fcp_matrix[_x][_y][i].AbcissLocation, fcp_matrix[_x][_y][i].OrdinateLocation, using_color);
                    }
                }
            }
            return(Result);
        }
Ejemplo n.º 12
0
        public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            int    width = FAP.Width, height = FAP.Height;
            Bitmap bmp = new Bitmap(width, height);

            double[][] dm = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
            Color      cl = Color.Black;;

            ulong[][] iter_matrix = FAP.Get2DOriginalIterationsMatrix();
            ulong     iter;
            int       deg;

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    iter = (ulong)(iter_matrix[x][y] * 0.8);
                    cl   = Color.FromArgb((255 - iter / 1.85) >= 0 ? (int)(255 - iter / 1.85) : 0,
                                          (255 - iter / 1.4) >= 0 ? (int)(255 - iter / 1.4) : 0,
                                          (255 - iter / 1.8) >= 0 ? (int)(255 - iter / 1.8) : 0);

                    bmp.SetPixel(x, y, cl);
                    if (iter < 85)
                    {
                        deg = (int)((dm[x][y] / Math.PI) * 180);
                        if (deg < 0)
                        {
                            deg = 360 + deg;
                        }
                        if (deg < 181)
                        {
                            cl = Color.FromArgb(255 - 255 * deg / 180, 255 - 255 * deg / 180, 255 - 255 * deg / 180);
                        }
                        else
                        {
                            deg -= 180;
                            cl   = Color.FromArgb(255 * deg / 180, 255 * deg / 180, 255 * deg / 180);
                        }

                        bmp.SetPixel(x, y, cl);
                    }
                }
            }
            return(bmp);
        }
 public override bool IsCompatible(FractalAssociationParametrs FAP)
 {
     if (FAP == null) throw new ArgumentNullException("Нельзя передавать значение null в данный метод!");
     return FAP.Is2D && (FAP.GetUniqueParameter() is FractalCloudPoints);
 }
 public override System.Drawing.Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
 {
     int width = FAP.Width, height = FAP.Height;
     Bitmap Result = new Bitmap(width, height);
     ulong iter, grad_void_iters = _gradient_void_iterations_count+_gradient_iterations_count;
     ulong[][] iter_matrix = FAP.Get2DOriginalIterationsMatrix();
     double[][] Radian_matrix = ((RadianMatrix)FAP.GetUniqueParameter(typeof(RadianMatrix))).Matrix;
     int deg;
     Color color;
     _optimizer = _using_mod.Optimize(FAP);
     for(int x=0;x<width;x++)
     {
         for(int y=0;y<height;y++)
         {
             deg=((int)((Radian_matrix[x][y]/Math.PI)*180D)+360)%360;
             iter=iter_matrix[x][y];
             if (iter <= _gradient_iterations_count) color = cycle_get_gradient_color(_percents, _color, deg);
             else if (iter <= grad_void_iters) color = _gradient_void;
             else color = _using_mod.GetColor(_optimizer, x, y);
             Result.SetPixel(x, y, color);
         }
     }
     return Result;
 }
 public override bool IsCompatible(FractalAssociationParametrs FAP)
 {
     return FAP.GetUniqueParameter(typeof(RadianMatrix)) != null && FAP.Get2DRatioMatrix() != null;
 }
 public override bool IsCompatible(FractalAssociationParametrs FAP)
 {
     return FAP.Is2D && FAP.GetUniqueParameter(typeof(double[][][])) != null;
 }
 public override bool IsCompatible(FractalAssociationParametrs FAP)
 {
     return(FAP.Is2D && FAP.GetUniqueParameter(typeof(RadianMatrix)) != null);
 }