Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
I suppose I could look at EEs source, but if someone already knows then that would be preferable.
I think it averages the color of each pixel somehow.
Yeah, well, you know that's just like, uh, your opinion, man.
Offline
I have a class made for this purpose. I've made it all by myself, except for some random color calculation code from stackoverflow. All colors are correct because they are straight from EE itself.
Colors are stored in a dictionary with the blockid as key.
https://dl.dropboxusercontent.com/u/395 … pColors.cs
Edit: I forgot this needs some images containing the blocks so it can calculate the average colors.
https://dl.dropboxusercontent.com/u/39534509/images.zip
Last edited by gustav9797 (May 18 2014 8:30:24 am)
Offline
That's a whole lot of code Gustav, for something quite simple.
I do similar, with images -- however mine is slightly different. I do use a list of colours though. This to be exact.
If the block colour is not in the list (i.e. new added blocks) it will attempt to approximate the colours, and it should be 100% accurate considering EE Client does it as well for new added blocks.
private static Color ToColour(uint value) { return Color.FromArgb((byte)((value >> 24) & 0xFF), (byte)((value >> 16) & 0xFF), (byte)((value >> 8) & 0xFF), (byte)(value & 0xFF)); }
public Color getColourMinimap(Bitmap bitmap) { return bitmap.GetPixel(8, 8); }
if (File.Exists(Application.StartupPath + "/includes/colours.txt")) { foreach (string color in File.ReadAllLines((Application.StartupPath + "/includes/colours.txt"))) { string[] splt = color.Split(' '); if (splt[0] != "0") colours.Add(Convert.ToInt32(splt[0]), ToColour(Convert.ToUInt32(splt[1]))); } }
foreach (string file in Directory.GetFiles(Application.StartupPath + "/blocks", "*.png", SearchOption.TopDirectoryOnly)) { FileInfo f = new FileInfo(file); if (!colours.ContainsKey(id)) colours.Add(id, getColourMinimap(bit)); }
*u stinky*
Offline
I believe that they changed it back in the RPGMaster days so it would be an average of all the pixils in the block, but they changed a few of the old ones, because it screwed up some of the block colors from blocks already made.
Offline
This could help with finding the lower numbers in grey blocks and stuff. I think. Would that do anything?
Offline
That's a whole lot of code Gustav, for something quite simple.
I do similar, with images -- however mine is slightly different. I do use a list of colours though. This to be exact.If the block colour is not in the list (i.e. new added blocks) it will attempt to approximate the colours, and it should be 100% accurate considering EE Client does it as well for new added blocks.
private static Color ToColour(uint value) { return Color.FromArgb((byte)((value >> 24) & 0xFF), (byte)((value >> 16) & 0xFF), (byte)((value >> 8) & 0xFF), (byte)(value & 0xFF)); }
public Color getColourMinimap(Bitmap bitmap) { return bitmap.GetPixel(8, 8); }
if (File.Exists(Application.StartupPath + "/includes/colours.txt")) { foreach (string color in File.ReadAllLines((Application.StartupPath + "/includes/colours.txt"))) { string[] splt = color.Split(' '); if (splt[0] != "0") colours.Add(Convert.ToInt32(splt[0]), ToColour(Convert.ToUInt32(splt[1]))); } }
foreach (string file in Directory.GetFiles(Application.StartupPath + "/blocks", "*.png", SearchOption.TopDirectoryOnly)) { FileInfo f = new FileInfo(file); if (!colours.ContainsKey(id)) colours.Add(id, getColourMinimap(bit)); }
Yeah, I guess you wouldn't have to generate color for the blocks every startup.
Offline
Pages: 1
[ Started around 1738591364.9834 - Generated in 0.056 seconds, 12 queries executed - Memory usage: 1.46 MiB (Peak: 1.61 MiB) ]