[vtk-developers] Supporting Resolution Independence in Cocoa

Mathieu Coursolle mcoursolle at rogue-research.com
Thu May 10 15:38:52 EDT 2007


Hi vtk developers,

Starting in Mac OS X 10.4 (and planned to be fully supported in 10.5) is
user interface resolution scaling. This means that the screen coordinate
system is no longer in pixels, but rather in points. Normally, 1 point =
1 pixel, but users might decide to change their settings to set the
scaling to a value higher than 1. See here for more info on the concept:
<http://en.wikipedia.org/wiki/Resolution_independence>

For example, let's say we want to create a 100 by 100 window on a system
for which the scale factor is 1.25, then the actual pixel size of the
window would be 125 pixels.

This does not seem to be supported by VTK, as the size of the window is
assumed to be in pixels, while it is in fact in points on Mac OS X 10.4
and later.

We have a patch to allow VTK to support resolution independence, but
would like some feedback from other vtk developers.

Q1) Should VTK APIs be pixel-based or point-based?  For example, is the
vtkWindow::GetSize() method meant to return values as pixels?

If so, some additionnal code could be written in the specialized class
of vtkWindow (ex: vtkCocoaRenderWindow) so that the GetSize() method
returns the actual pixel size of the window rather than its point size.
Of course, the specialized interactors should also convert their screen
positions from points to pixels.

Q2) How to deal with tests that compare against images?

This brings up another issue. If a 100 x 100 window is created, should
it be 100 pixels or 100 points? If it is 100 points, this means that it
might not be 100 pixels on screen. If so, most of the dashboard tests
will fail because the comparison images are in pixels.

We suggest that VTK APIs be pixel-based, for the above reasons and also
because OpenGL itself is pixel-based. If you agree, we could provide a
patch for Cocoa windows.

Thank you.

Mathieu

-- 
____________________________________________________________
Mathieu Coursolle                   mcoursolle at rogue-research.com
Rogue Research                      www.rogue-research.com 
Montréal, Québec, Canada




More information about the vtk-developers mailing list