|
Re: DPI & platform independent figure bounds [message #245053 is a reply to message #245009] |
Thu, 21 August 2008 04:15 |
Alex Boyko Messages: 200 Registered: July 2009 |
Senior Member |
|
|
Hi,
This problem is resolved in GMF with a MapMode concept. Essentially,
figure coordinates are kept in some generic units. MapMode scaling factor
is initialized at the application runtime, based on DPI, Screen Resolution
etc. Before figure is painted, its generic units coordinates are scaled by
the factor from map mode object, this results in a pixel value for
figure's bounds.
MapMode is defined as some top level figure that owns primary layer and
connection layer, such that primary layer and connection layer figures are
scaled for painting only, i.e. scale factor is pushed on the graphics
object stack.
There are drawbacks in using map mode such as precision. Scaling factor is
non-integer, yet figure coordinates are integer. Therefore precision
errors may occur as a result of translations and you'll be forced to use
precison points, rectangles etc.
You need to explore GMF draw2d component for more information. You'll see
methods DPtoLP(...) and LPtoDP(...) - device unit to logical unit and
logical to device. Device unit = pixel, logical unit = generic unit.
Hope this helps.
Cheers,
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.02093 seconds