fable.framework.imageprint
Class ImagePrintUtils

java.lang.Object
  extended by fable.framework.imageprint.ImagePrintUtils

public class ImagePrintUtils
extends java.lang.Object


Constructor Summary
ImagePrintUtils()
           
 
Method Summary
static boolean dialogPrintImage(org.eclipse.swt.widgets.Shell shell, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point imageDPI, PrintSettings settings)
          Prints an image, first bringing up a PrintDialog.
static void drawImage(org.eclipse.swt.graphics.Drawable drawable, org.eclipse.swt.graphics.Point drawableDPI, org.eclipse.swt.graphics.Rectangle bounds, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point imageDPI, PrintSettings settings)
          A general method for drawing an image on a Drawable using parameters from a PrintSettings.
static void paintPreview(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.widgets.Canvas canvas, org.eclipse.swt.graphics.Rectangle canvasBounds, org.eclipse.swt.graphics.Image image, PrintSettings settings)
          A general method for painting a canvas with a print preview in response to a PaintEvent.
static boolean printControl(org.eclipse.swt.widgets.Control control)
          Brings up a PrintDialog to print the given Control with the default print settings.
static boolean printControl(org.eclipse.swt.widgets.Control control, PrintSettings settings)
          Brings up a PrintDialog to print the given Control.
static void printImage(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point imageDPI, PrintSettings settings)
          Prints an image without bringing up a PrintDialog.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImagePrintUtils

public ImagePrintUtils()
Method Detail

printControl

public static boolean printControl(org.eclipse.swt.widgets.Control control)
Brings up a PrintDialog to print the given Control with the default print settings. Calls printControl(control, null).

Parameters:
control - The control to print.
Returns:

printControl

public static boolean printControl(org.eclipse.swt.widgets.Control control,
                                   PrintSettings settings)
Brings up a PrintDialog to print the given Control.

Parameters:
control - The control to print.
settings - The desired PrinterSettings or null to use the default.
Returns:
If the operation was canceled or not.

dialogPrintImage

public static boolean dialogPrintImage(org.eclipse.swt.widgets.Shell shell,
                                       org.eclipse.swt.graphics.Image image,
                                       org.eclipse.swt.graphics.Point imageDPI,
                                       PrintSettings settings)
Prints an image, first bringing up a PrintDialog. Works with a copy of the image and disposes the copy when done.

Parameters:
shell - The Shell parent for the dialog.
image - The image. Cannot be null.
imageDPI - The image DPI, typically the the Display DPI. Use (72, 72) if you don't know what else to use.
settings - The desired PrinterSettings or null to use the default.
Returns:
If the operation was canceled or not.

printImage

public static void printImage(org.eclipse.swt.graphics.Image image,
                              org.eclipse.swt.graphics.Point imageDPI,
                              PrintSettings settings)
Prints an image without bringing up a PrintDialog. Runs a print job in a separate thread. Works with a copy of the image and disposes the copy when done.

Parameters:
image - The image. Cannot be null.
imageDPI - The image DPI, typically the the Display DPI. Use (72, 72) if you don't know what else to use.
settings - The desired PrinterSettings or null to use the default.

drawImage

public static void drawImage(org.eclipse.swt.graphics.Drawable drawable,
                             org.eclipse.swt.graphics.Point drawableDPI,
                             org.eclipse.swt.graphics.Rectangle bounds,
                             org.eclipse.swt.graphics.Image image,
                             org.eclipse.swt.graphics.Point imageDPI,
                             PrintSettings settings)
A general method for drawing an image on a Drawable using parameters from a PrintSettings. The image will not be disposed.

Parameters:
drawable - Where to draw the image. Cannot be null.
drawableDPI - The DPI of the Drawable. If null will use (72,72).
bounds - The bounds of the area on the Drawable to use.
image - The image. Cannot be null.
imageDPI - The image DPI, typically the the Display DPI. If null will use (72,72).
settings - The desired PrinterSettings or null to use the default.

paintPreview

public static void paintPreview(org.eclipse.swt.graphics.GC gc,
                                org.eclipse.swt.widgets.Canvas canvas,
                                org.eclipse.swt.graphics.Rectangle canvasBounds,
                                org.eclipse.swt.graphics.Image image,
                                PrintSettings settings)
A general method for painting a canvas with a print preview in response to a PaintEvent. This method draws the page area on the canvas, scaling it appropriately, then calls drawImage, which handles the drawing of the image on the page. The image will not be disposed.

Parameters:
ev - The paint event.
canvas - The canvas.
gc - The GC to use.
printer - The desired Printer or null to use the default printer.
image - The image. Cannot be null.
settings - The desired PrinterSettings or null to use the default.