Exemplo n.º 1
0
// ###### Change C1 and C2 ##################################################
void FractalGeneratorView::changeC1C2(std::complex<double> NewC1, std::complex<double> NewC2)
{
   if(Thread != NULL) {
      stopCalculation();
   }
   C1 = NewC1;
   C2 = NewC2;
}
Exemplo n.º 2
0
// ###### Change color scheme ###############################################
void FractalGeneratorView::changeColorScheme(int index)
{
   if(Thread != NULL) {
      stopCalculation();
   }
   ColorScheme = ColorSchemeInterface::getColorScheme(index);
   ColorScheme->configure(Algorithm->getMaxIterations());
   emit updateColorScheme();
}
Exemplo n.º 3
0
// ###### Configuration update -> restart calculation #######################
void FractalGeneratorView::configChanged()
{
   if(Thread != NULL) {
     stopCalculation();
   }
   Buffer->clear();
   Display->reset(Display->imageWidth(), Display->imageHeight());
   emit updateZoomInPossible();
   emit updateZoomBackPossible();
   startCalculation();
}
Exemplo n.º 4
0
ImageHistogram::~ImageHistogram()
{
    stopCalculation();

    if (d->histogram)
    {
        delete [] d->histogram;
    }

    delete d;
}
Exemplo n.º 5
0
// ###### Reset zoom ########################################################
void FractalGeneratorView::zoomReset()
{
   if(Thread != NULL) {
      stopCalculation();
   }
   C1 = Algorithm->defaultC1();
   C2 = Algorithm->defaultC2();
   Algorithm->configure(Display->imageWidth(),
      Display->imageHeight(),
      C1, C2,
      *Algorithm->getMaxIterations());
   zoomList.clear();
   configChanged();
}
Exemplo n.º 6
0
// ###### Zoom back #########################################################
void FractalGeneratorView::zoomBack()
{
   if(Thread != NULL) {
      stopCalculation();
   }
   if(zoomList.size() > 0) {
      C1 = zoomList.back().first;
      C2 = zoomList.back().second;
      zoomList.pop_back();
      Algorithm->configure(Display->imageWidth(), Display->imageHeight(),
                           C1, C2,
                           *Algorithm->getMaxIterations());
      configChanged();
   }
}
Exemplo n.º 7
0
// ###### Change image size #################################################
void FractalGeneratorView::changeSize(int X, int Y)
{
   if(Thread != NULL) {
      stopCalculation();
   }
   SizeX = X;
   SizeY = Y;
   Display->reset(SizeX, SizeY);
   Buffer->reset(Display->imageWidth(), Display->imageHeight());

   Selection = false;
   Algorithm->changeSize(Display->imageWidth(),
                         Display->imageHeight());
   updateScrollBars();
}
Exemplo n.º 8
0
// ###### Change fractal algorithm ##########################################
void FractalGeneratorView::changeAlgorithm(int index)
{
   if(Thread != NULL) {
      stopCalculation();
   }
   Algorithm = FractalAlgorithmInterface::getAlgorithm(index);
   C1 = Algorithm->defaultC1();
   C2 = Algorithm->defaultC2();
   Selection = false;
   Algorithm->configure(Display->imageWidth(), Display->imageHeight(),
                        C1, C2,
                        Algorithm->defaultMaxIterations());
   ColorScheme->configure(Algorithm->getMaxIterations());
   zoomList.clear();
   emit updateFractalAlgorithm();
}
Exemplo n.º 9
0
// ###### Zoom in ###########################################################
void FractalGeneratorView::zoomIn()
{
   if(Selection) {
      if(Thread != NULL) {
         stopCalculation();
      }
      zoomList.push_back(std::pair<std::complex<double>, std::complex<double> >(C1, C2));
      const double halfWidth  = (SelectionC2.real() - SelectionC1.real()) / 2.0;
      const double halfHeight = (SelectionC2.imag() - SelectionC1.imag()) / 2.0;
      const std::complex<double> center = std::complex<double>(SelectionC1.real() + halfWidth,
                                                               SelectionC1.imag() + halfHeight);
      const double newHalfHeight = halfWidth * ((double)Display->imageHeight() / (double)Display->imageWidth());
      C1 = std::complex<double>(center.real() - halfWidth, center.imag() + newHalfHeight);
      C2 = std::complex<double>(center.real() + halfWidth, center.imag() - newHalfHeight);
      Selection = false;
      Buffer->clear();
      Display->reset(Display->imageWidth(), Display->imageHeight());
      Algorithm->configure(Display->imageWidth(), Display->imageHeight(),
                           C1, C2,
                           *Algorithm->getMaxIterations());
      configChanged();
   }
}