silverfrost Site Admin
Joined: 29 Nov 2006 Posts: 191 Location: Manchester
|
Posted: Sun Sep 05, 2004 6:38 pm Post subject: Printing graphics regions |
|
|
Summary
Printing a ClearWin graphics region using BitBlt or StretchBlt results in garbled output or no output at all
Solution
Graphics regions are stored as device dependent bitmaps. To print a graphics region you must use a device independent bitmap (DIB) to overcome any device incompatibilities. The get_screen_dib@ function will convert a graphics region to a DIB and the dib_print@ function will copy it to the printer's graphics region.
The following is an example of printing a graphics region:
Code: | integer source_graphics_region_handle
integer source_width, source_height
integer printer_graphics_region_handle
integer hdib
integer dest_x, dest_y, dest_width, dest_height
source_graphics_region_handle = 1
printer_graphics_region_handle = 2
source_width = 600
source_height = 600
call open_printer@(printer_graphics_region_handle)
call create_graphics_region@(source_graphics_region_handle, source_width, source_height)
!
! add code to paint the source graphics region here using functions such as set_device_pixel@
!
call select_graphics_object@(source_graphics_region_handle)
call get_screen_dib@(hdib, source_x, source_y, source_width, source_height)
call select_graphics_object@(printer_graphics_region_handle)
call dib_print@(hdib, dest_x, dest_y, dest_width, dest_height)
|
|
|