Click here to Skip to main content
Click here to Skip to main content

Fractal Photographer

By , 18 Oct 2012
 

Please note

This article is an entry in our AppInnovation Contest. Articles in this sub-section are not required to be full articles so care should be taken when voting.

 

Introduction 

Have you ever seen the Mandelbrot Set? If not, then this app will allow you to explore this mathematical object and discover some of the most mind-blowing patterns of nature. There is no other known shape as diverse and as mesmerizing as the Mandelbrot.

After you've seen this, you will not resist the temptation to use the 'pictures' you'll take as your wallpaper.

This program is designed to provide as fun of an experience as zooming into a fractal can be. Mandelbrot Renderers can be written in 20 lines of code. This app is far more extensive and feel more responsive, more natural. The algorithms are optimized to save up to 75% in rendering time. A variety of color schemes can be easily previewed and chosen from to provide enjoyable customization.

This app is currently available in the Windows Store. 

Features 

  • Support for a variety of different input devices. Zooming can be done by pressing a button, double-clicking, using the scroll-wheel, using touch, etc.
  • Multitouch support, including Pinch-Zoom-ROTATE. You don't see that often.
  • Amazing color schemes included. We've designed a wide selection for you, so you can just open up the Color Scheme Picker and they will all be there. Each color scheme generates a thumbnail that previews what the image would look like on those colors, so you can choose it in one glance.
  • Save and share your best spots via our implementation of the Windows 8 Share Contract.
  • Optimized algorithm rerenders only the relevant areas. Your computer will not waste time rendering a 200x200 black square.

Demonstration of the color scheme picker. 

Background 

This app is a larger version of Mandelbrot Photographer published on the Windows Phone. Fractals is our passion, they are a marvel of mathematics.

Points of Interest

The app makes heavy use of multi-threading, which needs to be paused and restarted whenever the use navigates. Below is a sample of the code, showing how each row is rendered. Rendering is done at different magnification levels. It starts with rendering large chunks and then goes into finer details. That allows a better previewing of the image while it is rendering.

// Calculates the iteration count of all pixels row by row as long as there are rows to render.
private void RenderRow(IAsyncAction source)
{
    int row = GetCurrentRow();

    // As long as there is still work to be done.
    while (row != -1)
    {
        // Render all pixels in that row at a particular magnification.
        for (int x = 0; x < RenderWidthInPixels; x += _currentSeperation)
        {
            // Check if thread was cancelled.
            if (source.Status == AsyncStatus.Canceled)
                return;

            // Avoid repeating rendering.
            if (_pixelsIterations[x, row] == UNRENDERED)
            {
                // Get iteration count for that pixel
                _pixelsIterations[x, row] = RenderPixel(x, row);
                // Associate color to that pixel
                DrawPixel(x, row, _currentSeperation);

                Interlocked.Increment(ref _renderedCount);
            }
        }

        // Get the next row to render from the rendering queue
        row = GetCurrentRow();
    }
}

So in Conclusion... 

History 

September 20, 2012 : App published to the Windows Store.

October 4, 2012 : First update, included a purchasable color scheme pack. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Advecticity
Student
Canada Canada
Member
Microsoft Student Partner at University of Waterloo

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 2memberAndy Bantly1 Apr '13 - 16:00 
QuestionAlternative fractal implementation in C++memberAndy Bantly1 Apr '13 - 15:53 
AnswerRe: Alternative fractal implementation in C++memberAdvecticity1 Apr '13 - 17:05 
GeneralRe: Alternative fractal implementation in C++memberAndy Bantly3 Apr '13 - 6:56 
GeneralRe: Alternative fractal implementation in C++memberAdvecticity3 Apr '13 - 9:48 
GeneralRe: Alternative fractal implementation in C++memberAndy Bantly3 Apr '13 - 10:34 
GeneralMy vote of 5memberRenju Vinod19 Oct '12 - 1:31 
QuestionWhich flavour?adminChris Maunder18 Oct '12 - 15:13 
AnswerRe: Which flavour?memberAdvecticity18 Oct '12 - 15:53 
GeneralMy vote of 5memberDen205018 Oct '12 - 6:05 
GeneralRe: My vote of 5memberAdvecticity18 Oct '12 - 15:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 18 Oct 2012
Article Copyright 2012 by Advecticity
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid