colour lib

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 10:44:29 PDT 2016


Am Sat, 3 Sep 2016 16:01:26 +1200
schrieb rikki cattermole <rikki at cattermole.co.nz>:

> On 03/09/2016 12:17 PM, Manu via Digitalmars-d wrote:
> ...snip...
> 
> > I think the presence of all this colour space information as type
> > arguments should nudge users in the right direction. They'll be all
> > "I've never seen this parameter before..." and google it... maybe.
> > I don't think it's the std lib doco's job to give users a lesson in
> > colour theory...? :/  

:D Just a short paragraph. "Note: The common sRGB color
space used in computer screens or JPEGs from digicams does not
evenly distribute brightness along the pixel values.
Multiplying an sRGB pixel by two, wont double its intensity!
To perform accurate image manipulations, you are advised
to always convert to a high precision linear color-space like
[insert name] first.

More information on the history of sRGB and the formulas used
can be found here: https://www.w3.org/Graphics/Color/sRGB"

I believe sRGB is the only color-space that you "feel" you are
already familiar with as a computer person, because you see and
use it all the time.

If I really wanted to make you pull your hair I'd say: "Man
this NormalizedInt stuff would so benefit from MMX. Imagine we
don't use float but ushort as linear RGB value and then use a
single PADDUSW to add two colors."

> Something[0] along this line perhaps?
> 
> Overview of the choices and scope along with reasoning.
> 
> [0] 
> https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/graphic/image/specification.dd

I have not found text about color spaces there, but it is an
interesting collection of API design rationales. "If it
mutates it may throw. If it doesn't mutate it shouldnt." I
never thought about it that way.

-- 
Marco



More information about the Digitalmars-d mailing list