Julia set: Difference between revisions
Content added Content deleted
Line 204: | Line 204: | ||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
{{trans|Python}} |
{{trans|Python}} |
||
<lang csharp>using System.Drawing; |
<lang csharp>using System.Drawing; |
||
// Note: You have to add the System.Drawing assembly |
// Note: You have to add the System.Drawing assembly |
||
// (right-click "references," Add Reference, Assemblies, Framework, |
// (right-click "references," Add Reference, Assemblies, Framework, |
||
// System.Drawing, OK) |
// System.Drawing, OK) |
||
using System.Linq; |
|||
namespace RosettaJuliaSet |
namespace RosettaJuliaSet |
||
Line 221: | Line 222: | ||
const int moveX = 0; |
const int moveX = 0; |
||
const int moveY = 0; |
const int moveY = 0; |
||
⚫ | |||
const double cY = 0.27015; |
|||
⚫ | |||
double cY = 0.27015; |
|||
double zx, zy, tmp; |
double zx, zy, tmp; |
||
int i; |
int i; |
||
var colors = (from c in Enumerable.Range(0, 256) |
|||
select Color.FromArgb((c >> 5) * 36, (c >> 3 & 7) * 36, (c & 3) * 85)).ToArray(); |
|||
var bitmap = new Bitmap(w, h); |
|||
for (int x = 0; x < w; x++) |
for (int x = 0; x < w; x++) |
||
{ |
{ |
||
Line 241: | Line 245: | ||
i -= 1; |
i -= 1; |
||
} |
} |
||
bitmap.SetPixel(x, y, colors[i]); |
|||
bitmap.SetPixel(x, y, c); |
|||
} |
} |
||
} |
} |