[whatwg] Canvas operators (was Re: several messages)

ddailey ddailey at zoominternet.net
Sun May 20 17:17:58 PDT 2007

On Sunday, May 20, 2007 6:30 PML. David Baron wrote:
"...This is the cairo 'saturate' operator..."

The above reminded me: using SVG suggested to me a couple of questions* 
about SVG that would seem to be just as relevant to the <canvas> tag:

1. Is there a way, using filters, to take an image A and produce its 
photographic negative A', such that 255-C(A)=C(A') for each channel C in 
{R,G,B)? I've fooled a bit with the filter "feComponentTransfer" with some 
hints of success, but it seems like so natural a thing that there must be a 
straightforward way that I'm just missing. Here is an approach that comes 
close using <feComponentTransfer> together with <feComposite 
It produces an image which looks like a spectrum-equalized version of the 

2. On a related theme, <feBlend/> has modes including "screen", "multiply" 
etc. Is there a way to create the "difference" between two images (as with 
the Photoshop difference filter) in SVG? Here's the best I have figured out 
so far: http://srufaculty.sru.edu/david.dailey/svg/ImageDiffer.svg . The 
ability to calculate differences between images comes in quite handy, for 
example, in explaining image compression to students, in scientific image 
processing, and I believe in forensics as well.

Both examples above will require either Opera's native support for SVG+SMIL 
or something with the Adobe plugin, since the effect is differentially 
phased in with SMIL.

Another question arises in my mind in this context: is there any reason that 
any of the treatments of these effects (like the Porter-Duff operators, 
darken, saturate etc.) should be any different than they are in the SVG 
spec? So many things that I see in the treatment of canvas remind me of 
something so similar to what is in SVG that it makes me wonder why not just 
reference say http://www.w3.org/TR/SVG/filters.html ?

If indeed, my suspicion that 1 and 2, above, are not possible in current 
approaches within SVG, then that would certainly justify a reopening and 
augmentation of that treatment, but having come late to the discussions 
about <canvas> and having not been involved in the discussions about the SVG 
filters, I am a bit baffled by some of this. (Not that my state of 
bafflement is anyone's problem but mine, mind you: I am well prepared to 
deal with what I fear is a rather persistent condition.)


*taken from http://srufaculty.sru.edu/david.dailey/svg/svg_questions.htm 

More information about the whatwg mailing list