From: Joel de Guzman (joel_at_[hidden])
Date: 2005-10-05 10:18:05
Vladimir Prus wrote:
> Joel de Guzman wrote:
>>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:
>>>and in a proper GUI library you should never set width to absolute value
>>>like that. Instead, you should do:
>>>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
>>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?
> You mean the the rule has millimeters as the unit an at 1:1 zoom you want 1
> millimeter of the ruler to be 1 millimeter on the screen? Then yes, you'll
> need some way to convert millimetres to units used on screen. Though I
> don't understand why you want such strict equality. You won't measure
> distances on the screen with a physical ruler anyway, right?
Why not ;-) ? Replace "screen" with "paper" and you'll want to
have accurate 1:1 layouts. This is the very essence of device
independence. If, say, I want to print a PCB (printed circuit
board) on a 300DPI laser printer, I'd want absolute accuracy,
otherwise, my components will not fit the holes. Device independence
means that both "screen" and "paper" should behave identically.
If I want 10cm on paper how can I create such a thing in an abstracted
relative coordinate system?
Bottom line: you'll want both absolute and relative dimensions.
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk