Class Print2DPrinterJob

java.lang.Object
  extended by Print2DPrinterJob
All Implemented Interfaces:
java.awt.print.Printable

public class Print2DPrinterJob
extends java.lang.Object
implements java.awt.print.Printable

This class handles printing for the CLIP system. It is capable of printing an array of BufferedImages with one image per page. Images are initially scaled down and then scale further if necessary to fit on a single page. The following code was used as reference when creating this class: http://java.sun.com/j2se/1.4.2/docs/guide/jps/spec/appendix_2DPrinterJob.fm.html#997825


Field Summary
(package private) static int ARRANGEMENT
          Print job intended to print out a tile arrangement
(package private)  java.awt.image.BufferedImage[] image
          Array of BufferedImages to print
(package private) static int INFORMATION
          Print job intended to print out the addtional tile information
(package private)  double minScale
          Minimum scale value of previous pages in the same job
(package private) static double normalScale
          Normal amount of scaling applied to each image
(package private)  int printType
          Type of print job (ARRANGEMENT or INFORMATION)
(package private)  int totalPages
          Total number of pages in the print job
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
Print2DPrinterJob(java.awt.image.BufferedImage[] img, int type)
          This Constructor sets up the print job, locates printers, and then performs the printing.
 
Method Summary
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Prints the image by scaling it down by the normalScale ammount or further if needed to fit on a single page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARRANGEMENT

static final int ARRANGEMENT
Print job intended to print out a tile arrangement

See Also:
Constant Field Values

INFORMATION

static final int INFORMATION
Print job intended to print out the addtional tile information

See Also:
Constant Field Values

printType

int printType
Type of print job (ARRANGEMENT or INFORMATION)


totalPages

int totalPages
Total number of pages in the print job


image

java.awt.image.BufferedImage[] image
Array of BufferedImages to print


normalScale

static final double normalScale
Normal amount of scaling applied to each image

See Also:
Constant Field Values

minScale

double minScale
Minimum scale value of previous pages in the same job

Constructor Detail

Print2DPrinterJob

public Print2DPrinterJob(java.awt.image.BufferedImage[] img,
                         int type)
This Constructor sets up the print job, locates printers, and then performs the printing.

Parameters:
img - Array of BufferedImages to print
type - Type of print job (ARRANGEMENT or INFORMATION)
Method Detail

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Prints the image by scaling it down by the normalScale ammount or further if needed to fit on a single page. If printing multiple pages, later pages will always scale by the same ammount as past pages unless they need to scale further to fit on one page.

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - Graphics object to draw the page on
pf - The PageFormat object of the page
pageIndex - The number of the page being printing.