paper_trail icon indicating copy to clipboard operation
paper_trail copied to clipboard

[color] Very generic colors: Rgb, Hsv and Gray

Open TomSaw opened this issue 4 years ago • 12 comments

These Colors may be used on their own. F.e. passed to a colored LED driver or being emitted by color-sensor drivers.

They also represent single pixels for modm::graphic::Buffer and modm::graphic::Display (Work in progress, see feature/rewrite-graphic

Features

  • Bit granularity for color::Gray. Same for color::Rgb and color::Hsv cause they're made from 3x color::Gray
    • Proportional conversion between grays with different digits. 2-bit Gray ---> 4-bit Gray f.e. converts as follows:
      • 0b00 --> 0b0000
      • 0b01 --> 0b0101 // No stupid lshift, the gap is filled up
      • 0b10 --> 0b1010
      • 0b11 --> 0b1111 // Saturated stays saturated, white stays white
  • C++20 concepts for colortypes and colorgroups (currently ColorPlane and ColorPalletizing). These concepts support overall readability and enabled very nice overload resolution modulation for modm::graphic::Buffer and modm::graphic::Display (Coming soon, see feature/rewrite-graphic
  • Any imaginable color conversion works - type, granularity, palletized or planar... doesn't matter.
  • Operators with saturation arithmetics

TODO

  • [x] Requires #780 being merged
  • [x] Implement some missing operators
  • [x] Optional range check for value in ProportionalUnsigned::ProportionalUnsigned(T value)
  • [x] Update header Timestamps

TomSaw avatar Nov 15 '21 12:11 TomSaw

This is ready for a first review @salkinium I also got my fingers on modm::Saturated again, improved the API and added another test SaturationTest::test__uint8_t_ref.

TomSaw avatar Jan 09 '22 13:01 TomSaw

Apologize my enduring "push --force" thunderstorm. I'm transitioning from poke mode to test local, push after success mode 😬

Tests passed @salkinium! What's left is a good solution for the ProportionalUnsigned constructor 🙄

TomSaw avatar Jan 12 '22 14:01 TomSaw

What's missing here @salkinium ?

FileNotFoundError: [Errno 2] No such file or directory: '/__w/modm/modm/src/modm/math/propertional_unsigned.md'

TomSaw avatar Feb 22 '22 21:02 TomSaw

Merge please!

TomSaw avatar Feb 23 '22 13:02 TomSaw

These colors have been proven in the field. Adding code snippets to the docs (color.md) rounds up the package.

TomSaw avatar Jun 13 '22 13:06 TomSaw

Please have a look on my solution @chris-durand when you find a minute.

I'll try to find some time tomorrow to look at the PR.

chris-durand avatar Jun 13 '22 20:06 chris-durand

Wanna get some stuff off the table. This PR feels robust, if you find a minute @salkinium 😅...

TomSaw avatar Jun 22 '22 12:06 TomSaw

@TomSaw Did you see what I wrote in https://github.com/modm-io/modm/pull/781#discussion_r900488911 ? The discussion got so lengthy that github hides most of it by default :sweat_smile:

chris-durand avatar Jun 22 '22 14:06 chris-durand

@TomSaw Did you see what I wrote in https://github.com/modm-io/modm/pull/781#discussion_r900488911 ? The discussion got so lengthy that github hides most of it by default :sweat_smile:

Nope. Totally missed that and check it tomorrow.

TomSaw avatar Jun 23 '22 20:06 TomSaw

I'm still very interested in merging this, unfortunately, I've completely lost the overview of the review. I think it's almost done, perhaps you want to address the least comments and then we can merge it?

salkinium avatar Sep 09 '23 19:09 salkinium

Hey there. Yes it was almost done. Only chris requested to extract the "arbitrary integer" logic into its own class for good reasons, see https://github.com/modm-io/modm/pull/781#discussion_r900488911 and https://github.com/modm-io/modm/pull/781#discussion_r911941799

Simple task but then, a strong force pulled me into another universe. One with a ton of PHP actually 🤕

I've just read the processing::fibers readme and it sounds gorgeous 🤩 congrats for completing this!

TomSaw avatar Sep 09 '23 21:09 TomSaw

Nothing changed yet.. just cleaned up the tree

TomSaw avatar Sep 10 '23 07:09 TomSaw