Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Sunshow Pro V3.0 - <b>hppjxlscr()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
HPPJXLSCR()

Prints a screen image on a HP PaintJet XL300 or compatible printer


Syntax

HPPJXLSCR(<cDevStr>, <nDPI>, <nLeft>, <nTop>, ;
   <nNewWidth>, <nNewHeight>, <nBrightness>, ;
   <nPageSize>, [<nOptions>])


Arguments

<cDevStr>
Output device string: "lpt<n>", "com<n>", "prn", "file:<FILE>".

<nDPI>
Dots per inch to print at (300, 150, 100, 75).

<nLeft>
Left offset into the page in inches.

<nTop>
Top offset into the page in inches.

<nNewWidth>
New print width in inches.

<nNewHeight>
New print height in inches.

<nBrightness>
Change brightness value between -255 dark to 255 light. Suggested value 60.

<nPageSize>
Set page height in inches (11", 14", or 17").

<nOptions>
FORMFEED, FASTFLAG.


Returns

0
Success.

-1
Cannot print current video mode.

-2
Cannot allocate memory for line buffers.

-4
Print terminated by user.

-5
Printer does not acknowledge.

-6
Printer is out of paper.

-7
Printer timeout error.

-9
<cDevStr> must be "lpt<n>", "com<n>", "prn", "file:<FILE>".

-10
<nDPI> must be 300, 150, 100 or 75.

-11
<nLeft> plus <nNewWidth> must be less than 11.0".

-12
<nTop> plus <nNewHeight> must be less than 17.0".

-13
<nBrightness> should be between -255 and 255.

-14
<nPageSize> should be 11", 14" or 17".

-99
Parameters are invalid.


Remarks

Prints a screen image on a HP PaintJet XL300 in graphic mode from 75 DPI 
to 300 DPI. Form feed disabling and fastflag are optional. Supports 
multiple images, US/European standard paper sizes.

The function should be called while the image is displayed. You must use 
TextMode() (part of Sunshow, standard edition) to reset video card to text 
mode.

To calculate the memory requirements for printing an image in color:

1.  Multiply image width in inches by DPI for width in pixels.

2.  Multiply image height in inches by DPI for height in pixels.

3.  Multiply image width in pixels by height in pixels for overall 
    image size in pixels.

4.  Devide overall image size in pixels by 8 to get the number of 
    bytes per plane.

5.  Multiply the number of bytes per plane by the number of 
    planes (3 for color, 1 for monochrome) to get the bytes of 
    printer memory required.

A formula for the above steps of calculation is:

(((<width>*<DPI>)*(<height>*<DPI>))/8)*<Numplanes> =
<bytes of printer memory required>

So for an 8" x 10" image at 300 DPI in color:

1.  8" * 300 DPI = 2400 pixels.

2.  10" * 300 dpi = 3000 pixels.

3.  2400 * 3000 = 7,200,000 bytes.

4.  7,200,000 / 8 = 900,000 bytes per plane.

5.  900,000 x 3 planes for a color image = 2,700,000 bytes of 
    required printer memory, packed pixel format (three planes of 
    1-bit per pixel data).


Example

To print ASMUSSEN.PCX 8.0" x 10.0" at 300 dpi with a left margin of 0 and 
a top margin of 0 inches, with darkening of the image, and with the 
FASTFLAG and FORMFEED enabled:

nStatus = ShowPCX("ASMUSSEN.PCX")
nStatus = HPPJXLSCR("lpt1", 300, 0.0, 0.0, 8.0, 10.0, ;
   40, 11, FASTFLAG + FORMFEED)
IF nStatus < 0
    nStatus2 = TextMode() && Need to be in text mode to
                          && see the error text.
    DO CASE
    CASE nStatus = -1
        ? "Cannot print current graphics mode"
    CASE nStatus = -2
        ? "Cannot allocate memory for line buffers"
    CASE nStatus = -4
        ? "Print terminated by user"
    CASE nStatus = -5
        ? "Printer does not acknowledge"
    CASE nStatus = -6
        ? "Printer is out of paper"
    CASE nStatus = -7
        ? "Printer timeout error"
    CASE nStatus = -9
        ? "cDevStr must be lpt<N>, com<N>, prn, " + ;
          "file:<FILE>"
    CASE nStatus = -10
        ? "nDPI must be 300, 150, 100 or 75"
    CASE nStatus = -11
        ? "nLeft plus nNewWidth must be less than 11.0"
    CASE nStatus = -12
        ? "nTop plus nNewHeight must be less than 17.0"
    CASE nStatus = -13
        ? "nBrightness should be between -255 and 255"
    CASE nStatus = -99
        ? "Parameters are invalid"
    ENDCASE
RETURN
ENDIF
TextMode()



See Also: HPPJXLGIF() HPPJXLPCX()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson