|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.print.PrintPage
A PrintPage is used to help you draw a section of, or complete page, on a PrintSurface - usually as provided by a PrinterJob. It does this by requesting successive PageRect buffers from the PrintSurface such that it eventually completely covers the area that you wish to draw on. The getNext() method is used to retrieve successive PageRect sub-areas until the entire area is covered.
Additionally, each PageRect created has its Graphics translated such that drawing relative to an origin of (0,0) each time will always be drawn relative to the top left corner of the page section that the PrintPage covers.
| Constructor Summary | |
PrintPage(int pixelWidth,
int pixelHeight,
PrintSurface p,
double x,
double y,
double width,
double height,
int hints)
Create a PrintPage to cover a specific area on the PrintSurface where the xDPI and the yDPI are calculated such that they result in a pixel width and pixel height equal to those specified as parameters. |
|
PrintPage(PrintSurface p,
double x,
double y,
double width,
double height,
double xdpi,
double ydpi,
int hints)
Create a PrintPage to cover a specific area on the PrintSurface with a specified x-DPI and y-DPI. |
|
| Method Summary | |
PageRect |
getNext()
Call this method repeatedly until it returns null - indicating the page is complete. |
PointRect |
getPageRectArea(PageRect pr,
PointRect destination)
Return the area within the PrintPage as covered by the PageRect specified. |
PrintSurface |
getPrintSurface()
Return the PrintSurface being used by the PrintPage. |
boolean |
isWithin(PageRect pageRect,
double x,
double y)
Returns true if the specified co-ordinate in Points is within the current PageRect. |
boolean |
isWithin(PageRect pageRect,
double x,
double y,
double width,
double height)
Returns true if the specified rectangle in Points intersects the current PageRect. |
boolean |
isWithin(PageRect pageRect,
PointRect area)
Returns true if the specified rectangle in Points intersects the current PageRect. |
void |
requestBlockSize(double blockWidth,
double blockHeight)
Call this before calling getNextRect() for the first time on the PrintPage - to suggest the PageRect block size to use. |
Rect |
scaleToPixels(PointRect pr,
Rect destination)
Scale a PointRect containing Point dimensions into pixel dimensions for any PageRect created by this PrintPage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Constructor Detail |
public PrintPage(PrintSurface p,
double x,
double y,
double width,
double height,
double xdpi,
double ydpi,
int hints)
p - The PrintSurface.x - The x position of the area from the left edge of the paper in Points (1/72 of an inch).y - The y position of the area from the top edge of the paper in Points (1/72 of an inch).width - The width of the area in Points (1/72 of an inch).height - The height of the area in Points (1/72 of an inch).hints - any of the PrintSurface.HINT_XXX values OR'ed together.
public PrintPage(int pixelWidth,
int pixelHeight,
PrintSurface p,
double x,
double y,
double width,
double height,
int hints)
pixelWidth - The desired width of the page area in pixels.pixelHeight - The desired height of the page area in pixels.p - The PrintSurface.x - The x position of the area from the left edge of the paper in Points (1/72 of an inch).y - The y position of the area from the top edge of the paper in Points (1/72 of an inch).width - The width of the area in Points (1/72 of an inch).height - The height of the area in Points (1/72 of an inch).hints - any of the PrintSurface.HINT_XXX values OR'ed together.| Method Detail |
public PrintSurface getPrintSurface()
public boolean isWithin(PageRect pageRect,
double x,
double y)
pageRect - the current PageRect.x - the x co-ordinate in Points (1/72 of an inch).y - the y co-ordinate in Points (1/72 of an inch).
public boolean isWithin(PageRect pageRect,
double x,
double y,
double width,
double height)
pageRect - the current PageRect.x - the x co-ordinate in Points (1/72 of an inch).y - the y co-ordinate in Points (1/72 of an inch).width - the width in Points (1/72 of an inch).height - the height in Points (1/72 of an inch).
public boolean isWithin(PageRect pageRect,
PointRect area)
pageRect - the current PageRect.
public Rect scaleToPixels(PointRect pr,
Rect destination)
public PointRect getPageRectArea(PageRect pr,
PointRect destination)
public void requestBlockSize(double blockWidth,
double blockHeight)
blockWidth - the suggested block width in Points (1/72 or an inch).blockHeight - the suggested block height in Points (1/72 or an inch).public PageRect getNext()
Because of this, you can print an entire page by simply painting the exact same set of data to each PageRect that you receive - or you can call the isWithin() method to determine if an area or point is within the current PageRect - in which case there is no need to draw it.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||