Package com.openhtmltopdf.java2d
Class Java2DOutputDevice
- java.lang.Object
-
- com.openhtmltopdf.render.AbstractOutputDevice
-
- com.openhtmltopdf.java2d.Java2DOutputDevice
-
- All Implemented Interfaces:
OutputDevice
public class Java2DOutputDevice extends AbstractOutputDevice implements OutputDevice
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Deque<java.awt.Shape>
_clipStack
private Java2DFont
_font
private java.awt.Graphics2D
_graphics
private java.util.Deque<java.awt.geom.AffineTransform>
_transformStack
-
Constructor Summary
Constructors Constructor Description Java2DOutputDevice(java.awt.Graphics2D layoutGraphics)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clip(java.awt.Shape s)
Deprecated.void
draw(java.awt.Shape s)
void
drawBorderLine(java.awt.Shape bounds, int side, int lineWidth, boolean solid)
void
drawImage(FSImage image, int x, int y, boolean interpolate)
protected void
drawLine(int x1, int y1, int x2, int y2)
void
drawLinearGradient(FSLinearGradient lg, java.awt.Shape bounds)
void
drawOval(int x, int y, int width, int height)
void
drawRect(int x, int y, int width, int height)
void
drawSelection(RenderingContext c, InlineText inlineText)
Deprecated.void
drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)
Draw something using a Graphics2D at the given rectangle.void
endStructure(java.lang.Object token)
void
fill(java.awt.Shape s)
void
fillOval(int x, int y, int width, int height)
void
fillRect(int x, int y, int width, int height)
void
finish(RenderingContext c, BlockBox _root)
float
getAbsoluteTransformOriginX()
Deprecated.float
getAbsoluteTransformOriginY()
Deprecated.java.awt.Shape
getClip()
Deprecated.Java2DFont
getFont()
java.awt.Graphics2D
getGraphics()
java.lang.Object
getRenderingHint(java.awt.RenderingHints.Key key)
java.awt.Stroke
getStroke()
void
initializePage(java.awt.Graphics2D pageGraphics)
boolean
isFastRenderer()
The new (2018) fast renderer is in use.boolean
isSupportsCMYKColors()
boolean
isSupportsSelection()
Deprecated.void
paintReplacedElement(RenderingContext c, BlockBox box)
void
popClip()
Reverts the last clip on the stack.void
popTransformLayer()
Reverts the transform on the stack.void
popTransforms(java.util.List<java.awt.geom.AffineTransform> inverse)
Deprecated.void
pushClip(java.awt.Shape s)
Applies a clip on the output device.void
pushTransformLayer(java.awt.geom.AffineTransform transform)
Applies a transform on the output device.java.util.List<java.awt.geom.AffineTransform>
pushTransforms(java.util.List<java.awt.geom.AffineTransform> transforms)
Deprecated.void
setBidiReorderer(BidiReorderer _reorderer)
void
setClip(java.awt.Shape s)
Deprecated.void
setColor(FSColor color)
void
setFont(FSFont font)
void
setPaint(java.awt.Paint paint)
void
setRenderingContext(RenderingContext result)
void
setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)
void
setRoot(BlockBox _root)
void
setStroke(java.awt.Stroke s)
java.lang.Object
startStructure(StructureType type, Box box)
Propagate the structure heirachy to allow for PDF/UA compliance.void
translate(double tx, double ty)
-
Methods inherited from class com.openhtmltopdf.render.AbstractOutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, getFontSpecification, isPDF, paintBackground, paintBackground, paintBorder, paintBorder, paintCollapsedBorder, setFontSpecification
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.openhtmltopdf.extend.OutputDevice
drawDebugOutline, drawText, drawTextDecoration, drawTextDecoration, isPDF, paintBackground, paintBackground, paintBorder, paintBorder, paintCollapsedBorder
-
-
-
-
Field Detail
-
_clipStack
private final java.util.Deque<java.awt.Shape> _clipStack
-
_transformStack
private final java.util.Deque<java.awt.geom.AffineTransform> _transformStack
-
_graphics
private java.awt.Graphics2D _graphics
-
_font
private Java2DFont _font
-
-
Method Detail
-
drawSelection
@Deprecated public void drawSelection(RenderingContext c, InlineText inlineText)
Deprecated.- Specified by:
drawSelection
in interfaceOutputDevice
-
drawBorderLine
public void drawBorderLine(java.awt.Shape bounds, int side, int lineWidth, boolean solid)
- Specified by:
drawBorderLine
in interfaceOutputDevice
-
paintReplacedElement
public void paintReplacedElement(RenderingContext c, BlockBox box)
- Specified by:
paintReplacedElement
in interfaceOutputDevice
-
setColor
public void setColor(FSColor color)
- Specified by:
setColor
in interfaceOutputDevice
-
drawLine
protected void drawLine(int x1, int y1, int x2, int y2)
- Specified by:
drawLine
in classAbstractOutputDevice
-
drawRect
public void drawRect(int x, int y, int width, int height)
- Specified by:
drawRect
in interfaceOutputDevice
-
fillRect
public void fillRect(int x, int y, int width, int height)
- Specified by:
fillRect
in interfaceOutputDevice
-
setClip
@Deprecated public void setClip(java.awt.Shape s)
Deprecated.- Specified by:
setClip
in interfaceOutputDevice
-
getClip
@Deprecated public java.awt.Shape getClip()
Deprecated.- Specified by:
getClip
in interfaceOutputDevice
-
clip
@Deprecated public void clip(java.awt.Shape s)
Deprecated.- Specified by:
clip
in interfaceOutputDevice
-
translate
public void translate(double tx, double ty)
- Specified by:
translate
in interfaceOutputDevice
-
getGraphics
public java.awt.Graphics2D getGraphics()
-
drawOval
public void drawOval(int x, int y, int width, int height)
- Specified by:
drawOval
in interfaceOutputDevice
-
fillOval
public void fillOval(int x, int y, int width, int height)
- Specified by:
fillOval
in interfaceOutputDevice
-
getRenderingHint
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key key)
- Specified by:
getRenderingHint
in interfaceOutputDevice
-
setRenderingHint
public void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)
- Specified by:
setRenderingHint
in interfaceOutputDevice
-
setFont
public void setFont(FSFont font)
- Specified by:
setFont
in interfaceOutputDevice
-
getFont
public Java2DFont getFont()
-
setStroke
public void setStroke(java.awt.Stroke s)
- Specified by:
setStroke
in interfaceOutputDevice
-
getStroke
public java.awt.Stroke getStroke()
- Specified by:
getStroke
in interfaceOutputDevice
-
fill
public void fill(java.awt.Shape s)
- Specified by:
fill
in interfaceOutputDevice
-
draw
public void draw(java.awt.Shape s)
- Specified by:
draw
in interfaceOutputDevice
-
drawImage
public void drawImage(FSImage image, int x, int y, boolean interpolate)
- Specified by:
drawImage
in interfaceOutputDevice
-
isSupportsSelection
@Deprecated public boolean isSupportsSelection()
Deprecated.- Specified by:
isSupportsSelection
in interfaceOutputDevice
-
isSupportsCMYKColors
public boolean isSupportsCMYKColors()
- Specified by:
isSupportsCMYKColors
in interfaceOutputDevice
-
drawWithGraphics
public void drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)
Description copied from interface:OutputDevice
Draw something using a Graphics2D at the given rectangle.- Specified by:
drawWithGraphics
in interfaceOutputDevice
-
setPaint
public void setPaint(java.awt.Paint paint)
- Specified by:
setPaint
in interfaceOutputDevice
-
pushTransforms
@Deprecated public java.util.List<java.awt.geom.AffineTransform> pushTransforms(java.util.List<java.awt.geom.AffineTransform> transforms)
Deprecated.Description copied from interface:OutputDevice
Apply the given transform on top of the current one in the PDF graphics stream. This is a cumulative operation. You should popTransform after the box and children are painted.- Specified by:
pushTransforms
in interfaceOutputDevice
- Returns:
- the list of inverse transforms to undo the effect of this transform
-
popTransforms
@Deprecated public void popTransforms(java.util.List<java.awt.geom.AffineTransform> inverse)
Deprecated.- Specified by:
popTransforms
in interfaceOutputDevice
-
getAbsoluteTransformOriginX
@Deprecated public float getAbsoluteTransformOriginX()
Deprecated.- Specified by:
getAbsoluteTransformOriginX
in interfaceOutputDevice
-
getAbsoluteTransformOriginY
@Deprecated public float getAbsoluteTransformOriginY()
Deprecated.- Specified by:
getAbsoluteTransformOriginY
in interfaceOutputDevice
-
setBidiReorderer
public void setBidiReorderer(BidiReorderer _reorderer)
-
setRenderingContext
public void setRenderingContext(RenderingContext result)
-
setRoot
public void setRoot(BlockBox _root)
-
initializePage
public void initializePage(java.awt.Graphics2D pageGraphics)
-
finish
public void finish(RenderingContext c, BlockBox _root)
-
pushTransformLayer
public void pushTransformLayer(java.awt.geom.AffineTransform transform)
Description copied from interface:OutputDevice
Applies a transform on the output device. This is a cumulativew operation. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform)
,OutputDevice.popTransformLayer()
,OutputDevice.pushClip(Shape)
andOutputDevice.popClip()
MUST be nested correctly.- Specified by:
pushTransformLayer
in interfaceOutputDevice
-
popTransformLayer
public void popTransformLayer()
Description copied from interface:OutputDevice
Reverts the transform on the stack. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform)
,OutputDevice.popTransformLayer()
,OutputDevice.pushClip(Shape)
andOutputDevice.popClip()
MUST be nested correctly.- Specified by:
popTransformLayer
in interfaceOutputDevice
-
popClip
public void popClip()
Description copied from interface:OutputDevice
Reverts the last clip on the stack. The fast renderer MUST usepushClip
andpopClip
in preference toclip
andsetClip
. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform)
,OutputDevice.popTransformLayer()
,OutputDevice.pushClip(Shape)
andOutputDevice.popClip()
MUST be nested correctly.- Specified by:
popClip
in interfaceOutputDevice
-
pushClip
public void pushClip(java.awt.Shape s)
Description copied from interface:OutputDevice
Applies a clip on the output device. This is a cumulative operation. The fast renderer MUST usepushClip
andpopClip
in preference toclip
andsetClip
. NOTE: The current implementation shares a stack between transforms and clips, so calls toOutputDevice.pushTransformLayer(AffineTransform)
,OutputDevice.popTransformLayer()
,OutputDevice.pushClip(Shape)
andOutputDevice.popClip()
MUST be nested correctly.- Specified by:
pushClip
in interfaceOutputDevice
-
isFastRenderer
public boolean isFastRenderer()
Description copied from interface:OutputDevice
The new (2018) fast renderer is in use.- Specified by:
isFastRenderer
in interfaceOutputDevice
-
startStructure
public java.lang.Object startStructure(StructureType type, Box box)
Description copied from interface:OutputDevice
Propagate the structure heirachy to allow for PDF/UA compliance.- Specified by:
startStructure
in interfaceOutputDevice
-
endStructure
public void endStructure(java.lang.Object token)
- Specified by:
endStructure
in interfaceOutputDevice
-
drawLinearGradient
public void drawLinearGradient(FSLinearGradient lg, java.awt.Shape bounds)
- Specified by:
drawLinearGradient
in interfaceOutputDevice
-
-