egofree
|
|
Posted on: August 14, 2014, 03:08:34 pm |
|
|
Joined: Jun 2013
Posts: 601
|
In the rooms editor i want to support the instance's color. I am trying to figure out how the colors are stored in a gmx file. A very common format is ARGB (c.f http://en.wikipedia.org/wiki/ARGB). In this format, a 32-bit unsigned integer is used with the highest byte for the Alpha value, and the following bytes for the Red, the Green, and the Blue value. Unfortunately, this is not exactly the same in GM. If the set the alpha value to zero, it seems that the first three lowest bytes are used to store the RGB values. I tried the following colors : (int value and the corresponding binary) blue : 255 -> 11111111 green : 65280 -> 1111111100000000 red : 16711680 -> 111111110000000000000000 But when i set the alpha value to 255 : blue : 427819033 -> 11001100000000000000000011001 green : 4278255360 ->11001100000000001100110000000 red : 429490176 -> 11001100110011000000000000000 white : 429496729 -> 11001100110011001100110011001 black : 427819008 -> 11001100000000000000000000000 Does anybody has an idea how the color codes are stored ?
|
|
« Last Edit: August 18, 2014, 02:05:44 pm by egofree »
|
Logged
|
|
|
|
Goombert
|
|
Reply #1 Posted on: August 14, 2014, 10:34:56 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I can't tell you specifically how it is but I can tell you it is quite whacky, correct me if I am wrong but I believe GMK had the same wonky color format. Specifically take a look at the GMX reader and writer there should be a utility function to convert them. Also here is how it is handled in the C++ CLI. https://github.com/enigma-dev/enigma-dev/blob/master/CommandLine/programs/emake/main.cpp#L47
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #2 Posted on: August 15, 2014, 02:02:59 am |
|
|
Joined: Jun 2013
Posts: 601
|
I can't tell you specifically how it is but I can tell you it is quite whacky, correct me if I am wrong but I believe GMK had the same wonky color format. Specifically take a look at the GMX reader and writer there should be a utility function to convert them. Also here is how it is handled in the C++ CLI. https://github.com/enigma-dev/enigma-dev/blob/master/CommandLine/programs/emake/main.cpp#L47
Yes, i've seen that in Util.java there is methods to convert colors. For example they are used to read the background color of the room. But all these colors don't take into account the alpha property. I've added two methods to store colors with alpha (e.g colors in the preferences panel), but they are not compliant with GM studio. The method in the C++ CLI is used to convert Blue, Green, Red values into Red, Green, Blue values. But this is not the case here. The instance's color is a special case. To my knowledge it's the only color in GM which has an alpha property. Currently LateralGm read this property and store it in the instance property as long, but so far it was not necessary to interpret this value. I've seen that you can also pre-multiply alpha : http://blogs.msdn.com/b/shawnhar/archive/2009/11/06/premultiplied-alpha.aspx. But it doesn't seem to be the case here. I am still investigating. Edit : one solution would be to disassemble GM Studio exe and see the machine code instructions used to do this conversion. But i am not familiar with Intel CPU Edit2: or perhaps a better solution, would be to send an email to Yoyo games and explain my problem. As i paid 40$ for a standard version of GM studio, i am sure they will understand.
|
|
« Last Edit: August 15, 2014, 02:33:19 am by egofree »
|
Logged
|
|
|
|
egofree
|
|
Reply #3 Posted on: August 15, 2014, 06:01:33 am |
|
|
Joined: Jun 2013
Posts: 601
|
I've really no ideas how the color is saved. I was thinking seriously to disassemble the exe, but they protected their exe with cryptography (c.f https://www.bouncycastle.org/). My goal is not to become an expert in hacking and cryptography, and i don't want to spend days or weeks to find the color's algorithm in GM Studio . I propose the following : for the time being, let's support color blending only in egm format. I will store the color value in ARGB format. If it's a gmx or gmk file, LateralGM will not try to read or write this property.
|
|
|
Logged
|
|
|
|
|
|
|
edsquare
|
|
Reply #7 Posted on: August 17, 2014, 09:08:50 pm |
|
|
Location: The throne of ringworld Joined: Apr 2014
Posts: 402
|
MMM a frosty, foamy Guinnes.
|
|
|
Logged
|
A child of five would understand this. Send someone to fetch a child of five. Groucho Marx
|
|
|
|
Darkstar2
|
|
Reply #9 Posted on: August 18, 2014, 12:24:47 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
little O/T but, Actually the latest release version is Version 1.4.1398 time to update You will notice some cool changes / new features to the IDE. Here is one that would be good for LGM: Selecting an object instance in the creation order list for the room editor will "move camera" to instance location.
Very practical for large rooms.
|
|
|
Logged
|
|
|
|
|
|
|
|
|
|