Jump to content

PDRREF:Bit-Map Simulation for 16-Bit Hardcopy Drivers

From EDM2
Presentation Device Driver Reference for OS/2
  1. Introduction to OS/2 Presentation Drivers
  2. Design Considerations for All Drivers
  3. Graphics Engine/Presentation Driver Design Changes
  4. Design Considerations for Display Drivers
  5. Design Considerations for Hardcopy Drivers
  6. Display Drivers
  7. Distributed Console Access Facility (DCAF) Architecture
  8. Graphics Engine Hardcopy Drivers
  9. Queue Drivers
  10. Port Drivers
  11. Presentation Manager Function Categories
  12. Exported Driver Function Reference
  13. Mandatory and Simulated Graphics Engine Function Reference
  14. Device Support Function Reference
  15. DBIDI Command Structures and Command Flow

Appendixes

A - OS/2 Version Compatibility Considerations
B - Syntax Conventions
C - Format of the Journal File
D - Bit-Map Simulation for 16-Bit Hardcopy Drivers
E - Data Types
F - Notices

Miscellaneous

G - Glossary

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

Presentation drivers for monochrome raster devices can use the system's display driver, DISPLAY.DLL, to draw the page image on a bit map. This technique reduces the amount of code in the hardcopy driver and ensures that all devices use the same drawing algorithms.

To use the display driver, the hardcopy driver has to open and manage a display DC. It must do this without invoking the graphics engine (the hardcopy driver has to act as if it were the engine). When an application opens a hardcopy DC, the Enable subfunctions in the hardcopy driver must issue appropriate calls to the Enable subfunctions in the display driver.

Note
This technique works well for IBM display drivers. However, when using OEM display drivers, the use of this technique might result in an incompatibility.


These Enable subfunctions perform the following actions:

FillLogicalDeviceBlock

1.Loads the display driver and gets the address of its enable entry point.

2.Saves a copy of the default dispatch table to pass to the display driver's FillLogicalDeviceBlock routine.

3.Calls the display driver's enable entry point with the parameters set for FillLogicalDeviceBlock and passes a pointer to the saved default dispatch table. The display driver initializes this dispatch table and it can then be used to pass Grexxx routines to the display DC.

FillPhysicalDeviceBlock

1.Saves the address of the display driver's enable entry point in the hardcopy driver's physical device block.

2.Calls the display driver's enable entry point with the parameters set for FillPhysicalDeviceBlock and OD_MEMORY device type.

3.Saves the value returned from the display driver's FillPhysicalDeviceBlock routine. (The value, ulStateInfo, is passed back to the display driver's EnableDeviceContext routine.)

Note
In some source code, the name pDCI is used for the ulStateInfo parameter.
EnableDeviceContext

1.Calls the display driver's enable entry point with the parameters set for EnableDeviceContext. The DENPARAMS structure passed to the EnableDeviceContext routine contains the same DC handle (ulHDC) that was received by the hardcopy driver.

2.Saves the value returned from the display driver's FillPhysicalDeviceBlock routine. This value, pInstance, needs to be passed back to the display driver on every call through the dispatch table.

Note
In the source code, pInstance might occasionally be referred to as the "magic cookie".
CompleteOpenDC

1.Calls the display driver's enable entry point with the parameters set for CompleteOpenDC.

Any Grexxx functions called from the operating system to the DC will enter the hardcopy DC through its dispatch table. Function handling routines in the hardcopy driver monitor the incoming calls and redirect those calls that affect the image through the display DC's dispatch table. When a GreEscape routine for DEVESC_NEWFRAME or DEVESC_ENDDOC is detected, the hardcopy driver transfers the bit-map bits from the display DC to a local buffer and sends them as scan lines or bands to the physical device driver.