PDDR/2 - 32-Bit Plotter Presentation Driver
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation
|Printer Device Driver Reference|
The Plotter Presentation Driver is a 32-bit vector graphics driver. Vector graphics drivers use drawing primitives, such as lines, arcs, boxes, circles, and area fills, to draw complex graphics images. The Plotter Presentation Driver relies on the graphics language capabilities of the printer or plotter to do the actual drawing.
For example, to draw a circle, the plotter driver sends the circle command with radius information to the printer. The printer has the responsibility of drawing the circle on the device.
The vector graphics languages that this driver supports are Hewlett-Packard Graphics Language (HP-GL and HP-GL/2) and IBM Graphics Language (IBM-GL). If the device or graphics language does not support the OS/2 drawing function, the driver will either call back to the graphics engine for simulation or convert the drawing function to a supported primitive. For example, an OS/2 FillPath call might be converted to a HP-GL/2 FillPolygon.
The Plotter Presentation Driver can also support devices that can mix HP-GL/2 and raster data such as laser printers or raster plotters. In the DEBUG version of the driver, a sample PCL laser printer is supported. The RETAIL and DEBUG versions of the driver support raster plotters using the HP-RTL language.
The files that comprise the Plotter Presentation Driver are PLOTTERS.DRV and PLOTTERS.HLP. PLOTTERS.DRV is the executable code and data of the driver. The PLOTTERS.DRV file exports OS2_PM_DRV_ENABLE, OS2_PM_DRV_DEVMODE, and OS2_PM_DRV_DEVICENAMES entry points. PLOTTERS.DRV has an extended attribute (EA) that must be present for the driver to be installed correctly. The PLOTTERS.HLP file contains the help panels for the Job Properties and Printer Properties dialog boxes of the driver.
- 1 Generic Printer Library (GenPLib)
- 2 Font Support
- 3 Plotter Modules and Functions
- 4 Module and Function Descriptions
- 4.1 ATTRIBS.C
- 4.1.1 DeviceGetAttributes()
- 4.1.2 DeviceSetAttributes()
- 4.1.3 DeviceSetDCOrigin()
- 4.1.4 DeviceSetGlobalAttribute()
- 4.1.5 ErasePS()
- 4.1.6 get_area_attr_bundle()
- 4.1.7 get_char_attr_bundle()
- 4.1.8 get_image_attr_bundle()
- 4.1.9 get_line_attr_bundle()
- 4.1.10 get_marker_attr_bundle()
- 4.1.11 GetDCOrigin()
- 4.1.12 GetStyleRatio()
- 4.1.13 initialize_ddc()
- 4.1.14 LockDevice()
- 4.1.15 set_area_attr_bundle()
- 4.1.16 set_char_attr_bundle()
- 4.1.17 set_image_attr_bundle()
- 4.1.18 set_line_attr_bundle()
- 4.1.19 set_marker_attr_bundle()
- 4.1.20 SetStyleRatio()
- 4.1.21 UnlockDevice()
- 4.1.22 validate_any_color()
- 4.1.23 validate_background_color()
- 4.1.24 validate_background_mix()
- 4.1.25 validate_foreground_color()
- 4.1.26 validate_foreground_mix()
- 4.2 BAND.C
- 4.3 BITMAP.C
- 4.3.1 begin_raster_graphics
- 4.3.2 bin_output_bytes
- 4.3.3 Bitblt
- 4.3.4 bitblt2
- 4.3.5 Build_Palette
- 4.3.6 convertbgr_to_rgb
- 4.3.7 DeviceCreateBitmap()
- 4.3.8 DeviceDeleteBitmap()
- 4.3.9 DeviceSelectBitmap()
- 4.3.10 DeviceSetCursor()
- 4.3.11 download_pattern
- 4.3.12 DrawBits
- 4.3.13 DrawBorder()
- 4.3.14 DrawImage
- 4.3.15 end_raster_graphics
- 4.3.16 enter_PCL_or_HPRTL
- 4.3.17 fill_pattern
- 4.3.18 fill_pattern_Use_Device
- 4.3.19 GetBitmapBits()
- 4.3.20 GetBitmapHandle
- 4.3.21 GetGreyPattern
- 4.3.22 GetNextColor
- 4.3.23 GetPel()
- 4.3.24 greyscalesourcebits
- 4.3.25 ImageData()
- 4.3.26 image_scan
- 4.3.27 ImageScan
- 4.3.28 locate_rfpen
- 4.3.29 sdBitBlt
- 4.3.30 set_graphics_position
- 4.3.31 set_raster_width_and_height
- 4.3.32 Set_RFIndex
- 4.3.33 RestoreScreenBits()
- 4.3.34 return_to_HPGL2
- 4.3.35 rotate_4bpp_90
- 4.3.36 rotate_8bpp_90
- 4.3.37 rotate_bmap_90
- 4.3.38 SaveScreenBits()
- 4.3.39 SetBitmapBits
- 4.3.40 SetPel
- 4.3.41 Set_Palette
- 4.3.42 vector_bitmap
- 4.4 BOUNDS.C
- 4.5 BOX.C
- 4.6 CHARGEN.C
- 4.7 CLIP.C
- 4.8 COLOR.C
- 4.8.1 check_area_background_color()
- 4.8.2 check_area_color()
- 4.8.3 check_char_background_color
- 4.8.4 check_char_color()
- 4.8.5 check_color_sorting
- 4.8.6 check_line_color()
- 4.8.7 check_marker_color()
- 4.8.8 color_distance()
- 4.8.9 constrain_hls
- 4.8.10 convert_color()
- 4.8.11 create_default_color_table()
- 4.8.12 CreateLogColorTable()
- 4.8.13 devicepalette
- 4.8.14 get_closest_color()
- 4.8.15 get_closest_pen
- 4.8.16 get_color_group()
- 4.8.17 locate_HPGL2pen()
- 4.8.18 locate_pen()
- 4.8.19 QueryColorData()
- 4.8.20 QueryColorIndex()
- 4.8.21 QueryLogColorTable()
- 4.8.22 QueryNearestColor()
- 4.8.23 QueryRealColors()
- 4.8.24 QueryRGBColor()
- 4.8.25 RealizeColorTable()
- 4.8.26 return_rf_fill_pen
- 4.8.27 rgb_to_hls()
- 4.8.28 select_fill_pen()
- 4.8.29 select_fill_type()
- 4.8.30 select_HPGL2pen()
- 4.8.31 select_line_pen()
- 4.8.32 select_text_pen()
- 4.8.33 select_user_defined_pen()
- 4.8.34 set_HPGL2_color_palette
- 4.8.35 set_mix_mode
- 4.8.36 set_pen()
- 4.8.37 set_pen_width()
- 4.8.38 set_transparency_mode()
- 4.8.39 setup_raster_fill_index
- 4.8.40 start_color_sorting()
- 4.8.41 stop_color_sorting()
- 4.8.42 UnrealizeColorTable()
- 4.9 COMPRESS.C
- 4.10 DEVMODE.C
- 4.10.1 build_app_name
- 4.10.2 check_menuitem
- 4.10.3 check_pen
- 4.10.4 check_pens
- 4.10.5 CleanUpHelpStubHook
- 4.10.6 clear_entries
- 4.10.7 display_carousel
- 4.10.8 display_colors
- 4.10.9 display_paper_size
- 4.10.10 display_pen
- 4.10.11 display_pens
- 4.10.12 EA_GetVersion
- 4.10.13 get_group
- 4.10.14 get_module_dir
- 4.10.15 get_string
- 4.10.16 GetMeasureItemInfo
- 4.10.17 help_dialog_proc
- 4.10.18 HelpErrorFilter
- 4.10.19 HelpStubHook
- 4.10.20 init_dialog
- 4.10.21 InitializeHelp
- 4.10.22 list_pen_options
- 4.10.23 list_pen_priority
- 4.10.24 main_dialog_command
- 4.10.25 main_dialog_proc
- 4.10.26 options_dialog_proc
- 4.10.27 OS2_DevPostDeviceModes
- 4.10.28 pencolor_dialog_proc
- 4.10.29 priority_dialog_proc
- 4.10.30 ReleaseHelpStubHook
- 4.10.31 reset_entries
- 4.10.32 save_profile
- 4.10.33 SetHelpStubHook()
- 4.10.34 switchbetween_rgb_carousel
- 4.10.35 szStrCopy
- 4.10.36 update_menu
- 4.11 DISPATCH.C
- 4.12 DOSIO.C
- 4.13 ENABLE.C
- 4.13.1 disable_dc_begin
- 4.13.2 disable_dc_complete
- 4.13.3 disable_pdev
- 4.13.4 enable
- 4.13.5 enable_dc_begin
- 4.13.6 enable_dc_complete
- 4.13.7 fill_ldev
- 4.13.8 fill_pdev
- 4.13.9 fill_pdev_save_dc_data
- 4.13.10 initialize_pdevice
- 4.13.11 querydevicesurface
- 4.13.12 reset_dc_state
- 4.13.13 restore_dc_state
- 4.13.14 save_dc_state
- 4.13.15 setup_colors
- 4.14 ESCQUERY.C
- 4.15 FONT.C
- 4.15.1 cpxfm_metrics
- 4.15.2 DeviceQueryFontAttributes()
- 4.15.3 DeviceQueryFonts
- 4.15.4 FindVectorLength
- 4.15.5 GetExtraIncrements
- 4.15.6 GetHorizTextAlignShift
- 4.15.7 GetStandardAlignment
- 4.15.8 GetVertTextAlignShift
- 4.15.9 QueryCharPositions()
- 4.15.10 QueryTextBox
- 4.15.11 QueryWidthTable
- 4.15.12 RealizeFont()
- 4.16 FORMS.C
- 4.16.1 add_user_form
- 4.16.2 add_user_forms_to_list
- 4.16.3 convert_list
- 4.16.4 delete_user_form
- 4.16.5 delete_user_forms_from_list
- 4.16.6 display_error
- 4.16.7 display_form_id
- 4.16.8 display_user_form_paper_size
- 4.16.9 find_user_form_size
- 4.16.10 HeightNumericSubProc
- 4.16.11 id_conflicts
- 4.16.12 IDNumericSubProc
- 4.16.13 initialize_user_forms
- 4.16.14 llAddElement
- 4.16.15 llCreateElement
- 4.16.16 llDeleteElement
- 4.16.17 llFindElement
- 4.16.18 llFreeAllElements
- 4.16.19 measurement_to_string
- 4.16.20 modify_user_form
- 4.16.21 name_conflicts
- 4.16.22 number_user_forms_defined
- 4.16.23 return_flat_user_forms_list
- 4.16.24 save_user_form
- 4.16.25 string_to_measurement
- 4.16.26 user_defined_forms_dialog_proc
- 4.16.27 user_form_exists_exists
- 4.16.28 WidthNumericSubProc
- 4.17 GLIB.ASM
- 4.18 INIT.ASM
- 4.19 INITTERM.C
- 4.20 LOCKDDC.C
- 4.21 MARKER.C
- 4.21.1 draw_polymarker_circle
- 4.21.2 draw_polymarker_cross
- 4.21.3 draw_polymarker_diamond
- 4.21.4 draw_polymarker_dot
- 4.21.5 draw_polymarker_eightpointstar
- 4.21.6 draw_polymarker_plus
- 4.21.7 draw_polymarker_sixpointstar
- 4.21.8 draw_polymarker_solidsquare
- 4.21.9 draw_polymarker_soliddiamond
- 4.21.10 draw_polymarker_square
- 4.21.11 PolyMarker (Exported)
- 4.22 NEW.ASM
- 4.23 OUTPARC.C
- 4.23.1 Arc (Exported)
- 4.23.2 construct_chord_tolerance
- 4.23.3 ConvertArcParams
- 4.23.4 draw_fullarc
- 4.23.5 FullArcBoth
- 4.23.6 FullArcBoundary
- 4.23.7 FullArcInterior
- 4.23.8 get_angle
- 4.23.9 get_arc_center
- 4.23.10 get_distance
- 4.23.11 get_line_intersection
- 4.23.12 get_perpendicular_bisect
- 4.23.13 is_elipse
- 4.23.14 PartialArc
- 4.23.15 PolySpline
- 4.23.16 set_arc_scale
- 4.23.17 SetArcParameters
- 4.24 OUTPLINE.C
- 4.25 OUTPUT.C
- 4.25.1 check_fill_type
- 4.25.2 check_line_construction
- 4.25.3 check_string_construction
- 4.25.4 construct_fixed
- 4.25.5 construct_float
- 4.25.6 construct_point
- 4.25.7 convert_point
- 4.25.8 draw_line
- 4.25.9 draw_point
- 4.25.10 end_doc
- 4.25.11 end_job
- 4.25.12 end_page
- 4.25.13 get_closest_point
- 4.25.14 lift_pen
- 4.25.15 move_pen
- 4.25.16 next_band
- 4.25.17 output_comma
- 4.25.18 output_number
- 4.25.19 output_point
- 4.25.20 plot_line
- 4.25.21 send_header
- 4.25.22 send_trailer
- 4.25.23 set_default_p1p2
- 4.25.24 set_default_scale
- 4.25.25 set_empty_rect
- 4.25.26 set_line_type
- 4.25.27 set_p1p2
- 4.25.28 set_scale
- 4.25.29 set_rotation
- 4.25.30 start_doc
- 4.25.31 start_job
- 4.25.32 start_page
- 4.26 PATHS.C
- 4.26.1 BeginArea
- 4.26.2 clear_patsym_area
- 4.26.3 draw_patsym_diag
- 4.26.4 draw_patsym_horiz
- 4.26.5 draw_patsym_vert
- 4.26.6 draw_pattern_lines
- 4.26.7 EndArea
- 4.26.8 fill_clip_area
- 4.26.9 fill_polygon
- 4.26.10 fill_the_clip_rectangles
- 4.26.11 FillPath
- 4.26.12 PaintRegion
- 4.26.13 PolygonSet
- 4.26.14 StrokePath
- 4.27 PLOTTERS.C
- 4.28 PRDMATH.ASM
- 4.29 PROFILE.C
- 4.30 TEXTOUT.C
- 4.30.1 adjust_char_attrs
- 4.30.2 calc_QTB
- 4.30.3 CharString
- 4.30.4 CharStringPos
- 4.30.5 clip_char
- 4.30.6 GetCodePage
- 4.30.7 GetPairKerningTable
- 4.30.8 set_cell_angle
- 4.30.9 set_cell_shear
- 4.30.10 set_cell_size
- 4.30.11 set_char_angle
- 4.30.12 set_char_italic_bold
- 4.30.13 SetCodePage
- 4.30.14 string_clip
- 4.31 UTILS.C
- 4.31.1 clear_memory
- 4.31.2 compare_memory
- 4.31.3 ConvertWithRotation
- 4.31.4 copy_memory
- 4.31.5 distance
- 4.31.6 fill_opt_end
- 4.31.7 fill_opt_init
- 4.31.8 find_device_name
- 4.31.9 find_printer_name
- 4.31.10 flush_opt_buffer
- 4.31.11 free_memory
- 4.31.12 get_mod_handle
- 4.31.13 int_to_str
- 4.31.14 IsIta_COM_Port_Name
- 4.31.15 IsIta_Device_Name
- 4.31.16 lstrcmp
- 4.31.17 lstrcpy
- 4.31.18 lstrlen
- 4.31.19 lstrncmp
- 4.31.20 lstrtoksrch
- 4.31.21 prompt_for_carousel
- 4.31.22 prompt_for_page
- 4.31.23 queue_opt_buffer
- 4.31.24 return_driver_data
- 4.31.25 round_divide
- 4.31.26 save_mod_handle
- 4.31.27 str_to_int
- 4.31.28 to_upper
- 4.32 XFORMS.C
- 4.1 ATTRIBS.C
Generic Printer Library (GenPLib)
The Generic Printer Library is a set of subroutines that are useful for 32- bit presentation drivers. The Plotter Presentation driver takes advantage of the following GenPLib functions:
- Memory management routines
- Multi-threading output capabilities
- Error and debugging support routines
For further information about the Generic Printer Library, see Generic Printer Library.
The example plotter driver code supports only one device font. The HP-GL/2 or IBM-GL font named Stick is the plotter driver's default font. This font is a fixed-spaced, scalable font. A fixed-spaced, scalable font is one that can be scaled to any character width and height by setting the character attribute CBB_BOX. As soon as the font is scaled, the width of all characters will be constant.
Changing the code to support another fixed-spaced, scalable font is not difficult and can be achieved through the following steps:
- Add a data structure to #PLOTTERS.C enumerating the FONTMETRICS information of each supported font.
- Change the PlotterClass data structure in #PLOTTERS.C to include a bit fields defining which fonts each device supports and the appropriate default font.
- Modify the #initialize_pdevice() function in #ENABLE.C to set the correct default device font.
- In #FONT.C, make #DeviceQueryFonts() return the additional fonts and make #RealizeFont() select the font.
Adding proportional-spaced fonts requires the following additional changes:
- In #FONT.C, modify #cpxfm_metrics() to scale the width of all the characters in the font.
- Change the character positioning functions #QueryTextBox(), #QueryWidthTable(), and #QueryCharPositions() to use the proportional font character width and kerning information.
The plotter driver uses a combination of the device name and the device class to support printers. The device name is the name of the device that is used to look up the corresponding device class information in the plotter driver's plotter definition table, PlotterDef.
The PlotterClass data structure contains all the information describing the characteristics of the of the device.
The plotter driver currently supports the following devices and corresponding device classes:
- IBM6180 CLASS_HP7440A
- IBM6182 CLASS_HP7550A
- IBM6184 CLASS_HP7570A
- IBM6186 CLASS_HP7595A
- IBM6186 CLASS_HP7596A
- IBM7371 CLASS_HP7470A
- IBM7372 CLASS_HP7475A
- IBM7374 CLASS_HP7580B
- IBM7375-1 CLASS_HP7585B
- IBM7375-2 CLASS_HP7586B
- HP7440A CLASS_HP7440A
- HP7470A CLASS_HP7470A
- HP7475A CLASS_HP7475A
- HP7550A CLASS_HP7550A
- HP7570A CLASS_HP7570A
- HP7580A CLASS_HP7580A
- HP7580B CLASS_HP7580B
- HP7585A CLASS_HP7585A
- HP7585B CLASS_HP7585B
- HP7586B CLASS_HP7586B
- HP7595A CLASS_HP7595A
- HP7596A CLASS_HP7596A
- PaintJet XL HP-GL/2 CLASS_PAINTJET_XL
- DesignJet 600 CLASS_DESIGNJET600
- DesignJet 650C CLASS_DESIGNJET650
- DraftMaster SX CLASS_DRAFTMASTER_SERIES
- DraftMaster RX CLASS_DRAFTMASTER_SERIES
- DraftMaster MX CLASS_DRAFTMASTER_SERIES
To add a new device that will be supported by an existing class, complete the following steps:
- Add the device name to the PlotterDef table in #PLOTTERS.C.
- Add a define in DIALOG.H that defines a numeric constant for your device. The numeric constant will be used to load the device description string that you must add to the PLTUS.RC file.
To add a new device class to the plotter driver, complete the following steps:
- Add a new PlotterClass structure to PLOTTERS.C defining your new class.
- Add a define in PLOTTERS.H for the class.
- Add an entry to the PlotterDef table along with a device name that uses the class.
Plotter Modules and Functions
This section provides a layout of the Plotter Presentation Driver source code. Refer the DDK CD for the Plotter Presentation Driver source code and to the "Using Your DDK", also available on the DDK CD, for a roadmap of the file structure used by the source code.
The first part of this section lists in alphabetical order all functions found in the Plotter code. The module in which each function is found is listed next to the function.
The second part of this section lists the modules that comprise the Plotter driver and the functions that comprise each module. Each function is followed by a description.
|Function Name||Module Location|
|PSZ ENGENTRY SetMem||INIT.ASM|
Module and Function Descriptions
This section describes the modules that comprise the Plotter driver and the functions that comprise each module. Each function is followed by a description. The functions in each module are listed in alphabetical order.
This module contains plotter driver attributes.
Gets plotter driver attributes. This function is the entry point for external processes to obtain information about the current attributes of the plotter driver.
Sets plotter driver attributes. This function is the entry point for external processes to modify the current plotter driver attributes.
Sets the DC origin. The device origin is 0,0 when enabled. The device is responsible for adding this offset to all transformed coordinates. The plotter driver returns errors because SetDCOrigin is not journaled and would cause problems in color-sorting mode.
Sets the global attributes of different types of attributes.
Resets the presentation space.
Returns information from the current area attribute bundle according to the AttrsMask parameter.
Returns information from the current characterattribute bundle according to the AttrsMask parameter.
Returns information from the current image attribute bundle according to the AttrsMask parameter.
Returns information from the current line attribute bundle according to the AttrsMask parameter.
Returns information from the current marker attribute bundle according to the AttrsMask parameter.
Gets the Device Context origin. Assigns values to the coordinates.
Used for banding printers that use the display driver for writing into bit maps. The plotter returns 1:1.
Initializes device driver instance. Resets the device driver instance data structure to its base state.
Locks a device.
Sets area attributes.
Sets information from the current character attribute bundle according to the AttrsMaskparameter.
Sets image attributes.
Sets line attributes.
Sets marker attributes.
Sets the style ratio.
Allows all pending screen input or output operations that were blocked by #LockDevice() to continue.
Validates background color.
Validates background mix.
Validates foreground color.
Validates foreground mix.
This module contains the callback function passed to GenPLib banding routines.
Retrieves surfacebitmapinfo and fills the appropriate structures to internally call the #sdBitBlt function to output the surface.
This module contains bit-map related functions.
Sends the necessary commands to get into raster graphics transfer mode.
Note: Raster Mode may be either PCL or RTL.
Outputs binary data by calling the thread code to output the data on the second thread.
Note:This function should only be called after output_bytes has been called at least once. output_bytes makes sure the header information has been sent.
Transfers bit maps directly from memory. The plotter driver supports Bitblt only to bypass an optimization in the engine. This optimization causes the engine to use the driver's Bitblt() function to perform area fills. Therefore, you must verify that the function is the area fill (ROP_PATCOPY) , verify the options, and then continue. Anything else is rejected as if the function is not installed.
Note: This function was completely rewritten to support the Raster Operations.
The BitBlt function copies a bitmap from one presentation space to another. It can also modify the bitmap within a rectangle in a presentation space. The exact operation carried out by BitBlt depends on the raster operation specified by the Mix parameter.
If Mix directs BitBlt to copy a bitmap, the function copies the bitmap from a source presentation space specified by hdcSrc to a target presentation space specified by hDC. Each presentation space must be associated with a device context for the display, for memory, or for some other suitable raster device. The target and source presentation spaces can be the same if desired. The pXY parameter points to an array of points that specify the corners of a rectangle containing the bitmap in the source presentation space as well as the corners of the rectangle in the target presentation space to receive the bitmap. If the source and target rectangles are not the same, BitBlt stretches or compresses the bitmap to fit the target rectangle.
If Mix directs BitBlt to modify a bitmap, the function uses the raster operation to determine how to alter the bits in a rectangle in the target presentation space. Raster operations include changes such as inverting target bits, replacing target bits with pattern bits, and mixing target and pattern bits to create new colors. For some raster operations, the function mixes the bits of a bitmap from a source presentation space with the target and/or pattern bits.
This function is hooked for PCL color devices. If bitmap stretching is necessary, this function gets the bits from a bitmap and sends them to the device. If bitmap stretching is not necessary, this function calls back to the engine to get #sdBitBlt.
Sets the PCL/RTL Palette and outputs the necessary escape sequences to the device to build the Color Palette in the device.
Converts a source scan line from BGR format and to RGB order.
Creates a plotter driver bit map. This function is called to create a bit map of the specified form and to obtain its handle.
Deletes a plotter driver bit map. This function is called to destroy a specified bit map created by #DeviceCreateBitmap().
Selects a plotter driver bit map. This function tells the device driver that a new bit map is being selected into the given DC.
Sets the cursor bit map that defines the cursor shape. This function will return an error.
Draws a rectangle of bits.
Draws a border inside a rectangle and optionally fills the interior. This is a #Bitblt accelerator and will return an error.
Projects the image of a rectangle onto the source DC's bit map and onto the printer.
Sends the necessary commands to get out of raster graphics transfer mode.
Note: Raster Mode may be either PCL or RTL.
Sends the necessary commands to get the plotter into PCL or HPRTL mode. This is necessary to setup the device for a raster transfer.
Called from #Bitblt for ROP_PATCOPY. Fills a rectangle specified by the rclDst with the pattern bits in pBits.
Handles both HPGL2 and PCL to fill a rectangle with patterns. This function is called from #Bitblt for ROP_PATCOPY with user pattern.
Transfers bit map data from the specified DC to application storage. The DC must be a memory hDC with a bit map currently selected.
Returns the bit map handle.
Returns the pattern byte to the caller.
Reads source color bits and determines the number of pels that are the same color as the first pel. This function enables you to greyscale many pels at one time. This function returns the current RGB color and updates the pointers to the source bits, the current pel position, and the total number of continuous pels of the current RGB color.
Gets a pel from a position specified in world coordinates. This function returns -1 for error. Otherwise, it returns the color table index value for the pel.
Takes the current source bit map and converts the bit map into a greyscaled 1,1 bits into pBits.
Draws a row of image data.
Outputs the commands to transfer data to the device and transfers the data.
Outputs the commands to transfer data to the device and transfers the data.
Takes a color value in RGB format, looks through the currently defined pens for the color, and returns the pen number. If a pen with the same RGB color is not found, this function defines a new pen for the given color and returns that pen number.
Called from the new raster GRE if we hooked the function #querydevicesurface. This function prints an array of pre-clipped and pre-stretched bit maps.
Sends the necessary commands to set the position while in PCL or HPRTL mode.
Sends the necessary commands to set the source width. The destination width and height will only be set if you are scaling the bitmap.
Sets the Raster Fill index and the height and width of the rectangle. This function is called from #fill_pattern_Use_Device.
Restores a rectangle of bits saved by #SaveScreenBits(). Because this is a printer, the driver logs and error.
Sends the necessary commands to get the plotter back into HPGL mode from raster mode.
Note:Raster Mode may be either PCL or RTL.
Called from #rotate_bmap_90, this function rotates a bitmap 4 bits-per-pel by 90 degrees. This function assumes that the source is byte aligned.
Called from #rotate_bmap_90, this function rotates a bitmap 8 bits-per-pel by 90 degrees. This function assumes that the source is byte aligned.
Depending on the number of bits per pel, this function calls the appropriate function to rotate a bitmap by 90 degrees. This function currently supports only four and eight bit-per-pel bitmaps. This function is called from #fill_pattern_Use_Device and #download_pattern.
Saves a rectangle of bits from the screen. The plotter driver returns an error.
Sets a plotter driver bit map. This function transfers bit map data from application storage to the specified DC. The DC must be a memory hDC, with a bit map currently selected.
Sets a pel from a position specified in world coordinates. The plotters driver returns OK for this function.
Controls the PCL/RTL palette. This function performs the following:
- Saves the HPGL2 Palette, if it is not already saved.
- Sends the necessary configure image data command to the device. The configure image data command is based on the cBitCount of the bit map.
- Sets the number of bits per index in the Configure Image data command.
- Calls the Build_Palette to build the Palette.
Turns the bitmap into line commands for non-raster devices (pen plotters).
This module contains functions that control bounds accumulation.
Adds the given bounds into the existing bounds.
Determines the bounding box of the line whose end points are passed.
Returns bounds data to user. The units that are returned are specified by the parameters.
Resets either or both sets of bounding data.
This module contains functions associated with drawing boxes.
Draws the edges of a box and fills the interior. One corner is the current position, the other corner is supplied. The box can have rounded corners.
Draws the boundary lines of a box. The box can have rounded corners.
Draws the interior of a box. The box is drawn from the current position to a position supplied to the function. The box can have rounded corners.
Determines the bounding rectangle for the array of POINTLs given.
Generates the plotter command to draw a box from the current position to the given end point. The box can be a filled box or a boundary box.
This module contains output functions for device font characters.
Generates a sequence of commands to produce the desired character. Any manipulation that is required is performed, including switching to another character set.
This module contains clipping routines for the OS/2 Plotter Presentation Driver.
Determines the overall clipping rectangle and returns it to the caller. If the prIn of the passed-in rectangle is not zero, it is included. If the prIn of the passed-in rectangle is zero, it is ignored. The basic clipping information is obtained from the DDC.
Following are the three states of the clipping handles:
- AC_RECT0 (Effectively) no clipping. prResult untouched.
- AC_RECT1 One clip rectangle, returned in prResult.
- AC_RECT2 Multiple clipping rectangles.
When this function is given the horizontal components (x) of four co-linear points that intersect a quadrilateral's extended boundary walls, it returns the values of the innermost two (those that span the interior of the figure ).
Returns the rectangular bounds (bounding box) of a point list.
Returns a rectangle of an arbitrary height extending above a given scan line. When bStart is true, the first scan line is processed. When bStart is false, the next scan line is processed.
Initializes the QCINFO structure supplied by the caller.
Merges the myriad of clip rectangles to produce the largest single rectangle that covers the area.
Called whenever an application requests to change any of the clipping bounds for the current PS/DC pair.
Sets the current soft clip limits at the plotter device.
- This routine is called from multiple locations within the driver. It is important not to modify the pClipRect data fields within the pPDevice portion of the driver instance data.
- If ClipComplexity == 0 and pPDevice->ClipComplexity == 1, the rectangle is a null rectangle.
Sets the clipping region of the shadow memory DC. This function copies the DC region of the DC and sets the same in the shadow memory DC. Therefore, both will be in sync.
Sorts the corner points of a quadrilateral into counter-clockwise order. The result is returned in the original array.
Intersects the last two parameters and returns the result in the first parameter.
Sets the current soft clip limits at the plotter device.
This module contains color/pen and pattern support functions for the OS/2 Plotter driver.
Checks the area background color and validates the capability of the plotter to output the current area fill color.
Checks the area color and validates the capability of the plotter to output the current area fill color.
Checks char background color and validates the capability of the plotter to output the current charbackground fill color.
Checks the character color and validates the capability of the plotter to output the current character color.
Determines the available pen color that is nearest to the requested color and uses this pen in direct mode. If you are playing back the journal file, you can only record the information.
Checks the line color and validates the capability of the plotter to output the current line color.
Checks the marker color and validates the capability of the plotter to output the current marker color/marker.
Returns the distance between two colors based on the HLS or RGB squaring system.
Constrains an HLS color to certain regions of the color wheel. If the color is grey, it is forced to white or black. If not, it is forced out to the rim of the wheel.
Accepts a color in the current device format and returns the RGB color.
Generates the default color table. This function is called at enable_dc time to create the default color table information. It can be called at reset_dc time to reinitialize the color table to its default state.
Creates a logical color table for the current device context.
This function currently does nothing except return true; however, it must remain hooked for the new graphics engine.
Gets the closest color to the RGB value passed in and returns the closest match currently available.
Returns the stall number of the pen that most closely matches the specified color. If RGBIn == WHITE, it returns 0.
Gets the color group and returns information about whether a pen is a paper pen, a transparency pen, or something else.
Finds the currently defined HPGL2 pen. If the pen is not yet defined, define a new pen. No priority is given to usage. This function should be called only if the user is using application colors (if (pSetup->usFlags & FL_USEAPPCOLORS) is set.
Finds the closest available pen color. Priority is assigned as follows:
Queries the current color data and returns information regarding the currently selected color support for the driver.
Queries the color index and returns the index of the RGB color value that most closely matches the RGBColorparameter.
Queries the logical color table.
Returns the available color nearest to the specified color on the currently associated device even if it is not available in the logical color table.
Returns an array of the distinct colors available on the device.
Returns the actual RBG color that results from the specified index. If the color index is in RGB mode, the nearest RGB color is returned.
Realizes the color table.
Returns the pen number for the RF instruction.
Converts an RGB color value to HLS format.
Note: Application colors should never be set with color sorting ON.
Selects the fill pen.
Selects the HPGL fill type that most closely matches the OS/2 pattern. Sets the direction of fill lines if this is supported on the particular plotter. Deciding whether or not to fill depends on the shape of the area being filled and the orientation of the paper. The fill type is a function of the direction to fill, the spacing between lines (currently 0 to default to pen thickness), and the type of line to draw (bi-directional). Bi-directional lines are not as precise as uni-directional, but uni-directional lines are much faster because the pen does not have to be lifted.
Selects the pen using the HPGL2 pens in the Dynamic Pen Palette (not the Carousel pens). This function is called when (pSetup->usFlags & FL_ USEAPPCOLORS) is set. This function generates the HPGL command to select a specified pen from the palette.
Selects the line pen and returns the stall number of the pen that most closely matches the Color parameter.
Selects the text pen.
Generates the HPGL command to select a specified pen.
Called during #send_header processing for HPGL2 devices only. Sets number of pens with the NPn; command, where n is the number of pens in the palette. If n is not a power of 2, the plotter uses the next larger power of 2.
Sets the Merge Control (ROP) in the device.
Sets the RGB of pen.
Generates the HPGL1 or HPGL2 command to set the pen width for HPGL2 or pen thickness for HPGL1.
Checks and sets the transparency mode (TR). TR defines how the white areas of graphics images are plotted. IN (initialize) and DF (default condition) instructions return TR to its default. White is defined as the white reference specified by the CR (color range) instructions.
Determines if the device supports user-defined patterns for area fills. If the device supports these patterns, this function gets the pattern bitmap handle from the graphics engine and calls the appropriate function to download the pattern bitmap to the device for area filling.
Sets up PLOTTERS to begin color sorting. Ensures the correct mode is not the first pass from spooler queue processor and that the user has selected color_sorting from the dialog box. This function is called to enable journaling for color sorting. It is called at enable time, and at each new page.
Stops color sorting. This function is called at the end of a page and the end of a frame. Its basic operation is to replay the journal file and perform only those operations requiring the current pen. Thus, all drawing operations are completed for each pen in one operation, thereby reducing the number of (slow) pen change operations. This function processes the color sorting information and is called at the end of a page. This function will stop journaling, then play the journal file for each pen used in the carousel. It will set the current pen based on lightness to darkness for a given carousel. If an ABORTDOC signal is received, the bEnableOutput flag will be cleared, further output will cease (output_bytes will stop sending) , and the rest of the journal file replay will be skipped.
Unrealizes the color table.
This module contains bit-map compression routines.
Compression for RTL.
Function will select the best compression supported by the device select the mode and output the data. This function will work for both RTL and PCL devices.
This module contains the functions for the Job Propertiesand Printer Propertiesdialog boxes.
Builds the app name from the printer driver and device names. For example, an app name of
PM_DD_Printer,PLOTTERS.LaserJet 4 HP-GL/2
is built from:
Printer name Printer
Driver name PLOTTERS
Device name Laserjet 4 HP-GL/2
Checks or unchecks a menu item in a menu. If status is TRUE, the menu item is checked. If status is FALSE, the menu item is unchecked.
Sets the check status in the PenColor and Type menu to bStatus. The check status is set only if a single pen is selected in the carousel configuration list box because this is the only time the items in these two pop-up menus will be checked.
Check the currently selected pens to see if the menu items must be enabled or disabled.
Exit list routine that ensures the removal of the stub HK_HELP hook before exiting.
Turns all items in the PenColor, Type, and Options menus to inactive (gray). This is required either when a new carousel is selected or the user does not have a pen selected in the carousel configuration list box.
Displays the currently selected carousel information in the static fields.
Determines the allowable colors and types that can be selected in the PenColor and Type pop-up menus. On entry, the menu status table for the PenColor menu is set to all TRUE (indicating any pen can be selected). The Type menu status table is initialized according to the pen types supported by the current plotter. Then, each pen that is selected in the carousel configuration list box is examined. If no pen is in the stall, no operation is performed. Otherwise, all PenColor menu items that the selected pen type does not support are made inactive (grayed). Likewise, all Type menu items that do not support the color of the given pen are made inactive (grayed). Finally the update menu function is called for the PenColor and Type pop-up menus.
Displays the current paper size in the main dialog box. If the paper size is A thru E or A4 thru A0, the dialog elements for the determination of the roll length are hidden and the current paper size is shown through static text. If the paper size is either a 24-inch or 36-inch roll, the paper size static message is hidden and the dialog elements for the roll length are shown. If roll feed is selected, the input focus of the main dialog is set on the roll length input box. The current paper size is then checked in the pop-up menu.
Displays a pen description for the given pen in the carousel text fields. The pen description consists of the pen color and the pen type.
Resets the contents of the carousel configuration list box for the current carousel. Because the display_pen function inserts its pen description at the specified position, a "dummy" string must be created for the duration of the carousel configuration construction. Once completed, this string is deleted. If any pens were selected prior to this construction, the check marks must be removed from the PenColor and Type menus and the PenColor, Type, and Options pop-up menus must be made inactive (grayed).
Retrieve the EA.VERSION from driver file.
Returns the group in which a pen is classified. (For example, P3 and P7 are paper pens; T3 and T6 are transparency pens.)
Returns the size of the directory path.
Loads the string number message from the resources file and places it in the message buffer in the DEVMODE structure. Returns the address of the string buffer in DEVMODE.
Calculates the height and width of the text string for the WM_MEASUREITEM message.
Dialog procedure for help.
Checks for a recoverable help manager initialization error. If a recoverable error is detected, a message box pops up. The message box describes the error and asks if the user wants to retry.
This hook is placed in the HK_HELP hook chain to catch the first time that the user presses PF1 or selects a Help push button. The driver then initializes the help instance and gets the user's help request passed back into the HK_HELP chain again by making a call to the private function WinCallHelpHook().
Initializes the main dialog box. This initialization is done upon entry and when the user changes the current plotter. This function performs the following duties:
- Sets the window caption to the current plotter and checks it in the Plotter menu.
- Checks the current and active carousels and displays the current carousel above the carousel configuration list box.
- Initializes the paper feed selections and options.
- Initializes the orientation selections.
- Displays the current paper size.
- Disables the PenColor, Type, and Options pop-up menus.
- Constructs the carousel configuration list box.
- Determines paper size support and updates the Size pop-up menu.
Initializes help. If an attempt to create a help instance has already been made, return immediately.
Displays (in the Pen Options dialog box) the value for the given option for each pen selected from the carousel configuration list box. The following are the available pen options:
Speed and acceleration are true values. Force is an index in a table of values that is dependent upon the current plotter.
Displays (in the Pen Options dialog box) the priority for each pen selected from the carousel configuration list box. The following are the possible priorities:
Handles the user interface of the main dialog box. This dialog box can only be enabled by the exported function DeviceMode. If something is processed, TRUE is returned. If nothing is processed, FALSE is returned.
Main dialog box window procedure where all window functions are processed. WM_COMMAND type functions are passed to the local function main_dialog_ command.
Handles the user interface of the pen options display and modification dialog box. The options that apply are:
Called by applications that want to change the attributes of the driver, such as the device and pen configuration. OS2_DevPostDeviceModes gets the values based on the pszDeviceName passed from the OS2.INI file. The flags passed in determine the type of operation required by the caller, where bits 0-1 mean the following:
- %00 - Display dialog, no update to the INI file
- %01 - Display dialog, update INI file
- %10 - Do not display dialog, just return INI information
- %11 - reserved
Handles the user interface for selecting the pen color. Displays a list box of available pen colors and updates the main dialog with the color selection.
Handles the user interface for the display and modification of the pen priority. Each pen selected in the carousel configuration list box can be tagged with any of the following priorities:
For all fill output, a pen that has fill priority will be selected over another pen of the same color that does not have fill priority. Likewise, for all lines and text output, a pen that has lines and text priority will be selected over another pen of the same color that does not have lines and text priority.
Removes the stub HK_HELP hook from the hook chain, if it has been successfully added via #SetHelpStubHook().
Updates the PenColor and Type pop-up menus through a call to display colors , determines the options supported by the current plotter, and updates the Optionspop-up menu.
Saves the setup data in OS2SYS.INI. The setup data is placed in a private section of PLOTTERS and the record is identified by pszDeviceName. pszLogAddress (for example "IBM6180.PLOTTER1").
Adds the stub HK_HELP hook to the hook chain. This addition allows the driver to gain control the first time that the user presses PF1 or selects a Help push button.
Switches between RGB and carousel modes, depending on the user's choice in printer properties dialog box.
Copies a string from the source to the destination. If the string is null terminated, the copy stops when the terminator is hit. Otherwise, the copy continues for the number of bytes passed in.
Sets the status of a pop-up menu to the menu status table given by pMenuList. The three pop-up menus with menu status tables are:
This file contains functions and macros that hook and unhook entries in the dispatch table.
Modifies the engine-supplied dispatch table.
UnHooks all the functions that are not mandatory and hooks all the mandatory functions. Provides support for bit map handling and memory DC.
This module contains the high-level output functions that communicate with the output thread code to output data to a file or device. See Output- Thread Management for further details.
Closes the output device.
Returns the IEEE address from the argument.
Extracts COM port modes from the OS2SYS.INI file.
Gets an output buffer from the head of the free queue or allocates a new one if no buffers are available on the free queue.
Sets the COM port to the conditions determined from the OS2.INI file.
Initializes outputinfo semaphores.
Opens the file name or device passed in. This file name or device is where the output will go. It can be a COM port, an IEEE port, or a disk file.
Sets up the connection to the spooler that the output has been sent to.
This function is a call that the driver uses to output data. This function calls Thread_Fill_Outbuff to put data on the output thread.
At the end of the spooling activities this function writes the metafile data to the spooler.
Puts the buffer on the end of the data queue (OutputInfo.obqData).
This module contains functions that are used when the device context is initialized or disabled.
This ENABLE subfunction is called before a DC starts its disable process. This function initiates any final clean up prior to the full disable, such as closing journaling, performing color sorting, and closing the spooler.
This ENABLE subfunction is called when a DC has completed the disable process. This function releases any memory that was allocated for the DC instance (pDDC).
This ENABLE subfunction is called when a physical device block is to be deleted. This function releases any memory that was allocated in #fill_pdev and closes the pathway to the device.
This function is the entry point OS2_PM_DRV_ENABLE for the plotter driver. This ENABLE function is exported by the device driver and performs the initialization of the device driver, the physical driver, and device contexts.
This ENABLE subfunction is called each time a DC is created. This is the first time the DC handle is presented and is the time to allocate the DC. The corresponding physical device pointer is the one that was returned in #fill_pdev.
This call informs the driver that the DC has been created by the graphics engine. It is the first time the pDDC that was returned in EnableDC is presented. At this time, this function opens the spooler if it is handling a queued DC. Any metafiles or journaling is started in this function.
This ENABLE subfunction is called when the driver is loaded and initializes the logical device block. This initialization includes setting some bits telling the engine that the driver needs a PDEV per DC and hooking the functions the driver will support.
This ENABLE subfunction is called each time a DevOpenDC is requested by the application. This function creates and allocates a physical device block, which should contain any information needed to perform I/O to the specified device.
Allocates memory from the pdevice block and saves the spooler parameters (if they exist) from the enable dc structure.
Initialize the device instance (PDevice) fields.
This routine is used by the graphics engine to query the device surface information. This function fills the DEVICESURFACE structure to be used by both the graphics engine and the device driver.
This ENABLE subfunction is called to reset a DC to its original initialized state.
This ENABLE subfunction is called when the engine wants the device driver to POP a saved DC or to POP to a specified DC.
This ENABLE subfunction is called when the engine wants a device driver to save all DC information. This function can be called multiple times, and the driver should push the DDC in LIFO order.
This function is called from #fill_pdev and sets up the color information for the selected plotter.
Provides device-specific interface to the driver.
Gets information on the physical page size.
Extracts information about the physical page size. pPDevice points to the relevant entry in the PaperResTable and PrintOffTable for this particular plotter. The form is the number for the particular paper size. These range from 0 to 4 for sizes A to E (imperial), 5 to 9 for A4 to A0 (metric), 10 for a 24-inch roll, and 11 for a 36-inch roll.
Returns the number of forms available on this particular device.
Returns a list of bit map formats supported by the device. The plotter driver supports no bit maps, so this function sets the return data to zero out the return data area, as required.
Returns information about the device capabilities.
Information is returned to the caller in pData. Count items are returned, starting with the value Index. Values that are transform-sensitive are returned in DEVICE UNITS, such as the character size.
Returns information about the device names available from this driver, and about the datatypes handled. QueryDeviceNames() is a direct entry point into the driver. It bypasses the dispatch table mechanism because many applications will call this function without calling the enable functions to initialize the driver.
Called by the user at the time of setup to load all pointers and bit maps and called by the engine to load the default fonts, if any. This is a required function. The plotter driver returns zero, for "resource not available".
This function is called by the user on setup to load all pointers and bitmaps, and by the engine to load the default fonts (if there are any). This is a required function.
Returns information about the hardcopy capabilities of the device. Function either returns the number of forms available, or returns information about (selected) forms available.
This module contains the code and data for font support.
Copies fontmetrics from source to destination, up to count bytes. Any required transformations are applied.
Warning: This function overwrites the data at pMetricsSrc. If this data is valuable, it should be copied before this function is called.
Returns the font metrics for the currently selected font. If this is an engine font, the driver calls back. Otherwise, the driver copies to a local buffer, and then transforms the values from font notational to world space.
Returns information about the plotter's built-in fonts.
Finds the length of a given vector.
Calculates the amount of the space to increment between each character in a string. The application must use GpiSetCharExtra or GpiSetCharBreakExtra to enable the extra spacing.
Finds the text alignment shift in the horizontal direction, based on the usTextAlignment.
Finds the standard text alignment, based on the direction of the text.
Finds the text alignment shift in the vertical direction, based on the usTextAlignment.
Determines the origin of each character in the given string and adjusts for the character direction.
Queries text box for the given char string and returns the coordinate of the text box.
Returns information about the width of the characters in the currently selected font. If the current font is the hardware font of the plotter, information is returned from QueryWidthTable. Otherwise, the call is passed onto the engine because the engine knows more about fonts than QueryWidthTable.
Performs the following four functions:
- Realizes a device font.
- Realizes an engine font as a device font.
- Deletes a device font.
- Deletes an engine font realized as a device font.
This module contains functions that handle user-defined forms.
Queries the dialog. If the information is valid, it inserts that information into the linked list.
Determines how many user-defined forms exist for an application name, and then inserts each user-defined form name into the given list box. This function also allocates a user-defined form element and associates it to the newly created list box item.
Walks through the linked list and converts the integer measurements into a string form for the user to eventually see.
Queries the dialog for the current form, and then searches the linked list for that form. If it finds the form, it will delete it from the linked list.
Deletes any item that has a handle from the given list box. (Only user- defined forms should have this property.) Any user-defined form will be deleted from the list box and its associated memory will be freed.
Displays a message box that contains the string ErrorName with the ID ErrorMessage.
Given a linked list element, this function updates the window's name with that element's ID.
Given an element in a linked list, this function updates the dialog with the correct information.
Searches the INI file for that user-defined form ID and updates the printable X and Y mm sizes.
Subclassing procedure for an entry field. Its purpose is to allow only numeric input.
Walks through the linked list and searches for an element that has the same ID (it will not check against itself). If there is a conflict, it will return that element's form name.
Subclassing procedure for an entry field. Its purpose is to allow only numeric input.
Reads the user-defined forms into a linked list and returns the current unit of measurement and the number of forms that have been defined.
Adds an element that contains the given information into a linked list. To do this, the function creates an element, copies the information to it, and adds it to the linked list.
Allocates a linked list element off the heap in the instance data and initialize that element.
Given a linked list and a pointer to one of its elements, this function deletes that element from the linked list. This function also cleans up any resources used by that element.
Searches through the linked list for an element whose form name matches the form name that was given. If successful, it returns a pointer to that element.
Given a linked list, this function deletes every element in that linked list.
Converts an integer (in hundredths of a millimeter) into a string of a real numbers.
This function performs the following:
- Queries the dialog for the information that the user has entered
- Validates the information
- Searches the linked list for the form
- Changes the data that was stored in the linked list element to the data that the user has entered.
Walks through the linked list and searches for an element that has the same form name (it will not check against itself). If there is a conflict, it will return that element's form name.
Searches the OS2SYS.INI for the AppName entry and returns the number of forms that have been defined.
Searches the OS2SYS.INI for the application name and the user-defined forms entry. If there are no user-defined forms, it will return NULL. Otherwise, it will return the contents of the INI file entry.
Given a linked list, this function writes out the user-defined forms into the OS2SYS.INI file. If the number of forms is 0, it will delete the user- defined form information from the OS2SYS.INI file.
Converts the string representation of a real number into an integer representation. This integer will be in hundredths of a millimeter.
This is the dialog procedure for the user-defined forms.
Searches the user-defined forms in the INI file under the application name for the given form name.
Subclassing procedure for an entry field. Its purpose is to allow only numeric input.
This file contains trigonometric functions to calculate the sine, cosine, and arc tangent of an angle.
Returns the angle of the point in dx,ax in ax scaled by 10. The point is first scaled by Xaxis and Yaxis in order to handle an elliptical arc.
Given an origin and a point this function returns the arc tangent of point to the nearest tenth of a degree.
Given an Angle (0 - 3600) this function returns the cosine of the angle. The angle is assumed to be in tenths of a degree. The calculated cosine is scaled by 16384.
Given a point in ax,dx, this function determines arc tangent or angle of the given point. The angle is returned in ax.
Determines the quadrant of ax,dx and returns in cl.
Given a degree in si, this function returns cosine in ax scaled by 16384. Degrees range from 0 - 3600. bx,cx,dx are destroyed.
Given a degree in si, this function returns sine in ax scaled by 16384. Degrees range from 0 - 3600. bx,cx,dx are destroyed.
Reduces the angle in si to the range 0 - 90 * 10. It also determines the quadrant of the angle which is returned in cl.
Given an Angle (0 - 3600) this function returns the sine of the angle. The angle is assumed to be in tenths of a degree. The calculated sine is scaled by 16384.
This file contains ASM utility routines.
Copies memory is a manner similar to memcpy();.
Debugging routine to issue a software interrupt 3.
PSZ ENGENTRY SetMem
Sets memory to a value.
The plotter version of memset();.
This module contains the DLL initialization and termination functions.
Initializes the PMPLOT.DRV. Saves the HMODULE assigned from the operating system.
This file contains the lock and unlock code for the driver's instance data.
Entry to a hooked Gre function. Protects the pDDC while it is in the driver.
Initializes the semaphore structure.
Works with EnterDriver to ensure that threads with different IDs are not accessing the same pDDC. Exits from a hooked Gre function.
This module contains functions used to draw the supported marker types. Only PolyMarker is exported to the world.
Draws a small filled circle marker.
Draws a crosshaired PolyMarker.
Draws a diamond PolyMarker.
Draws a small filled circle marker.
Draws an eight-pointed PolyMarker.
Draws a plus-sign PolyMarker.
Draws a six-pointed PolyMarker.
Draws a filled square marker.
Draws a filled diamond marker.
Draws a square PolyMarker.
Draws a series of Markers at the specified locations.
This module contains functions that perform mathematical operations.
Adds two quad numbers.
Prepares the stack for fxmultiply and calls fxmultiply to multiply two FIXED numbers.
Multiplies two 32-bit fixed point numbers and returns a FIXED. FIXED is a signed 32-bit number with 16-bits of integer and 16-bits of fraction.
Converts a fixed long value to a fixed quad value.
Computes the SIGNED LONG quotient of a SIGNED LONG and a SIGNED FIXED.
Approximates the square root of an unsigned BIGFIXED.
Returns the square root of the given positive 32-bit value.
This file contains all the drawing routines used to create arc primitives for the plotter.
Creates an arc using the current arc parameters and a pointer to two x,y coordinate pairs. The arc is drawn from the current position (a) through the first coordinate pair (b) to the second coordinate pair (c). Upon completion, the current position is updated to the end of the arc (c).
Outputs the chord tolerance for the Circle and Arc commands to the plotter, based on the radius received.
Converts the lQ and lP arc parameter values using the fixed multiplier and the current transform.
Draws a fullarc (circle or ellipse), given its center point and a radius. If Fill is TRUE, the fullarc is filled. Otherwise, it is outlined. Upon completion, the current physical pen position is at the center of the circle.
Note: This function should only be called for circles and not for ellipses.
Creates a FILLED and OUTLINED full arc with its center at the current position. A multiplier can be specified to apply to the current arc parameters. Upon completion, the current x,y position is not changed.
Creates an outlined full arc with its center at the current position. A multiplier can be specified to apply to the current arc parameters. Upon completion, the current x,y position is not changed.
Creates a FILLED full arc with its center at the current x,y position. A multiplier might be specified to apply to the current arc parameters. Upon completion, the current x,y position is not changed.
Returns the angle of a line in tenths of a degree.
Sets the center point of a circle defined by three points on the circumference of that circle.
Returns the distance, in specified coordinates, between the two given points.
Returns the intersection point of two lines defined by pPtsAB, pPtsAB , pPtsCD, and pPtsCD. This function returns TRUE if successful. Otherwise, it returns FALSE for "lines are parallel".
Returns line CD, which runs perpendicular to and bisects line AB.
Determines if an ellipse will be drawn instead of a circle.
Note: This code is copied from draw_fullarc. Any changes to draw_fullarc might have to be duplicated here.
Draws two figures:
- A straight line from current position to the starting point of the partial arc
- The arc, with its center at the specified point
A sweep angle of greater than 360 degrees is valid. After the line is drawn , a full arc is drawn, followed by a partial arc with a sweep angle of (sweep MOD 360) degrees. The current position is updated to the final point of the arc.
Draws a sequence of one or more Bezier splines starting at the current position. As each spline is drawn, the specified end point of the spline becomes the start point for the next spline. Upon completion, the current position is the end point of the last spline.
Sets up the scaling for the arc parameters.
Sets the arc parameters for subsequent arc, fullarc, partialarc functions.
This file contains all the primitive line drawing functions used by the Plotter.
Draws a sequence of disjoint straight lines. This is an optional function.
Loops through the given path and draws all lines it finds in that path. This is a required function.
Returns the logical pen position to the (X,Y) pointed to by pPts. The physical pen position (the actual location of the pen) might be different.
Returns the logical pen position to the (X,Y) pointed to by pPts. The physical pen position (the actual location of the pen) might be different.
Draws a series of connected lines, starting at the current position. The input is in world coordinates and the final position is at the last point.
Fills an area lying between polyshortline pairs by using the current pattern attribute. Notice that coordinates are passed as unclipped screen coordinates. Filling is inclusive at the left boundaries and exclusive at the right boundaries. The scan lines are ordered from bottom-to-top and from left-to-right.
Processes polyshortlines. A pointer to the shortline header is passed. Within the header, start points and stop points are specified. Following the header is an array of Xs (currently 16 bits). The curve starts at x0,y0 and ends at x1,y1. The number of x values is then determined by the absolute value of y1-y1+1. If y1 is greater than y0, y0 is incremented until it equals y1. If y1 is less than y0, y0 is decremented until it equals y1. The current position is not affected by this call.
Sets the current position to the supplied position. This value is recorded in both world and device coordinates, so that, if required, the values can be transformed into device coordinates.
Sets the current position to the supplied position. This value is recorded in both world and device coordinates, so that, if required, the values can be transformed into device coordinates.
This module contains utility routines for producing output on a vector plotter that supports HPGL.
Checks the currently set fill type.
Determines if the PS/DC pair has a line currently in construction.
Determines if a string label is currently in construction. If so, terminate the string label.
Given a fixed point number, this function outputs it as a floating number with up to 4 digits following the decimal point. Trailing zeroes after the decimal point are truncated. A simple 0 is output if the converted number is zero.
Generates a formatted floating point number for output to the plotter as part of command string. The number received by this function can have any number of decimal places. The multiplier parameter will determine the number of decimal places. For example, 2000 with a multiplier of 1000 = 2.0 and 2000 with a multiplier of 10000 = .20.
Outputs an (x,y) coordinate pair to the plotter, applying any needed transformation.
Converts a point to a different coordinate system.
Draws a line.
Draws a single point.
When the end of the current document has been reached, this function sends the necessary sequence of commands to prepare for the next document.
When the current plot job has ended, this function closes the relevant path.
If the current page of output is full, this function sends the appropriate command sequence to obtain a new page, and initializes it for output.
Given the three points A, B, and C, this function determines if B is closer to A than C.
Lifts the pen if it is not already lifted.
Updates the current physical position of the plotter pen or, if an area fill is being performed, updates the DDC's physical pen position information.
Enables a new band or calls end page if on the last band. Only roll feed plotters are banded.
Outputs a comma.
Outputs a number (integer implied) to the plotter as part of a command string.
Outputs a standard coordinate pair (x,y).
Plots a line from the current physical position or queues the line for later output if an area fill is currently in effect.
Sends prerequisite commands to the plotter to initialize the device for the next or new page.
Sends a command string that terminates a single page of output to the plotter.
Initializes the default plotting extents.
Sets the default scale for the current hardcopy device and media size.
Initializes a rectangle (RECTL) structure to enclose a null (unit) rectangle.
Sets up the active line type, such as dot-dash and dash.
Sets the current plotting extents.
Sets the current values for plotter-applied scaling.
Rotates the plotter coordinate system 90, 180, and 270 degrees.
Sets up the plotter for a new document. This function is called by start page, and is the second highest level initialization call. It initializes the beginning of a document (which is different from the beginning of a page because multiple pages might exist in a document).
Sends the necessary command sequence to start a plotter job.
Sends the necessary commands to setup the plotter for a new page of output.
This module contains path-related functions.
Indicates the beginning of a set of drawing operations to define an area boundary.
Called only for HPGL2 devices. This function depends on the code "set_color _palette()" in #COLOR.C to set pen 0 to white. If the area is not complex, it fills the area with a rectangle command. If the area is complex, it draws a series of horizontal white lines into the current clip path.
Draws a series of diagonal lines into the current clip path.
Draws a series of horizontal lines into the current clip path and sets up line endpoints, adding 1 to the right and subtracting 1 from the left to ensure that joining lines are clipped out.
Draws a series of vertical lines into the current clip path.
Draws a series of line patterns.
Indicates the end of the drawing operations defining the area.
Fills the currently selected clip path or clip region.
Fills the area by querying the outline of the path and filling the outline as a HPGL polygon. This function only fills the area if:
- Clipping is simple. (1 clip)
- Fill mode is alternate (FPATH_ALTERNATE)
- Engine version is 2.02 or later
Current plotters can only handle 1 clip rectangles.
- Because older plotters have small polygon buffers, this method might not always work.
- On the 32-bit Engine (version 2.02 or greater), calling GreOutlinePath with the new option (NO_CLIPPING_REQD) results in a call to the DrawLinesInPath function for each unclipped subpath. On the 16-bit Engine, calling GreOutlinePath results in many calls to the PolyShortLine function for each subpath. Because the end of the subpath is too difficult to predict on the 16-bit engine or older versions of the 32-bit engine, the polygon filling method is used only on engine versions 2.02 or later.
Fills the area by filling the clip rectangles.
This code improves the speed of filling large simple areas.
Six clip rectangles was chosen for plotters because it included wide line boxes which produce four clip rectangles. More complex areas are not filled on plotters because filling an area with boxes does not optimize pen up (PU ) commands on normal plotters.
On HPGL2 devices, complex areas are filled entirely with this method.
Fills the path specified by the user.
Paints the specified region using the current area foreground and background colors. Mixing is controlled by the area foreground mix only.
The driver could handle the PaintRegion by calling GreGetRegionRects and filling the rectangles itself.
Draws a set of closed polygons. The polygons are filled using the current AREABUNDLE structure values. For the first polygon, the current position is the first point. For all subsequent polygons, all points that define the polygon are given explicitly. If necessary, the polygons are automatically closed by drawing a line from the last vertex to the first.
- Polygons can overlap, if necessary.
- This is a new function for 2.0.
- GrePolygonSet is not valid when the COM_AREA or COM_PATH flag is set.
This function is called as a result of GpiPolygonSet and is called internally by DevicePolygonSet.
Converts the path to a wide line.
Note: The select_pen function in #COLOR.C will set the pen width to the geometric width if the instance variable pDDC->DCState.bWideLines is true. lineend and linejoin will be set in set_line_type if pDDC->DCState. bWideLines is set.
This module contains definitions of plotter characteristics for all supported plotters. The following structures are included in PLOTTERS.C:
This file contains ASM functions for data type FIXED point math.
Computes the FIXED quotient of two FIXED numbers.
Computes the FIXED product of two FIXED values.
Computes the Fixed square root of a Fixed. This routine simply pulls the parameter off the stack, puts it in EAX, and calls the square_root function.
Keeps track of the signs and calls idiv to perform the processing.
Computes the FIXED square root of a FIXED number.
Normalizes a ULONG so that the highest order bit 1 and returns the number of shifts performed. Also returns ZF=1, if the ULONG was zero.
This module is the interface to plotter-specific data. These functions access the information stored in the global data structures defined in PLOTTERS.C and retrieve and store data in the OS/2 INI file.
Returns the device characteristics for the requested plotter index.
Returns the pen option characteristics for the requested plotter index.
Fills the default set up data for the given plotter ID.
Matches the given name with the names of known devices, and then return the desired information.
Scans the PM_SPOOLER_PRINTER section of the OS2.INI file, looking for a printer attached to either the queue or logical address pointed to by pszLogAddress, and then looks for the queue name if this is a queued DC.
The format of OS2.INI file is:
- device_name is the name in the Control Panel "Printer Connections" section
- PORT is the serial/parallel port to which the device is connected, such as COM1
- Driver.Type is the name of the driver (PLOTTERS in our case)
- Type is the particular type of plotter, such as IBM6180
- Queue is the name of the spooler queue associated with this device
Looks for the entry pDeviceName.pPrinter in the private section of the OS2SYS.INI file. This function contains initialization data for the particular type of plotter being used. A typical name is "IBM6180.PLOTTER1".
This module contains OS/2 plotter presentation driver text output functions and internal and external text-related output functions.
Adjusts the current character size and angles using the currently defined transforms.
Computes the character cell size for clipping purposes.
Outputs a character string, starting at the current position.
Outputs a character string at the specified point.
Handles complex clipping of a single character.
Returns the current code page.
This function is required to hook, but it is not supported.
Sets the angle character attribute.
Sets the shear angle character attribute.
Sets the cell size character attribute.
Sets the anglecharacter attribute.
Sets the italic and bold character attributes.
Sets the current code page.
Determines the clip limits of the supplied string information.
UTILS.C is a general utilities module.
Clears Size bytes of memory.
Compares memory at address pAddr1 with the memory at pAddr2, for Size bytes.
Converts an X length and a Y length, accounting for rotation.
C function to copy memory.
Note: The Assembler function cpymem is preferred.
Returns a value proportional to the plot distance between 2 points. The plot distance is defined as the larger of (delta x, delta y). This concept works with plotters because the pen can move in both directions at the same time. Therefore the time to move to a new position is determined solely by the larger of the X or Y distance.
Flushes any remaining buffered lines and releases memory.
Initializes the fill-optimization code.
Given a logical address (queue name, port name, or file name), this function returns the string containing the spooler's printer name. The caller must free this string (it is allocated off of the heap).
Given a logical address (spooler printer name, spooler device name, port name, or a UNC name), this function returns the string containing the spooler's printer name. The caller must free this string (it is allocated off of the heap).
Processes the contents of the area fill optimization buffer, drawing a minimal (not minimum) path through the accumulated line segments.
Deallocates memory from the heap or frees the memory from system.
C/Set Conversion: Four extra bytes from memory have been allocated to store a flag and the size of memory required.
Returns the module handle (hModule).
Converts the given integer to its character representation and returns the length of the string representing the integer. The integer can be positive or negative. The resulting string is assumed to describe a string of a length sufficient to hold the character representation of the integer and a trailing NULL. The resulting string will be at least MinDigitsin length.
Checks the physical port name. Any port name that begins with "COM" and is appended with any integer greater than or equal to 1 will be valid.
Checks that the physical device name is supported.
Compares the two strings for equality. This function ignores the case.
Copies from string pFrom to pTo.
Returns the length of the NULL-terminated string passed.
Compares the two strings for equality for a given length. This function ignores the case.
Searches for the Char token in the string pointed to by the input pointer, replaces this with a NULL, and updates the pointer past the NULL.
Prompts the user to insert the specified carousel.
Prompts the user to insert a sheet of paper.
Records a pair of points (line segment) in the area fill optimization buffer for processing when the buffer fills and is flushed.
Given a logical address (queue name, port name, or file name), this function searches for a plotter device name. It will place the device name string in pszDeviceName. If multiple plotter devices are attached to the printer (spooler term), the function will return the first one because there is no way to determine the proper one to select.
Divides two numbers and rounds up or down.
Called from the initialize routine when the driver is loaded. Its purpose is to save the handle to the module in a ring 2 data segment.
Converts an integer string to an integer value. The integer value is passed back through pInt. A pointer to the first position past the integer value in the string is returned as a result. Leading spaces are ignored and overflow is accounted for by this function.
Converts a character from uppercase to lowercase. This function will return valid driver data. It will also allocate a copy of driver data and initialize it to its default state. It is the caller's responsibility to free this data. If driver data was passed in, the function will check to see how much of that data can be copied over its initialized driver data.
This module contains conversion and transformation functions.
- Divides a long by a FIXED, returning a FIXED.
- Limitations This function was written specifically for generating the sine and cosine values in a triangle. As such, it might have restrictions not suitable for general use. The result is assumed to be less than or equal to 1.0000.
- Returns the square root of the unsigned long argument. The value is returned as a FIXED number.
- Generates a rotation matrix from character direction data.
- Evaluates a square root using Newton's approximation method, using a fixed number of guesses.
- Handles changes to the transformation matrixes as reported from the engine and returns the result of an indirect call to the GreNotifyTransformChange.
This function is called when the world->device transform is changed. Processing is as follows:
- Transform the current position.
- If it is outside the allowed 16-bit range, return an error.
- If the position is OK, call the engine's entry point.
The pXformData structure specifies the new transform matrix.