
Vladimir Prus wrote:
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.
Hmmmm.... I'm not sure about this. Say for example that I am writing a WYSIWYG CAD application and I'd like to draw vertical and horizontal rulers. At 100% page view, I'd like the ruler to be a 1:1 with the actual screen at the designated resolution (say 72 DPI). How would I draw my ruler if the coordinates are abstracted in terms of percentage? (Aside: I'd want my app to remain consistent when in the future we get 200 DPI screens, BTW). IMO, we should choose one representation and one unit. In my mind, that would be float and millimeter (in addition to percentages). Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net