jbe@sws4.pcs.com (John-Brown Evans) (08/20/90)
This is a simple question for hackers, but it's the first time I'm trying to do this and don't want to waste a lot of time trying it out. I'm writing a program in C using AES and VDI calls. The prog produces graphics. I need to take a part of this (a box with contents) and send it to a printer (EPSON), to specific xy-coords. I have a monochrome monitor. Can anyone send me some tips (a piece of code??) on the best way to do this. I havn't found a function which dumps a section of the screen to printer. I assume I have to do the following: 1. switch printer to graphics mode 2. query which pixels are set and which aren't 3. send the info pixel-wise to the printer 4. switch the printer back This seems a long and tedious way to do this. Thanks a lot. Name : John-Brown Evans Company : PCS GmbH, Munich W-Germany. UUCP : ..uunet!unido!pcsbst!jbe; jbe@pcsbst.pcs.com *** CAUTION: Be sure brain is engaged before putting mouth into gear ***
leo@ehviea.ine.philips.nl (Leo de Wit) (08/27/90)
In article <802@pcsbst.pcs.com> jbe@sws4.pcs.com (John-Brown Evans) writes: |This is a simple question for hackers, but it's the first time I'm |trying to do this and don't want to waste a lot of time trying it out. | |I'm writing a program in C using AES and VDI calls. The prog produces |graphics. I need to take a part of this (a box with contents) and send |it to a printer (EPSON), to specific xy-coords. I have a monochrome monitor. | |Can anyone send me some tips (a piece of code??) on the best way to do this. |I havn't found a function which dumps a section of the screen to printer. | |I assume I have to do the following: | |1. switch printer to graphics mode | |2. query which pixels are set and which aren't | |3. send the info pixel-wise to the printer | |4. switch the printer back | |This seems a long and tedious way to do this. It is. Besides you end up with a solution that is printer dependent. But you're lucky; there _is_ a function that dumps a block of graphics data to the printer (there are two in fact). Dependent on your Xbios bindings they are called Scrdmp() (no parameters, Xbios 20 if I'm correct; this dumps the current screen), and Prtblk() (one parameter, Xbios 36 if I'm correct; this dumps a graphic block). You would probably use Prtblk (Scrdmp is just Prtblk with a suitable parameter); the long parameter is a pointer to a block with the following data: var meaning what Scrdmp() uses ------------- --------------------- -------------------- long blkprt Address of screen Ram ($44e v_bs_ad) int offset (0) int width screen width (calc from v_openvwk or neg linea) int height screen height (calc from v_openvwk or neg linea) int left (0) int right (0) int scrres resolution (0 low, 1 med, 2 high) ($44c sshiftmd) int dstres printer res (0,1) (config) long colpal Address of color palette ($ff8240) int type printer type (0-3) (config) int port (0=centronics, 1=rs232) (config) long masks pointer to halftone masks (0) (config: a parameter that is configurable and can be set using the Printer Setup DA. Perhaps there is a function that can get this information for you, I didn't check). Since you want to use an arbitrary sized block of the screen, you need to copy it first to a spare area of ram using the blit functions (I think it is called vro_cpyfrm; you also have to set up the MFDB of the destination to reflect the correct block sizes). Then you can go ahead using Prtblk() (with blkprt pointing to the spare area). Maybe you could alternatively use offset, left and right; my documentation doesn't give any pointers as to what they are used for. I hope this helps; tell me if you need any more info. Leo.