Re: Properties of Custom Paint

Great. Updated with:

##### Custom Paint functions can be shared across multiple elements.

We'd don't want a canvas to be shared across multiple elements. This means
that it won't be able to properly respond to geometry sizes of the element
it is "augmenting"; it'll have to stretch, crop, etc. Instead we'd like to
share a Custom Paint function instead, which can properly respond to
geometry changes, and be invoked multiple times.

On Thu, May 21, 2015 at 3:48 PM, Dean Jackson <dino@apple.com> wrote:

>
> On 22 May 2015, at 5:38 am, Shane Stephens <shans@google.com> wrote:
>
> As I've said to Shane and Ian offline, I think that a variant on the
>> element() feature can address many of the requirements for custom paint
>> with a few API modifications (allowing it to be used in more places, in
>> addition to default rendering, responding to layout updates, etc). We've
>> found -webkit-canvas to be especially useful in this manner (we use it for
>> the custom rendering of our scrubber bar in media controls).
>>
>
> One concern I have with this is that if you register the same canvas to
> multiple elements, you're stuck with a single canvas size. So you can't
> really build a custom painter that e.g. paints a fancy border for any given
> size input - instead, you'd need to create a new <canvas> element that
> shadows every fancy border instance, so that each could be responsive
> independently to layout.
>
> In fact, I'd like to propose an extra "Required Property" for Ian's list:
> Custom Paint functions can be shared across multiple elements
>
> One potential solution is to either allow element() to reference paint
> functions directly (rather than just out-of-dom canvases), or to add a new
> CSS function for this purpose (e.g. paint()).
>
>
> Yes, I completely agree with this requirement.
>
> As you say, there are a few potential solutions. One of the downsides to
> element() over canvas() was that it makes it difficult to extend the
> function to indicate that maybe you want a shared canvas vs a per-instance
> canvas.
>
> Dean
>
>
>

Received on Friday, 22 May 2015 16:30:24 UTC