/*______________________________________________________Реализация_абстрактных_методов_класса_________________________________________________________*/
        #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 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 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;
 }
Esempio n. 5
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);
        }
Esempio n. 6
0
        /*__________________________________________________________________Реализация_абстрактных_методов_______________________________________________________*/
        #region Realization abstract methods
        public override Bitmap GetDrawnBitmap(FractalAssociationParametrs FAP, object Extra = null)
        {
            int        width = FAP.Width, height = FAP.Height, x, y;
            Bitmap     Result     = new Bitmap(width, height, PixelFormat.Format24bppRgb);
            BitmapData ResultData = Result.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);

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

            unsafe
            {
                int * pointer = (int *)ResultData.Scan0;
                int   parameter = -1;
                byte *blue = (byte *)&parameter, green = blue + 1, red = green + 1;
                for (y = 0; y < height; y++)
                {
                    for (x = 0; x < width; x++)
                    {
                        iter = (iter_matrix[x][y] * Muller);
                        *red   = (255 - iter / Red) >= 0D ? (byte)(255 - iter / Red) : (byte)0;
                        *green = (255 - iter / Green) >= 0D ? (byte)(255 - iter / Green) : (byte)0;
                        *blue  = (255 - iter / Blue) >= 0D ? (byte)(255 - iter / Blue) : (byte)0;
                        *(pointer++) = parameter;
                    }
                }
            }
            Result.UnlockBits(ResultData);

            /*for(x=0;x<width;x++)
             * {
             *  for(y=0;y<height;y++)
             *  {
             *      iter = (ulong)(iter_matrix[x][y]*Muller);
             *      Result.SetPixel(x, y, Color.FromArgb((255 - iter / Red) >= 0 ? (int)(255 - iter / Red) : 0,
             *                                           (255 - iter / Green) >= 0 ? (int)(255 - iter / Green) : 0,
             *                                           (255 - iter / Blue) >= 0 ? (int)(255 - iter / Blue) : 0));
             *  }
             * }*/
            return(Result);
        }
Esempio n. 7
0
        public override BigInteger[] FindFirstInserts(BigInteger Width, BigInteger Height, ulong MinIters)
        {
            int        width  = (int)Width;
            int        height = (int)Height;
            _2DFractal temp   = (_2DFractal)this.GetClone();
            FractalAssociationParametrs fap = temp.CreateFractal(width, height);

            BigInteger[] Result = new BigInteger[4];
            bool         con    = true;

            ulong[][] itermatrix = fap.Get2DOriginalIterationsMatrix();
            for (int x = 0; x < width && con; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    if (itermatrix[x][y] >= MinIters)
                    {
                        con       = false;
                        Result[0] = x;
                        break;
                    }
                }
            }
            if (con)
            {
                Result[0] = -1;
            }
            con = true;
            for (int x = width - 1; x >= 0 && con; x--)
            {
                for (int y = 0; y < height; y++)
                {
                    if (itermatrix[x][y] >= MinIters)
                    {
                        con       = false;
                        Result[1] = x;
                        break;
                    }
                }
            }
            if (con)
            {
                Result[1] = -1;
            }
            con = true;
            for (int y = height - 1; y >= 0 && con; y--)
            {
                for (int x = 0; x < width; x++)
                {
                    if (itermatrix[x][y] >= MinIters)
                    {
                        con       = false;
                        Result[3] = y;
                        break;
                    }
                }
            }
            if (con)
            {
                Result[3] = -1;
            }
            con = true;
            for (int y = 0; y < height && con; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (itermatrix[x][y] >= MinIters)
                    {
                        con       = false;
                        Result[2] = y;
                        break;
                    }
                }
            }
            if (con)
            {
                Result[2] = -1;
            }
            con = true;
            return(Result);
        }
Esempio n. 8
0
 public object Optimize(FractalAssociationParametrs FAP, object Extra = null)
 {
     return(FAP.Get2DOriginalIterationsMatrix());
 }
 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 object Optimize(FractalAssociationParametrs FAP, object Extra = null)
 {
     return FAP.Get2DOriginalIterationsMatrix();
 }
Esempio n. 11
0
 object IColorReturnable.Optimize(FractalAssociationParametrs FAP, object Extra)
 {
     return(FAP.Get2DOriginalIterationsMatrix());
 }