Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-10-05 09:01:40

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:
>> 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?

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?

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at