Re: Fwd: [whatwg] Drawing shapes on canvas

On Tue, Feb 18, 2014 at 1:10 AM, Charles Pritchard <chuck@jumis.com> wrote:

>  On 2/17/2014 2:58 PM, Rik Cabanier wrote:
>
>         Shape2D add(Shape2D); // returns a path that is the union of the
>> 2 paths
>> }
>>
>>  This class will represent a painted area. Because it knows the winding
>> and stroking rules, the browser will be able to do expensive math in
>> advance. It can also cache the region on the GPU.
>> constructors:
>>
>>  ...
>>
>>
>>  1: http://blogs.adobe.com/webplatform/2013/01/31/revised-canvas-paths/
>>
>>
>>
>> This proposal is an improvement on the current direction of the Path
>> object.
>>
>> The long-form constructor feels a little tedious/difficult, with 8
>> arguments to be passed.
>> I'd like to see xor / remove as well, if you're going to have "add" on
>> the Shape2D method.
>>
>
>  Yes.
> I left it out since those operators aren't easily emulated.
> If we had access to an open source library that could calculate this
> correctly and in an efficient way, it can be added again.
>
>
> Need more info here. "Implemented" v. emulated.
> What is your level of accuracy for "correctly".
>
> Is this a rasterization API or a Path API?
>
> A rasterizer could run a simple bitmap xor/and prior to fill, a Path API
> would need to, in some possible future, return a path.
>

Can you rephrase that?


> We've implemented these before, they're not particular hard, but there are
> certainly some issues around precision when it comes to curves.
>

If you go the raster path, there are also issues with anti-aliasing.

There are 2 possible ways this could be implemented:
1. a planarization library that can do these operations on filled shapes
and return another shape
2. directly in the GPU using shaders

Doing it with bitmaps CPU side is imprecise, slow and cumbersome.

Received on Tuesday, 18 February 2014 19:00:59 UTC