Display Documents: size and scaling

Top  Previous  Next

 

Display Document Size:

A display document always has a size, which can be explicitly set.

 

If it is not set explicitly:

       The size of the document will be the extent of the objects within it.
       If an object is added to a document which exceeds the limit of its size, the size of the document will increase unless it has been explicitly set.

 

If it is set explicitly:        

       The size of the document will be unaffected by the objects within it (which may exceed the size of the document).

 

Displaying a Document:

If a document is displayed on a device with scaling on:

 

The document will be scaled so that the documents size corresponds to the whole of the physical display area. Any objects which exceed the size of the document will be clipped.

 

If a document is displayed on a device with scaling off:        

 

       If the document is smaller than the physical display, the size of the document has no effect. The background (and any objects which exceed the document) will be displayed. Any objects which exceed the size of the physical display will be clipped.)

 

       If the document is larger  than the physical display, scroll bars will appear to allow the larger document to be viewed.

 

If event coordinates are turned on (see DisplayEventCoords) the coordinates reported are the document's coordinates, regardless of scaling.

 

Example:

Here are two pictures of the same display, to the same scale, showing the same document, with scaling switched off:

 

DisplayScaleDocuments_ScalingOff

 

… and on:

 

DisplayScaleDocuments_ScalingOn

 

The document has not set its size explicitly, so it is scaled to the limit of the objects within it.

 

If we take the same document and set its size to 2000 x 2000, we would see the following on that monitor — with scaling off:

 

monitor (0,0)

document (0,0)

DisplaySetDocumentSize_ScalingOff

monitor (1279, 1023)

document (1279, 1023)

 

(Note that if the document is larger than the monitor and is not being scaled, scroll bars appear; if you want the document to be clipped with no scroll bars, set the document to the exact size of the monitor.)

 

… and with scaling on:

 

monitor (0,0)

document (0,0)

DisplaySetDocumentSize_ScalingOn

monitor (1279, 1023)

document (1999, 1999)

 

If the document set its size to something smaller than the limit of the objects within it, and scaling is switched on, then parts of the document will be clipped (just as if scaling is switched off and the document is larger than the physical display).

 

Note: documents are drawn faster when they are not being scaled (sometimes significantly, e.g. 12 ms versus 185 ms for a complete redraw of the document shown above on a 1020 x 717 non-exclusive, non-fullscreen DirectDraw window using a PIII-750 laptop with Whisker at 'normal' thread priority). This delay does not affect client communications (as redrawing is performed by a separate thread), and the time during which the visible display is being updated is less than 1 ms – for DirectDraw windows, the drawing routines draw to a memory buffer and then use a rapid technique for switching that memory to video RAM – thus, the 12/185 ms delay is the approximate lag from issuing a DisplayShowDocument command to the document appearing on the screen. If video performance is critical, use a full-screen DirectDraw window, switch WhiskerServer into real-time mode and do not scale documents.

 

Development note: benchmark these optimal conditions in CDisplayView.