W3C home > Mailing lists > Public > public-html@w3.org > August 2007

Re: 3.14.11. The canvas element

From: Philip Taylor <philip@zaynar.demon.co.uk>
Date: Sun, 05 Aug 2007 18:35:45 +0100
Message-ID: <46B60A71.4080903@zaynar.demon.co.uk>
To: Ben Boyle <benjamins.boyle@gmail.com>
CC: HTML WG <public-html@w3.org>

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 

> 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
Received on Sunday, 5 August 2007 17:35:56 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:25 UTC