
Color4.ToArgb returns wrong results
Posted Thursday, 7 January, 2010 - 21:33 by the Fiddler| Project: | The Open Toolkit library |
| Version: | 1.0-beta-3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Right now it is implemented like this:
public int ToArgb() { uint value = (uint)(A / Byte.MaxValue) << 24 | (uint)(R / Byte.MaxValue) << 16 | (uint)(G / Byte.MaxValue) << 8 | (uint)(B / Byte.MaxValue); return unchecked((int)value); }
Since A, R, G, B are float values between 0 and 1, this will always return 0. We should multiply with Byte.MaxValue instead of dividing.


Comments
#1
Fixed in r2587.
#3
Closing issues fixed in opentk-1.0-beta-3.