We have:

    static import winapi=core.sys.windows.windows;

    struct Color
    {
        union
        {
             winapi.COLORREF native;
             struct
            {
                ubyte r;
                ubyte g;
                ubyte b;
            }
        }
        ubyte a = 0xFF;
    }


    Color argb( uint color )
    {
        Color c;

        c.native =
            cast( uint ) (
                ( ( color & 0x000000FF ) << 16 )  |
                ( ( color & 0x0000FF00 ) )  |
                ( ( color & 0x00FF0000 ) >> 16 )
            );

        c.a = ( color & 0xFF000000 ) >> 24;

        return c;
    }


Goal:
    auto color = 0x00AABBCC.argb;

Has error:
    Error: exponent required for hex float
    ( at 0x00AABBCC.argb )

What is it ?
How to implement beauty code like the: #CCCCCC.rgb ?

  • Hex constant method st... Виталий Фадеев via Digitalmars-d-learn
    • Re: Hex constant ... Виталий Фадеев via Digitalmars-d-learn
      • Re: Hex const... Paul Backus via Digitalmars-d-learn
        • Re: Hex c... Виталий Фадеев via Digitalmars-d-learn
          • Re: H... Jacob Carlborg via Digitalmars-d-learn
            • ... Adam D. Ruppe via Digitalmars-d-learn
              • ... Виталий Фадеев via Digitalmars-d-learn
                • ... Виталий Фадеев via Digitalmars-d-learn
                • ... Виталий Фадеев via Digitalmars-d-learn

Reply via email to