public class IlvTransformedPrintable extends IlvPrintableComponent
Component
. The class automatically calculates
the transformation required to print the component.NO_SUCH_PAGE, PAGE_EXISTS
Constructor and Description |
---|
IlvTransformedPrintable(Component component,
IlvUnit.Rectangle area,
double x,
double y,
double scale)
Creates a
TransformedPrintable to print the
given component with the specified transformation. |
IlvTransformedPrintable(Component component,
IlvUnit.Rectangle area,
Rectangle window)
Creates a
TransformedPrintable to print the
specified window of the given component. |
Modifier and Type | Method and Description |
---|---|
void |
computeTransform(Rectangle window)
Computes the internal transformation so that the portion of the component
specified by
window is printed to
the print area. |
AffineTransform |
getTransform()
Returns the
AffineTransform applied to the Graphics
before printing the component. |
int |
print(Graphics dst,
PageFormat format,
int pageIndex)
Implements the
java.awt.print.Printable.print method. |
void |
setTransform(AffineTransform transform)
Sets the
AffineTransform applied to the Graphics
before printing the component. |
getComponent, getPrintableArea, setComponent, setPrintableArea
getPage
public IlvTransformedPrintable(Component component, IlvUnit.Rectangle area, double x, double y, double scale)
TransformedPrintable
to print the
given component with the specified transformation.
To print the component to the specified area
of a Graphics
, a transformation must be applied
to the Graphics
. This constructor creates an isotropic
transformation.component
- The component to be printed.area
- The area, in paper coordinates, defining where the
component is printed.x
- The horizontal translation applied to the Graphics
,
specified in paper coordinate points
as the offset
between the paper and component locations. For example, to position the
component's compX
position at the beginning of the printable
area
, you would compute the x
translation as:
area.getXAs(IlvUnit.POINTS)-compX*scale
.y
- The vertical translation applied to the Graphics
,
specified in paper coordinate points
as the offset
between the paper and component locations. For example, to position the
component's compY
position at the top of the printable
area
, you would compute the y
translation as:
area.getYAs(IlvUnit.POINTS)-compY*scale
.scale
- The scale applied to the Graphics
, specified as
the ratio of paper coordinate points
to component
pixels.public IlvTransformedPrintable(Component component, IlvUnit.Rectangle area, Rectangle window)
TransformedPrintable
to print the
specified window
of the given component.
To print the component to the specified area
of a Graphics
, a transformation must be applied
to the Graphics
. This constructor calculates the
transformation, which is not necessarily isotropic.component
- The component to be printed.area
- The area, in paper coordinates, defining where the
component is printed.window
- Defines the portion of the component to be printed.public int print(Graphics dst, PageFormat format, int pageIndex) throws PrinterException
java.awt.print.Printable.print
method. This method is called
to print the object.dst
- The output device, which must be a Graphics2D
object.format
- The format of the page.pageIndex
- The index of the page.PrinterException
public void computeTransform(Rectangle window)
window
is printed to
the print area.window
- Defines the portion of the component to be printed.public void setTransform(AffineTransform transform)
AffineTransform
applied to the Graphics
before printing the component.transform
- The AffineTransform
applied to the
Graphics
. The transform's scaling elements are specified as
the ratio of paper coordinate points
to component
pixels. The transform's translation elements are specified in paper
coordinate points
as the offset between the paper
and component locations.getTransform()
public AffineTransform getTransform()
AffineTransform
applied to the Graphics
before printing the component.AffineTransform
applied to the
Graphics
. The transform's scaling elements are specified as
the ratio of paper coordinate points
to component
pixels. The transform's translation elements are specified in paper
coordinate points
as the offset between the paper
and component locations.setTransform(java.awt.geom.AffineTransform)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.