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

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 05:10:27 UTC, Виталий Фадеев wrote: On Tuesday, 15 December 2020 at 05:04:46 UTC, Виталий Фадеев wrote: On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`.

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

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 05:04:46 UTC, Виталий Фадеев wrote: On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here tend

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

2020-12-14 Thread Виталий Фадеев via Digitalmars-d-learn
On Monday, 14 December 2020 at 16:19:18 UTC, Adam D. Ruppe wrote: On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here tends to reflect the bytes. So argb puts the alpha byte first in the arr

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

2020-12-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 December 2020 at 16:11:16 UTC, Jacob Carlborg wrote: Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. The ordering here tends to reflect the bytes. So argb puts the alpha byte first in the array whereas rgba puts red first. But there's other ways here inclu

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

2020-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 14 December 2020 at 05:51:28 UTC, Виталий Фадеев wrote: It's parsing the `.a` in `.argb` as part of the number: auto color = 0x00AABBCC.a rgb; // what the compiler sees You can fix it with parentheses: auto color = (0x00AABBCC).argb; Thanks! It is not perfect, but also beauty!

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

2020-12-13 Thread Виталий Фадеев via Digitalmars-d-learn
On Monday, 14 December 2020 at 05:37:21 UTC, Paul Backus wrote: On Monday, 14 December 2020 at 05:27:40 UTC, Виталий Фадеев wrote: ".rgb" Compiled fine. ".argb" Compilation error. Source: https://run.dlang.io/is/ULQ4kh It's parsing the `.a` in `.argb` as part of the number: auto color

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

2020-12-13 Thread Paul Backus via Digitalmars-d-learn
On Monday, 14 December 2020 at 05:27:40 UTC, Виталий Фадеев wrote: ".rgb" Compiled fine. ".argb" Compilation error. Source: https://run.dlang.io/is/ULQ4kh It's parsing the `.a` in `.argb` as part of the number: auto color = 0x00AABBCC.a rgb; // what the compiler sees You can fix it wit

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

2020-12-13 Thread Виталий Фадеев via Digitalmars-d-learn
On Monday, 14 December 2020 at 05:24:39 UTC, Виталий Фадеев wrote: ... msg ... But...: Color rgb( uint color ) { return Color( cast( uint ) ( ( ( color & 0x00FF ) << 16 ) | ( ( color & 0xFF00 ) ) | ( ( color

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

2020-12-13 Thread Виталий Фадеев via Digitalmars-d-learn
We have: static import winapi=core.sys.windows.windows; struct Color { union { winapi.COLORREF native; struct { ubyte r; ubyte g; ubyte b; } } ubyte a = 0