Re: Pardon about CSS4 "element()"

[again, please don't top-post https://wiki.csswg.org/tools/www-style]

On Wed, Dec 16, 2015 at 11:27 AM, Alexey Solovey <acterhd@gmail.com> wrote:
> 2015-12-17 3:25 GMT+08:00 Tab Atkins Jr. <jackalmage@gmail.com>:
>> [please don't top-post https://wiki.csswg.org/tools/www-style]
>>
>> On Wed, Dec 16, 2015 at 10:47 AM, Alexey Solovey <acterhd@gmail.com>
>> wrote:
>> > paint() is paint,  source() and element() are sources for painting API.
>>
>> I think you're slightly confused about what the various features do:
>>
>> * element() lets you make an image that looks like an existing element
>> on the page.
>> * paint() lets you use JS to produce an image that CSS can use, and
>> hooks into CSS sizing in a useful way - you can tell what size the
>> background-image is going to be, for example.
>>
>> Right now the element() spec also defines a mechanism *similar* to
>> paint(), where you can create a <canvas> in JS, assign it to the
>> elementMap, and reference it with element().  This is just a
>> less-useful version of what paint() does - it doesn't let you respond
>> to the size that CSS wants to paint the image, for example.  paint()
>> is *strictly better* than this usage of element(), and there is no
>> reason to prefer element() for this use-case.  I will remove this
>> functionality from the Images 4 spec as soon as I have the time to do
>> so.
>
> And How I can draw Paint Sources?

If they're in the page, that's what element() is for.  If they're not,
you draw them into a canvas via the Custom Paint API, and use paint()
to refer to them in CSS.

~TJ

Received on Wednesday, 16 December 2015 19:30:08 UTC