ewe.fx.print
Interface PrintSurface

All Known Implementing Classes:
PrintSurfaceObject

public interface PrintSurface


Field Summary
static int HINT_DONT_RESIZE
          This is a "hint" flag for getPageRect.
static int HINT_DONT_RESIZE_HEIGHT
          This is a "hint" flag for getPageRect().
static int HINT_DONT_RESIZE_WIDTH
          This is a "hint" flag for getPageRect().
static int HINT_GRAYSCALE_IMAGE
          This is a "hint" flag for getPageRect, and indicates that only gray scale drawing will be done on the PageRect.
static int HINT_MONO_IMAGE
          This is a "hint" flag for getPageRect, and indicates that only black and white drawing will be done on the PageRect.
 
Method Summary
 void cancelPageRect(PageRect r)
          This frees the resources of the PageRect without sending it to the output device.
 double getOutputXDPI()
          This returns the actual output DPI of the device on the X-axis or zero if the DPI is unkown.
 double getOutputYDPI()
          This returns the actual output DPI of the device on the Y-axis or zero if the DPI is unkown.
 PageRect getPageRect(double x, double y, double width, double height, double xDpi, double yDpi, int hints)
          Call this whithin the print() method of the Printable object to get a PageRect for a section of the current page.
 void movePageRect(PageRect pr, double newX, double newY)
          Move the PageRect to a new location relative to the top left corner of the page.
 void putPageRect(PageRect r)
          This sends the data on the PageRect to the output device (usually a printer).
 

Field Detail

HINT_DONT_RESIZE_WIDTH

public static final int HINT_DONT_RESIZE_WIDTH
This is a "hint" flag for getPageRect(). If the size of the PageRect specified is too big getPageRect() will attempt to reduce the size. If this flag is set then it will not reduce the width of the PageRect, only its height.

See Also:
Constant Field Values

HINT_DONT_RESIZE_HEIGHT

public static final int HINT_DONT_RESIZE_HEIGHT
This is a "hint" flag for getPageRect(). If the size of the PageRect specified is too big getPageRect() will attempt to reduce the size. If this flag is set then it will not reduce the height of the PageRect, only its width.

See Also:
Constant Field Values

HINT_DONT_RESIZE

public static final int HINT_DONT_RESIZE
This is a "hint" flag for getPageRect. If it is specified and the PageRect of the requested size and dpi could not be created, then the PrinterJob should not attempt to create a smaller one, but should just return null.

See Also:
Constant Field Values

HINT_MONO_IMAGE

public static final int HINT_MONO_IMAGE
This is a "hint" flag for getPageRect, and indicates that only black and white drawing will be done on the PageRect.

See Also:
Constant Field Values

HINT_GRAYSCALE_IMAGE

public static final int HINT_GRAYSCALE_IMAGE
This is a "hint" flag for getPageRect, and indicates that only gray scale drawing will be done on the PageRect.

See Also:
Constant Field Values
Method Detail

getPageRect

public PageRect getPageRect(double x,
                            double y,
                            double width,
                            double height,
                            double xDpi,
                            double yDpi,
                            int hints)
Call this whithin the print() method of the Printable object to get a PageRect for a section of the current page. You would then draw onto the Image buffer provided which would then be placed on the paper using putPageRect().

Note that this method may throw an IllegalArgumentException if the rect requested is too big. In which case you should request a smaller size rect or a lower DPI.

Parameters:
x - The x location in Points (1/72 of an inch) of the PageRect, relative to the top left of the page.
y - The y location in Points (1/72 of an inch) of the PageRect, relative to the top left of the page.
width - The width in Points (1/72 of an inch) of the PageRect.
height - The height in Points (1/72 of an inch) of the PageRect.
xDpi - The requested horizontal DPI of the PageRect. This will affect the number of pixels that are in the image horizontally.
yDpi - The requested horizontal DPI of the PageRect. This will affect the number of pixels that are in the image horizontally.
hints - Hints indicating the kind of drawing that will be done and how you want the method to behave. This should be any of the HINT_XXX values OR'ed together.
Returns:
a PageRect that you can draw on for later transfer to the printer, or null if a PageRect of the requested size and DPI could not be created, or if even a resized version could not be allocated.

movePageRect

public void movePageRect(PageRect pr,
                         double newX,
                         double newY)
Move the PageRect to a new location relative to the top left corner of the page. This method will erase the image buffer and reset the Graphics associated with it.

Parameters:
pr - the PageRect to move.
newX - the new x location in Points (1/72 of an inch) of the PageRect.
newY - the new y location in Points (1/72 of an inch) of the PageRect.

putPageRect

public void putPageRect(PageRect r)
This sends the data on the PageRect to the output device (usually a printer). This does not free the resources of the PageRect and it can be moved using movePageRect().


cancelPageRect

public void cancelPageRect(PageRect r)
This frees the resources of the PageRect without sending it to the output device. You should not use it after this.


getOutputXDPI

public double getOutputXDPI()
This returns the actual output DPI of the device on the X-axis or zero if the DPI is unkown. This is useful because it is a waste of resources to request PageRect objects with a DPI that is higher than the actual output DPI. Requesting a PageRect with the DPI equal to the output DPI will give you the best possible resolution, but will consume more resources.


getOutputYDPI

public double getOutputYDPI()
This returns the actual output DPI of the device on the Y-axis or zero if the DPI is unkown. This is useful because it is a waste of resources to request PageRect objects with a DPI that is higher than the actual output DPI. Requesting a PageRect with the DPI equal to the output DPI will give you the best possible resolution, but will consume more resources.