Phobos colour module?
ponce via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 1 08:06:43 PST 2015
On Thursday, 1 January 2015 at 15:46:07 UTC, Manu via
Digitalmars-d wrote:
> On 2 January 2015 at 01:09, ponce via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> On Thursday, 1 January 2015 at 06:38:41 UTC, Manu via
>> Digitalmars-d wrote:
>>>
>>> I've been working on a pretty comprehensive module for
>>> dealing with
>>> colours in various formats and colour spaces and conversions
>>> between
>>> all of these.
>>> It seems like a hot area for duplicated effort, since
>>> anything that
>>> deals with multimedia will need this, and I haven't seen a
>>> really
>>> comprehensive implementation.
>>
>>
>> There is such an effort in
>> https://github.com/CyberShadow/ae/blob/master/utils/graphics/color.d
>> Could give some ideas for a more general solution.
>
> Haha, it's surprisingly similar to what I already have! Except
> my
> colour also has a colour space which is properly accounted when
> doing
> casts or assignments.
Yes, this one is pretty much untyped.
>> There is a lot of complications because images can be stored
>> interleaved,
>> with various pitch, also in video there exist cases where the
>> several planes
>> have different dimension (2x or 4x smaller) and this would be
>> nice to
>> account, albeit not an absolute necessity.
>
> That's why I don't want to deal with images to start with ;)
> I think we can get a colour in there. Images will lead to
> massive debate.
Agreed.
>> The number of color space is also astounding, and then do we
>> store it as a
>> template parameter or a runtime object?
>
> I feel like the colour space should be attached to the colour.
> Why would you make it a separate object?
>
If the color space is a runtime object (eg from parsing a CC
profile) then I would be wary of any additional memory it could
use, hence necessity to pass it separately. For a single color
value alone, not a problem.
If it is a template parameter, no such problem exist, it would be
attached as template argument to Color. But then, you can't parse
CC profiles!
Headache ensue.
It's like we need a compile-time parameter that would be a
runtime one sometimes, like in many D designs. Maybe there is an
escape hatch with a template being some sort of std.variant of
color-spaces.
> I think image work in phobos needs to be taken in steps, and
> should
> probably start with the simplest and most useful shared
> primitives
> first.
> Colour would offer massive bang-for-buck in terms of getting
> different
> 3rd party modules talking to eachother.
Be our cook :)
More information about the Digitalmars-d
mailing list