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>hppjxlgif()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
HPPJXLGIF()

Prints a Compuserve GIF image file on a HP PaintJet XL300 or compatible 
printer


Syntax

HPPJXLGIF(<cFILENAME.GIF>, <cDevStr>, <nDPI>, <nLeft>, ;
   <nTop>, <nNewWidth>, <nNewHeight>, <nBrightness>, ;
   <nPageSize>, [<nOptions>])


Arguments

<cFILENAME.GIF>
Name of the GIF image file, and optional drive and path.

<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 open <cFILENAME.GIF>.

-2
Cannot allocate memory for line buffers.

-3
This is not a valid GIF file.

-4
Print terminated by user.

-5
Printer does not acknowledge.

-6
Printer is out of paper.

-7
Printer timeout error.

-8
Cannot print an interlaced GIF file.

-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 GIF image file on a HP PaintJet XL300 in graphic mode from 75 DPI 
to 300 DPI. Form feed disabling and fastflag are optional. You must set 
brightness, port, or file. HPPJXLGIF() has the capability of printing 
enormous images larger than screen sizes to 2,550 x 3,300 pixels (with 
sufficient printer memory). Supports multiple images, US/European standard 
paper sizes.

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.GIF 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:

cFILENAME = "ASMUSSEN.GIF"
nStatus = HPPJXLGIF(cFILENAME, "lpt1", 300, 0.0, 0.0, ;
    8.0, 10.0, 40, 11, FASTFLAG + FORMFEED)
IF nStatus < 0
    DO CASE
    CASE nStatus = -1
        ? "Cannot open", cFILENAME
    CASE nStatus = -2
        ? "Cannot allocate memory for line buffers"
    CASE nStatus = -3
        ? cFILENAME, " is not a CompuServe GIF file"
    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 = -8
        ? "Cannot print an interlaced GIF file"
    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 = -14
        ? "nPageSize must be 11, 14, or 17"
    CASE nStatus = -99
        ? "Parameters are invalid"
    ENDCASE
RETURN
ENDIF

For other examples of how to use the image printing functions, see 
SUNPRINT.PRG, an example program distributed with Sunshow Pro.



See Also: HPPJXLPCX() HPPJXLSCR()

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