Re: Rounding with #xywh=percent:25,25,50,50

On Thu, Apr 7, 2011 at 2:12 AM, Philip Jägenstedt <philipj@opera.com> wrote:
> On Wed, 06 Apr 2011 16:01:20 +0200, Jack Jansen <Jack.Jansen@cwi.nl> wrote:
>
>>
>> On Apr 6, 2011, at 15:14 , Raphaël Troncy wrote:
>>
>>>> Yeah, I think we need to be more specific. My suggestion is to round
>>>> up, but am curious what ppl think.
>>>
>>> +1 ... and added to list of items to discuss next week.
>>
>>
>> ... And just after I pressed "send" I realised that "rounding up" isn't
>> the right term. I think we should round in such a way that we enclose at
>> least the specified region. Therefore, X and Y should be numerically rounded
>> down, and width and height numerically up.
>
> The doesn't quite have the effect of enclosing the specified region, as
> (10.5, 10.5, 20, 20) would get clamped to (10, 10, 20, 20), which misses 0.5
> px on the right and bottom. Similarly, (10.9, 10.9, 10.9, 10.9) would get
> clamped to (10, 10, 11, 11), which misses 0.8 px on the right and bottom.
> (The worst case with .999999 goes towards missing a whole row/column.)
>
> The formula for always enclosing the region would be:
>
> x' = floor(x)
> y' = floor(y)
> w' = ceil(x+w) - floor(x)
> h' = ceil(y+h) - floor(y)

Hmm, I see.

Unless that is a problem with any existing implementations, I can now
see an advantage to using (left, top, right, bottom) - which,
incidentally, is also similar to how CSS works.

Looking forward to the discussion!

Cheers,
Silvia.

Received on Thursday, 7 April 2011 01:22:07 UTC