Skip to content

Instantly share code, notes, and snippets.

@theBonesae
Last active August 29, 2015 14:04
Show Gist options
  • Save theBonesae/d0aba7bc6bc4075f4be0 to your computer and use it in GitHub Desktop.
Save theBonesae/d0aba7bc6bc4075f4be0 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace ConsoleApplication9 {
class Program {
static void Main(string[] args) {
while (true) {
List<Color> colors = new List<Color>();
int size = 30;
KnownColor[] colorss = Enum.GetValues(typeof(KnownColor)) as KnownColor[];
Console.WriteLine("Please input a name:");
string name = Console.ReadLine();
for (int i = 0; i < name.Length; i++) {
colors.Add(Color.FromKnownColor(colorss[i + 27 + name[i]]));
}
int counter1 = 1;
Bitmap bitMap = new Bitmap(size, size);
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
bitMap.SetPixel(j,i, colors[((i * i + j * j) + name[counter1]) % name.Length]);
counter1++;
if (counter1 >= colors.Count) {
counter1 = 1;
}
}
}
Graphics g = Graphics.FromImage(bitMap);
g.Dispose();
bitMap.Save(name + ".png");
bitMap.Dispose();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment