Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-10-05 07:47:24


Joel de Guzman wrote:

> Vladimir Prus wrote:
>> Stefan Seefeld wrote:
>>
>>>Device coordinates are not ok to determine object size, because that
>>>means that objects have differing sizes on different output devices
>>>(multiple screens, printers, etc.) and so users wrongly tweak resolution
>>>to get back their wanted object sizes.
>>
>>
>> You should never specify object size at all. The size of main window
>> should be set the GUI library, or set as proportion of screen size. The
>> child windows should be laid out by GUI or resizes as proportion of main
>> windows size. So, you don't care what unit is used, since you never
>> specify absolute sizes.
>
> I think you are mising each other by miles. Volodya, as much as I want
> to and tried to, I can't understand what you are trying to say.

I'm trying to say that the choice of coordinate unit -- pixel, millimeter,
inch, whatever, is only important if you need to write:

   window.setWidth(10cm);

and in a proper GUI library you should never set width to absolute value
like that. Instead, you should do:

   window.setWidth(screen_width()*some_constant);

In that case "screen_width()" can return SomeVeryOpaqueType that you can
multiply by float, but can't convert to pixel, or to to inch, or to
anything else.

>> So, I believe that the ideal coordinate system unit is nothing more that
>> "int".
>
> For vector graphics, that would be float/double (or fixed-point).

Well, for SVG it's already float, and we can't change that part.
Still I'm not sure why float is a good idea for drawing operations in a GUI
library.

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk