Re: 3.14.11. The canvas element

Ben Boyle wrote:
> [quoting from the spec] The canvas must initially be fully transparent black.

I think that sentence should be modified to say "The canvas bitmap must 
initially be fully transparent black.", so it's clear that it applies to 
the bitmap rather than to the element itself.

> 1. "transparent black" ? Transparent I understand. Why black?

"Transparent black" means rgba(0, 0, 0, 0). A colour like rgba(255, 0, 
255, 0) would be fully transparent too (but not black). Normally all 
fully transparent colours act indistinguishably, but you can call 
CanvasRenderingContext2D's getImageData() to see the difference between 
[0, 0, 0, 0] and [255, 0, 255, 0], so the distinction matters a bit 
here, and specifying "transparent black" ensures everyone implements the 
same.

> This would be adjustable through CSS?

You can't change the canvas bitmap with CSS. If you do <canvas 
style="background:red"> then the canvas is still initially a transparent 
black bitmap, though it's rendered on top of a red square (which is 
rendered on top of whatever's behind the canvas element). (I don't know 
whether the rendering is actually specified anywhere, but it's 
consistent with how <img> works.)

-- 
Philip Taylor
philip@zaynar.demon.co.uk

Received on Sunday, 5 August 2007 17:35:56 UTC