public override void Render(PixelBuffer buffer, MandelbrotSet set, BandMap bandMap, int maxCount)
        {
            this.sizex = buffer.SizeX;
            this.sizey = buffer.SizeY;
            this.maxCount = maxCount;
            this.bandMap = bandMap;
            this.buffer = buffer;
            this.InitializeCoordinateMap(sizex, sizey, set);
            this.NumberOfContours = 0;

            for (int i = 0; i < sizex; i++)
            {
                // Keep track of the last band and how many pixels into that band we are
                // Start crawling after we see a few pixels of the same band
                int lastBand = 0;
                int numberOfPointsFoundInBand = 0;
                int startOfBand = 0;
                bool calculated = false;
                for (int j = 0; j < sizey; j++)
                {
                    int band = GetOrCalculateBand(i, j, out calculated);
                    System.Diagnostics.Debug.Assert(band != 0); // This should only be returned for points out of range, which should be none
                    if (calculated && (band == lastBand))
                    {
                        numberOfPointsFoundInBand++;
                    }
                    else
                    {
                        if (band != lastBand)
                        {
                            startOfBand = j;
                            lastBand = band;
                        }
                        numberOfPointsFoundInBand = 1;
                    }
                    // If we are 8 or more pixels into the band, start crawling
                    if (numberOfPointsFoundInBand > 8)
                    {
                        if (this.Crawl(i, startOfBand, band))
                        {
                            this.NumberOfContours = this.NumberOfContours + 1;
                            this.FillCrawl(i, startOfBand, band);
                            this.DumpBits();
                        }
                        this.ClearSavedBits();

                        numberOfPointsFoundInBand = 0;
                    }
                }
            }
        }
Exemple #2
0
        public override void Render(PixelBuffer buffer, MandelbrotSet set, BandMap bandMap, int maxCount)
        {
            this.InitializeCoordinateMap(buffer.SizeX, buffer.SizeY, set);

            DoubleComplexNumber temp = new DoubleComplexNumber(0.0, 0.0);
            for (int i = 0; i < buffer.SizeX; i++)
            {
                temp.X = this.XCoordinates[i];
                for (int j = 0; j < buffer.SizeY; j++)
                {
                    temp.Y = this.YCoordinates[j];
                    int count = temp.CalculateCount(maxCount);
                    this.SetBand(buffer, bandMap, i, j, count);
                }
            }
        }
Exemple #3
0
 public abstract void Render(PixelBuffer buffer, MandelbrotSet set, BandMap bandMap, int maxCount);
Exemple #4
0
 protected virtual void SetBand(PixelBuffer buffer, BandMap bandMap, int x, int y, int count)
 {
     int band = bandMap.Map(count);
     buffer.SetValue(x, y, band);
 }