[whatwg] Canvas - Exception on arc with negative radius
Oliver Hunt
oliver at apple.com
Sun Mar 29 16:53:36 PDT 2009
I commented to the list on this issue some time ago (and a number of
the APIs were updated base don my comments); in general developers do
not expect graphics libraries to throw exceptions, especially for
values that are frequently computed. We've had numerous cases where
webkit has had to relax exception logic in canvas (having tightened it
to match spec) where the result has been broken sites and widgets
(alas the webkit and mozilla canvas implementations do have some edge
case where one throws and the other does not), i believe the most
consistent approach will be to fail silently when given invalid, but
finite arguments to any given API. The alternative is that certain
APIs will relax (regardless of spec), whereas others will not, leading
to a more or less random combination of throw vs. no throw on invalid
arguments.
--Oliver
On Mar 29, 2009, at 11:34 AM, Dirk Schulze wrote:
> Am Freitag, den 27.03.2009, 13:44 -0700 schrieb Martin Atkins:
>> Dirk Schulze wrote:
>>>
>>> Another example is: http://blahbleh.com/molecools.php?name=1,2%
>>> 20dimethylcyclopropane
>>>
>>> If you turn the molecule a bit, the circles disappear with a
>>> INDEX_SIZE_ERR exception.
>>>
>>> Isn't it better to just ignore the arc and go on with the drawing,
>>> like
>>> Firefox does? And perhaps the same for arcTo?
>>>
>>
>> Assuming that we desire a "do what I mean" approach, it seems sane
>> to me
>> for a negative radius to be normalized to a positive radius with the
>> same magnitude.
>>
>> It goes from being the distance from the center to the edge to
>> being the
>> distance from the center to the "opposite" edge.
>>
>> You might also like to visualize this as drawing the "back" of the
>> circle.
>
> A negative value doesn't mean, that you want an arc. They can happen
> during the automatic calculation process. There is no reason, that a
> developers takes negative values and wants to see an arc otherwise he
> could cut of the sign.
> I'm just speaking of ignoring negative arcs instead of giving an
> exception to continue further drawings.
>
> -Dirk
>
More information about the whatwg
mailing list