Re: [whatwg] Enabling LCD Text and antialiasing in canvas

On Fri, Apr 19, 2013 at 7:02 PM, Rik Cabanier <cabanier@gmail.com> wrote:

>
>
> On Fri, Apr 19, 2013 at 10:35 AM, Stephen White <senorblanco@chromium.org>wrote:
>
>> Thanks for your comments.
>>
>> On Fri, Apr 19, 2013 at 12:53 PM, Rik Cabanier <cabanier@gmail.com>wrote:
>>
>>> Nice!
>>>
>>> The behaviour of putImageData() and putImageDataHD() is to premultiply
>>> the RGB components by the alpha component as usual, but write 1.0 into
>>> destination alpha. In other words, if (r, g, b, a) are the component values
>>> in a given pixel passed to putImageData[HD](), then r' = ar, g' = ag, b' =
>>> ab are the colour components of the resulting canvas pixel, and (r', g',
>>> b', 1.0) is written to the canvas backing store.
>>>
>>> I think that's confusing. Maybe cut that sentence since it isn't needed.
>>> (Having the black backing store implies this behavior)
>>>
>>
>> Do you mean, remove both sentences, or just the last one?  I wanted to
>> make it clear that the RGB is still premultiplied with the original alpha,
>> even though the alpha is subsequently ignored.
>>
>
> O yes. This has to be defined.
>
>
>>
>> attribute boolean alpha;
>>>
>>> Should it be read-only?
>>
>>
>> Hmm, I have no idea.  WebGL's doesn't have it, but I'm not enough of an
>> IDL expert to know whether it's necessary.
>>
>
> This implies that you can change it which is not allowed according to your
> wiki:
>
> *Q:* Can you call getContext more than once on the same canvas, with
> different values for { alpha }?
>
> *A:* No. Once it has been called once, the type of the backing store is
> set. Calling it again with a different argument raises an exception.
>
>
The context attributes are only used on the first call to getContext(), and
are effectively pass-by-value:  the values are used to initialize the
context. Each call to getContextAttributes() returns a JS object (not
necessarily the original object) to which changes are also ignored.  I've
modified the language to avoid throwing an exception, and simply ignore the
context attributes parameter on subsequent calls, as WebGL does.

Stephen

>
>
>>
>>
>>>
>>> Canvas2DContextAttributes getContextAttributes();
>>>
>>> Maybe make it an attribute:
>>>
>>> attribute Canvas2DContextAttributes attributes:
>>>
>>>
>> I'm following WebGL syntax here as well.  Apparently WebGL's is nullable,
>> though, so I've added ? here.
>>
>> Stephen
>>
>>>
>>> On Fri, Apr 19, 2013 at 9:13 AM, Stephen White <senorblanco@chromium.org
>>> > wrote:
>>>
>>>> Here's a short proposal I've written up for the getContext('2d', {
>>>> alpha: false } ) version of this idea (much of it culled from the
>>>> mega-thread above).
>>>>
>>>> http://wiki.whatwg.org/wiki/CanvasOpaque
>>>>
>>>> Comments are welcome.
>>>>
>>>> Stephen
>>>>
>>>
>>>
>>
>

Received on Monday, 22 April 2013 17:01:54 UTC