The public comments (i.e., those in imagebufalgo) don't need to explain the
algorithms, except as possibly a one-line formula involving only the
pre-multiplied images. E.g., for "over", you might say
// The "over" operation is: R = A + (1-A[alpha]) * B
and leave it at that.
But the implementation (in imagebufalgo.cpp, or wherever you put it), can have
comments giving details about the derivation or internal operations, for any
that are not very straightforward to somebody reading that code.
I consider the pre-multiplied formulas to be the canonical ones, I would not
bother discussing the un-premultipled ones at all, unless the premult version
is so complex and ugly that it's likely that somebody looking at the code later
will suspect it's wrong, if you don't fully explain how you came up with it.
On Jul 13, 2012, at 11:17 PM, Stefan Stavrev wrote:
> I confirmed from other sources that it only makes
> sense to use over with blend modes, and other Porter-Duff
> operations should be separate from blend modes.
> That makes things so much easier now.
>
> Larry, should I write the derivations in the
> comments for the functions or is it enough to write just the
> formula as it is, non-reduced? It will clutter the comments a
> lot if I include the derivations.
>
> I think I should keep the comments light and give the
> basic formula, but of course use the reduced version
> in the function.
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org