dmilos / color

C++ library thats implemets class color. Available models: RGB, HSL, HSV, CMY, CMYK, YIQ, YUV and growing.
Apache License 2.0
172 stars 21 forks source link

How to define a GRB? #8

Open Karbonforms opened 2 years ago

Karbonforms commented 2 years ago

How can I define a GRB?

I can see the scramble stuff in there but can't figure out how to define it from the maze of templates.

dmilos commented 2 years ago

Unfortunate not possible to do that easy. Main problems is keep conversion from RGB-like model to others and keep instance declaration like color::rgb\<double> to be simple. Similarly from HSL we can make LSH. This will introduce more problems in implementation and make confusion in code reading. Possible idea is color::model\< rgb_scramble\<double, 1,0,2> >, downside is that this will introduce new class in currently too large API. Still thinking about that. rgb_scramble is not part of API, just idea. Best I can do is to redirect to boost::gil, it might help.

Karbonforms commented 2 years ago

I managed it by copying from a compiler warning...

using CGRBA = color::model<color::category::rgb<color::category::_internal::rgba_scramble<unsigned char, 1, 2, 0, 3> > >;

works fine. I can cast an array of these to uint32_t* then read the uint32_t's which are in the correct 24bit order for converting into a DMA buffer for PWM to drive WS2812B LED strips.

On Sat, 6 Nov 2021 at 10:12, Dejan @.***> wrote:

Unfortunate not possible to do that easy. Main problems is keep conversion from RGB-like model to others and keep instance declaration like color::rgb to be simple. Similarly from HSL we can make LSH. This will introduce more problems in implementation and make confusion in code reading. Possible idea is color::model< rgb_scramble<double, 1,0,2> >, downside is that this will introduce new class in currently too large API. Still thinking about that. rgb_scramble is not part of API, just idea. Best I can do is to redirect to boost::gil, it might help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dmilos/color/issues/8#issuecomment-962429003, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANVSHD4CRPQOK6H2YR27PDUKT5P3ANCNFSM5HOPCH7Q .