Hex constant method starts from ".a": 0xCCCCCC.argb

Виталий Фадеев vital.fadeev at gmail.com
Mon Dec 14 05:27:40 UTC 2020


On Monday, 14 December 2020 at 05:24:39 UTC, Виталий Фадеев wrote:
>
> ... msg ...
> 

But...:
     Color rgb( uint color )
     {
         return
             Color( cast( uint ) (
                 ( ( color & 0x000000FF ) << 16 )  |
                 ( ( color & 0x0000FF00 ) )  |
                 ( ( color & 0x00FF0000 ) >> 16 )
             ) );
     }

unittest
{
     auto color2 = 0x00AABBCC.rgb;
}

".rgb"  Compiled fine.
".argb" Compilation error.


Source:
     https://run.dlang.io/is/ULQ4kh




More information about the Digitalmars-d-learn mailing list