#include "ramCanvas.hpp"
#include <complex>

int main(void) {
  int cnt;
  std::complex<float> c, z, z0(0.0, 0.0);  
  ramCanvas4c8b rc = mjr::ramCanvas4c8b(7680, 7680, -2.2, 0.8, -1.5, 1.5);
  for(int y=0;y<rc.get_numYpix();y++)
    for(int x=0;x<rc.get_numXpix();x++) {
      for(c=std::complex<float>(rc.int2realX(x),rc.int2realY(y)),z=z0,cnt=0;(std::norm(z)<4)&&(cnt<=1024); cnt++,z=z*z+c) ;
      if(cnt < 1024)
        rc.drawPoint(x, y, mjr::color4c8b().cmpFireRamp(intWrap(cnt*20, 767)));
    }
  rc.writeTGAfile("mandelbrot.tga");
}