Programming Guide:xppguide

The high speed presentation space - Xbp:lockPS() Foundation

For common graphic output with Gra..() functions, a so called Micro presentation space is used (Micro PS). The operating system itself has a buffer of Micro PSs and supplies them on request to an application program. A Micro PS is optimized for high speed graphic output and is reused by the operating system. When a window uses a Micro PS and graphic output is done, the Micro PS is returned to the operating system where it is collected in a buffer for further requests. Therefore, time-consuming allocation and release of memory does not occur with a Micro PS.

A Micro PS can be used by all Xbase Parts subclassed from the XbpWindow class. It is requested and returned by the :lockPS() method. An Xbase Part has exclusive access to this Micro PS until it releases it with :unlockPS() and returns it to the operating system. On the Xbase++ language level, a Micro PS is represented by an object. It has the same methods as the XbpPresSpace class, except of the :create(), :configure() and :destroy() methods. Due to technical details of the operating system, a Micro PS can only be created by :lockPS() and must be released with :unlockPS().

The XbpCrt class is not subclassed from XbpWindow. Therefore, a Micro PS cannot be used by an XbpCrt window.

The general usage of a Micro PS follows this pattern:

oPS := oXbp:lockPS()              // request Micro PS 
Gra???( oPS, ... )                // graphic output 
oXbp:unlockPS()                   // release Micro PS 

A drawing is displayed in a Micro PS in the same way as in the presentation space of an XbpCrt window. However, due to its performance optimization, a Micro PS does not recognize graphic segments. The function GraSegOpen() plus corresponding functions for managing graphic segments cannot be used with a Micro PS. Furthermore, a Micro PS performs no screen buffering. This requires an Xbase Part to react to the xbeP_Paint event. When using a Micro PS, code must be implemended for graphic output to be displayed after each repaint event. This code can be programmed either in a function that is called by the :paint callback code block, or it must be programmed in the :paint() callback method of a derived class. An example of using a Micro PS can be found in the PRG file ...\SAMPLES\BASICS\PRESPACE\MICROPS.PRG.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.