Package net.sf.paperclips
Class ScalePrint
java.lang.Object
net.sf.paperclips.ScalePrint
- All Implemented Interfaces:
Print
A decorator print that scales it's target larger or smaller.
Note: On Windows, this class depends on a bugfix available as of Eclipse build 3.2, release candidate 3 (2006-04-28). Prior to this release, using ScalePrint triggers the bug, causing the document to scale very large on paper. This bug manifests itself only on paper, not with on-screen viewing.
- Author:
- Matthew Hall
-
Constructor Summary
ConstructorsConstructorDescriptionScalePrint
(Print target) Constructs a ScalePrint which scales down it's target to print at it's preferred size.ScalePrint
(Print target, Double scale) Constructs a ScalePrint which scales it's target by the given factor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getScale()
Returns the scale by which the target will be scaled, or null (indicating automatic scale down to fit).Returns the print being scaled.int
hashCode()
iterator
(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.GC gc) Returns a PrintIterator for laying out the contents of this Print.
-
Constructor Details
-
ScalePrint
Constructs a ScalePrint which scales down it's target to print at it's preferred size. This constructor is equivalent to calling new ScalePrint(target, null).- Parameters:
target
- the print to scale down.
-
ScalePrint
Constructs a ScalePrint which scales it's target by the given factor.- Parameters:
target
-scale
- the scale factor (must be >0). A value of 2.0 draws at double the size, and a value of 0.5 draws at half the size. A null value automatically scales down so the target is rendered at it's preferred size.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getTarget
Returns the print being scaled.- Returns:
- the print being scaled.
-
getScale
Returns the scale by which the target will be scaled, or null (indicating automatic scale down to fit).- Returns:
- the scale by which the target will be scaled, or null (indicating automatic scale down to fit).
-
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.
-