net.sf.paperclips
Class ImagePrint

java.lang.Object
  extended by net.sf.paperclips.ImagePrint
All Implemented Interfaces:
Print

public class ImagePrint
extends java.lang.Object
implements Print

A Print for displaying images.


Constructor Summary
ImagePrint(org.eclipse.swt.graphics.ImageData imageData)
          Constructs an ImagePrint with the given imageData, initialized at 72dpi.
ImagePrint(org.eclipse.swt.graphics.ImageData imageData, org.eclipse.swt.graphics.Point dpi)
          Constructs an ImagePrint with the given imageData and dpi.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 org.eclipse.swt.graphics.Point getDPI()
          Returns the DPI that this image will be rendered at.
 org.eclipse.swt.graphics.ImageData getImageData()
          Returns the ImageData of the image being printed.
 org.eclipse.swt.graphics.Point getSize()
          Returns the size that the image will be rendered at, in points.
 int hashCode()
           
 PrintIterator iterator(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc)
          Returns a PrintIterator for laying out the contents of this Print.
 void setDPI(int dpiX, int dpiY)
          Sets the ImagePrint to render the image at the given DPI.
 void setDPI(org.eclipse.swt.graphics.Point dpi)
          Sets the ImagePrint to render the image at the DPI of the argument.
 void setSize(int width, int height)
          Sets the ImagePrint to render the image at the given size, in points.
 void setSize(org.eclipse.swt.graphics.Point size)
          Sets the ImagePrint to render the image at the given size, in points.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImagePrint

public ImagePrint(org.eclipse.swt.graphics.ImageData imageData)
Constructs an ImagePrint with the given imageData, initialized at 72dpi.

Parameters:
imageData - the image to be displayed.

ImagePrint

public ImagePrint(org.eclipse.swt.graphics.ImageData imageData,
                  org.eclipse.swt.graphics.Point dpi)
Constructs an ImagePrint with the given imageData and dpi.

Parameters:
imageData - the image to be displayed.
dpi - the DPI that the image will be displayed at.
Method Detail

getImageData

public org.eclipse.swt.graphics.ImageData getImageData()
Returns the ImageData of the image being printed.

Returns:
the ImageData of the image being printed.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setSize

public void setSize(org.eclipse.swt.graphics.Point size)
Sets the ImagePrint to render the image at the given size, in points. 72 points = 1".

Parameters:
size - the explicit size, in points, that the image be printed at.

setSize

public void setSize(int width,
                    int height)
Sets the ImagePrint to render the image at the given size, in points. 72 points = 1".

Parameters:
width - the explicit width, in points, that the image will be printed at.
height - the explicit height, in points, that the image will be printed at.

getSize

public org.eclipse.swt.graphics.Point getSize()
Returns the size that the image will be rendered at, in points. 72 points = 1".

Returns:
the size of the image, in points.

setDPI

public void setDPI(org.eclipse.swt.graphics.Point dpi)
Sets the ImagePrint to render the image at the DPI of the argument.

Parameters:
dpi - the DPI of the image.

setDPI

public void setDPI(int dpiX,
                   int dpiY)
Sets the ImagePrint to render the image at the given DPI.

Parameters:
dpiX - the horizontal DPI the image will be rendered at.
dpiY - the vertical DPI the image will be rendered at.

getDPI

public org.eclipse.swt.graphics.Point getDPI()
Returns the DPI that this image will be rendered at.

Returns:
the DPI the image will be rendered at.

iterator

public PrintIterator iterator(org.eclipse.swt.graphics.Device device,
                              org.eclipse.swt.graphics.GC gc)
Description copied from interface: Print
Returns a PrintIterator for laying out the contents of this Print. The iterator uses a snapshot of the print at the time this method is invoked, so subsequent changes to the Print will not affect the output of the iterator.

Specified by:
iterator in interface Print
Parameters:
device - the graphics device this Print will be drawn onto.
gc - the graphics context to be used for calculating layout and drawing the Print's contents.
Returns:
a PrintIterator for laying out the contents of this Print.