adventuregamestudio / ags

AGS editor and engine source code
Other
708 stars 159 forks source link

Editor: color properties are clamping RGB values inconsistenly with the engine #2352

Closed ivan-mogilko closed 3 months ago

ivan-mogilko commented 8 months ago

Problem

Because in AGS color index <-> RGB mapping is done based on 16-bit RGB values, both Editor and Engine fixup any assigned RGB value by clamping its components to R5G6B5 format (i think). (On a side note, there's a task to remove this clamping in ags4, see #1980)

However, it seems that Editor's mapping is different from the Engine's. Sometimes the RGB value typed into a property field is clamped to one result, but using Game.GetColorFromRGB in script produces a different result.

For example: Input value: 167, 181, 147 Editor clamps to: 160, 180, 144 Engine clamps to: 165, 182, 148

UPDATE: user reports there's another inconsistency, when using Colours Pane for making color numbers and then trying to insert them into the color number properties. Following is user's explanation:

I plugged in 73, 106, 69 into the colour selector in the colour panel it spat out a decimal number I plugged in that number into the speechview colour it reclamped it to 72, 104, 64 but if I go to the Colour Panel and tap the FIND COLOUR next to the generated number of 19272 it shows 73, 106, 69

EDIT: in regards to this addition, maybe it's a mistake in user's report, the result of converting 19272 back in the Color Picker will be 72, 104, 64 In other words, input 73, 106, 69 ==> number is 19272 input 19272 ==> RGB is 72, 104, 64 You should reset and input the number again to see this.

AGS Version

Any 3.* version, I think.

Expected behavior

I believe that the Editor should comply to the engine's formula when clamping colors.