I have a problem with coloring the Mandelbrot set. This is my onDraw() procedure:
@Override
protected void onDraw(Canvas canvas) {
g = Math.round(60+(iter_count*(2500/16)));
iter_count++;
for(int xx = 1; xx <= xMax; xx++) {
for(int yy = 1; yy <= yMax; yy++) {
schirmzupap(ar,br,bi,ai,xx,yy,xMax,yMax);
n = 1;
zr0 = zr;
zi0 = zi;
while ((n<g) && (zr*zr+zi*zi<4)) {
zrh = zr;
zr = (zr*zr)-zi*zi+zr0;
zi = zrh*zi+zi*zrh+zi0;
n++;
}
if (n==g) { //[Coloring]
paint.setARGB(255,0,0,0);
}
if ((n/g) < (1/2)) {
paint.setARGB(255,Math.round((n/g)*255),0,0);
}
if (((n/g) < 1) && ((n/g) > 1/2)) {
paint.setARGB(255,255,Math.round((n/g)*255),Math.round((n/g)*255));
}
canvas.drawPoint(xx, yy, paint); //[/Coloring]
}
}
}
This is how it looks at the Java Android emulator: http://i55.tinypic.com/14ctqi8.png
This is how I want it to look: http://i54.tinypic.com/nh1aqe.png It's written in Delphi, but the coloring part is actually the same:
if n=g then image1.canvas.Pixels[xx,yy]:=RGB2TColor(0,0,0);
if (n/g)<(1/2) then image1.canvas.Pixels[xx,yy]:=RGB2TColor(Round((n/g)*255),0,0);
if ((n/g)<(1)) AND ((n/g)>(1/2)) then image1.canvas.Pixels[xx,yy]:=RGB2TColor(255,Round((n/g)*255),Round((n/g)*255));
Could someone help me please? Greetz,
Henry