Phobos colour module?

via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 5 10:11:00 PST 2015


On Monday, 5 January 2015 at 16:08:27 UTC, Adam D. Ruppe wrote:
> Yeah, in my misc repo, there used to be stand along image.d and 
> simpledisplay.d. Now, they both depend on color.d. Even just a 
> basic definition we can use elsewhere is nice to have so other 
> libs can interop on that level without annoying casts or 
> pointless conversions just to please the type system when the 
> contents are identical.

Yes, that too. I was more thinking about the ability to create an 
adapter that extracts colour information from an existing data 
structure and adds context information such as gamma. Then let  
you build a function that say reads floats from 3 LAB pointers 
and finally returns a tuple with a 16 bit RGB pixel with gamma 
correction and the residue in a specified format suitable for 
dithering... ;-]

It is quite common error to do computations on colours that are 
ignorant of gamma (or do it wrong) which results in less accurate 
imaging. E.g. When dithering you need to make sure that the 
residue that is left when doing bit truncation is added to the 
neighbouring pixels in a "linear addition" (without gamma). 
Making stuff like that less tedious would make it a very useful 
library.


More information about the Digitalmars-d mailing list