I've done this by declaring a static array of the same length as
ViewColor!V.channels, and foreach-ing over the channels in a
colour, but this seem uglier than it need to - it would be nice
if I could just define + and = appropriately on double[] and
colours to do the right thing.
On Sunday, 18 January 2015 at 21:10:05 UTC, Phil wrote:
Hi, I'm new to D and having a go at writing some image
processing stuff using Vladimir's ae.graphics library.
To filter (i.e. perform correlations/convolutions) on a view
with colour type C, I'd like to perform intermediate
calculations using a colour with the same number of channels as
C, but all of type double, and then to convert back to
something of type C at the end.
e.g. for a horizontal blur I'd like to keep a running total per
channel, packaged in an all-doubles colour type, and then write
(total / kernel width) for each channel back into a value of
type C.
How do I perform the necessary type magic here? Thanks