[whatwg] question about canvas globalCompositeOperation

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Sat Aug 21 00:54:45 PDT 2010


Hi all,

I've tried to work with the globalCompositeOperation [1] over the last days
for a particular use case where I am trying to use a gradient to merge with
a canvas as a mask. I now wonder if the globalCompositeOperation is indeed
meant to be used this way and what transparency means.

For example, "source-in" is defined as:
"A in B": Display the source image wherever both the source image and
destination image are opaque. Display transparency elsewhere.

What about partial transparency? I would expect the use of the canvas bitmap
B as a mask for the object or image A, where A becomes partially transparent
where-ever B is partially transparent. As it stands, browsers do not
implement it this way - only completely transparent pixels will create
transparency in A, which means when using a gradient that nothing become
partially transparent - it's either there or gone.

Should partial transparency in B not be dealt with as partial transparency
in the resulting display, too?

Apologies if this has been dealt with before. I'm looking at it with video
as the input medium, i.e. through drawImage(), trying to make it partially
transparent.

Cheers,
Silvia.


[1]
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-globalcompositeoperation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100821/1612c9bc/attachment-0002.htm>


More information about the whatwg mailing list