Official Everybody Edits Forums

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.

#1 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

How to calculate minimap colors?

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

#2 Before February 2015

mrjawapa
Corn Man 🌽
From: Ohio, USA
Joined: 2015-02-15
Posts: 5,840
Website

Re: How to calculate minimap colors?

DOH's site has a chart on his website--->http://capasha.com/ee/blocks/ee/blocks.html


Discord: jawp#5123

Offline

#3 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to calculate minimap colors?

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)


uzjIGfi.gif

Offline

#4 Before February 2015

XxAtillaxX
Member
Joined: 2015-11-28
Posts: 4,202

Re: How to calculate minimap colors?

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));             }


signature.png
*u stinky*

Offline

#5 Before February 2015

Koto
Member
Joined: 2015-02-18
Posts: 3,269

Re: How to calculate minimap colors?

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.


________________________________________________________
DVNTehT.png

Offline

#6 Before February 2015

Anch
Member
Joined: 2015-02-16
Posts: 5,447

Re: How to calculate minimap colors?

This could help with finding the lower numbers in grey blocks and stuff. I think. Would that do anything?

Offline

#7 Before February 2015

gustav9797
Member
Joined: 2015-03-10
Posts: 200

Re: How to calculate minimap colors?

XxAtillaxX wrote:

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.


uzjIGfi.gif

Offline

#8 Before February 2015

Tako
Member
From: Memphis, Tennessee, USA
Joined: 2015-08-10
Posts: 6,663
Website

Re: How to calculate minimap colors?

Thanks.   I'll try decrypting Atilla's code tomorrow and then give up and use gustav's.


Yeah, well, you know that's just like, uh, your opinion, man.

Offline

Tako1423757384204048

Board footer

Powered by FluxBB

[ Started around 1713996540.4731 - Generated in 0.100 seconds, 10 queries executed - Memory usage: 1.46 MiB (Peak: 1.6 MiB) ]