the Fiddler's picture

Color4.ToArgb returns wrong results

Project:The Open Toolkit library
Version:1.0-beta-3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
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

the Fiddler's picture

#1

Status:open» fixed

Fixed in r2587.

the Fiddler's picture

#3

Version:1.0-beta-2» 1.0-beta-3
Status:fixed» closed

Closing issues fixed in opentk-1.0-beta-3.