Renderer for the PCL 5 printer language. It also uses HP GL/2 for certain graphic elements.
clip
protected void clip()
Clip using the current path.
clipRect
protected void clipRect(float x,
float y,
float width,
float height)
Clip an area. write a clipping operation given coordinates in the current
transform. Coordinates are in points.
x
- the x coordinatey
- the y coordinatewidth
- the width of the areaheight
- the height of the area
closePath
protected void closePath()
Closes the current subpath by appending a straight line segment from
the current point to the starting point of the subpath.
concatenateTransformationMatrix
protected void concatenateTransformationMatrix(AffineTransform at)
Concatenates the current transformation matrix with the given one, therefore establishing
a new coordinate system.
at
- the transformation matrix to process (coordinates in points)
drawBackAndBorders
protected void drawBackAndBorders(Area area,
float startx,
float starty,
float width,
float height)
Draw the background and borders. This draws the background and border
traits for an area given the position.
area
- the area whose traits are usedstartx
- the start x positionstarty
- the start y positionwidth
- the width of the areaheight
- the height of the area
drawBorders
protected void drawBorders(Rectangle2D.Float borderRect,
BorderProps bpsBefore,
BorderProps bpsAfter,
BorderProps bpsStart,
BorderProps bpsEnd)
Draws borders.
borderRect
- the border rectanglebpsBefore
- the border specification on the before sidebpsAfter
- the border specification on the after sidebpsStart
- the border specification on the start sidebpsEnd
- the border specification on the end side
drawFastBorders
protected void drawFastBorders(Rectangle2D.Float borderRect,
BorderProps bpsBefore,
BorderProps bpsAfter,
BorderProps bpsStart,
BorderProps bpsEnd)
Draws borders. Borders are drawn as shaded rectangles with no clipping.
borderRect
- the border rectanglebpsBefore
- the border specification on the before sidebpsAfter
- the border specification on the after sidebpsStart
- the border specification on the start sidebpsEnd
- the border specification on the end side
drawImage
protected void drawImage(String uri,
Rectangle2D pos,
Map foreignAttributes)
Draw an image at the indicated location.
uri
- the URI/URL of the imagepos
- the position of the imageforeignAttributes
- an optional Map with foreign attributes, may be null
drawQualityBorders
protected void drawQualityBorders(Rectangle2D.Float borderRect,
BorderProps bpsBefore,
BorderProps bpsAfter,
BorderProps bpsStart,
BorderProps bpsEnd)
Draws borders. Borders are drawn in-memory and painted as a bitmap.
borderRect
- the border rectanglebpsBefore
- the border specification on the before sidebpsAfter
- the border specification on the after sidebpsStart
- the border specification on the start sidebpsEnd
- the border specification on the end side
fillRect
protected void fillRect(float x,
float y,
float width,
float height)
Fill a rectangular area.
x
- the x coordinate (in pt)y
- the y coordinate (in pt)width
- the width of the rectangleheight
- the height of the rectangle
getGraphicContext
public GraphicContext getGraphicContext()
- the GraphicContext used to track coordinate system transformations
getResolution
protected int getResolution()
handleBlockTraits
protected void handleBlockTraits(Block block)
Handle block traits.
The block could be any sort of block with any positioning
so this should render the traits such as border and background
in its position.
- handleBlockTraits in interface AbstractRenderer
block
- the block to render the traits
handleIOTrouble
protected void handleIOTrouble(IOException ioe)
Central exception handler for I/O exceptions.
ioe
- IOException to handle
isPJLDisabled
public boolean isPJLDisabled()
Indicates whether PJL generation is disabled.
- true if PJL generation is disabled.
lineTo
protected void lineTo(float x,
float y)
Appends a straight line segment from the current point to (x, y). The
new current point is (x, y).
x
- x coordinatey
- y coordinate
moveTo
protected void moveTo(float x,
float y)
Moves the current point to (x, y), omitting any connecting line segment.
x
- x coordinatey
- y coordinate
renderInlineAreaBackAndBorders
protected void renderInlineAreaBackAndBorders(InlineArea area)
Common method to render the background and borders for any inline area.
The all borders and padding are drawn outside the specified area.
- renderInlineAreaBackAndBorders in interface AbstractRenderer
area
- the inline area for which the background, border and padding is to be
rendered
- Copied from AbstractPathOrientedRenderer
renderViewport
public void renderViewport(Viewport viewport)
Render an inline viewport.
This renders an inline viewport by clipping if necessary.
- renderViewport in interface AbstractRenderer
viewport
- the viewport to handle
- Copied from AbstractPathOrientedRenderer
restoreGraphicsState
protected void restoreGraphicsState()
Restores the last graphics state from the stack.
saveGraphicsState
protected void saveGraphicsState()
Saves the current graphics state on the stack.
setAllTextAsBitmaps
public void setAllTextAsBitmaps(boolean allTextAsBitmaps)
Controls whether all text should be generated as bitmaps or only text for which there's
no native font.
allTextAsBitmaps
- true if all text should be painted as bitmaps
setFont
public boolean setFont(String name,
float size,
String text)
throws IOException
Sets the current font (NOTE: Hard-coded font mappings ATM!)
name
- the font name (internal F* names for now)size
- the font sizetext
- the text to be rendered (used to determine if there are non-printable chars)
- true if the font can be mapped to PCL
setPJLDisabled
public void setPJLDisabled(boolean disable)
Controls whether PJL commands shall be generated by the PCL renderer.
disable
- true to disable PJL commands
setQualityBeforeSpeed
public void setQualityBeforeSpeed(boolean qualityBeforeSpeed)
Configures the renderer to trade speed for quality if desired. One example here is the way
that borders are rendered.
qualityBeforeSpeed
- true if quality is more important than speed
updateFillColor
protected void updateFillColor(java.awt.Color color)
Sets the new current fill color.