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>_clipStackprivate Java2DFont_fontprivate java.awt.Graphics2D_graphicsprivate 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 voidclip(java.awt.Shape s)Deprecated.voiddraw(java.awt.Shape s)voiddrawBorderLine(java.awt.Shape bounds, int side, int lineWidth, boolean solid)voiddrawImage(FSImage image, int x, int y, boolean interpolate)protected voiddrawLine(int x1, int y1, int x2, int y2)voiddrawLinearGradient(FSLinearGradient lg, java.awt.Shape bounds)voiddrawOval(int x, int y, int width, int height)voiddrawRect(int x, int y, int width, int height)voiddrawSelection(RenderingContext c, InlineText inlineText)Deprecated.voiddrawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)Draw something using a Graphics2D at the given rectangle.voidendStructure(java.lang.Object token)voidfill(java.awt.Shape s)voidfillOval(int x, int y, int width, int height)voidfillRect(int x, int y, int width, int height)voidfinish(RenderingContext c, BlockBox _root)floatgetAbsoluteTransformOriginX()Deprecated.floatgetAbsoluteTransformOriginY()Deprecated.java.awt.ShapegetClip()Deprecated.Java2DFontgetFont()java.awt.Graphics2DgetGraphics()java.lang.ObjectgetRenderingHint(java.awt.RenderingHints.Key key)java.awt.StrokegetStroke()voidinitializePage(java.awt.Graphics2D pageGraphics)booleanisFastRenderer()The new (2018) fast renderer is in use.booleanisSupportsCMYKColors()booleanisSupportsSelection()Deprecated.voidpaintReplacedElement(RenderingContext c, BlockBox box)voidpopClip()Reverts the last clip on the stack.voidpopTransformLayer()Reverts the transform on the stack.voidpopTransforms(java.util.List<java.awt.geom.AffineTransform> inverse)Deprecated.voidpushClip(java.awt.Shape s)Applies a clip on the output device.voidpushTransformLayer(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.voidsetBidiReorderer(BidiReorderer _reorderer)voidsetClip(java.awt.Shape s)Deprecated.voidsetColor(FSColor color)voidsetFont(FSFont font)voidsetPaint(java.awt.Paint paint)voidsetRenderingContext(RenderingContext result)voidsetRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)voidsetRoot(BlockBox _root)voidsetStroke(java.awt.Stroke s)java.lang.ObjectstartStructure(StructureType type, Box box)Propagate the structure heirachy to allow for PDF/UA compliance.voidtranslate(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:
drawSelectionin interfaceOutputDevice
-
drawBorderLine
public void drawBorderLine(java.awt.Shape bounds, int side, int lineWidth, boolean solid)- Specified by:
drawBorderLinein interfaceOutputDevice
-
paintReplacedElement
public void paintReplacedElement(RenderingContext c, BlockBox box)
- Specified by:
paintReplacedElementin interfaceOutputDevice
-
setColor
public void setColor(FSColor color)
- Specified by:
setColorin interfaceOutputDevice
-
drawLine
protected void drawLine(int x1, int y1, int x2, int y2)- Specified by:
drawLinein classAbstractOutputDevice
-
drawRect
public void drawRect(int x, int y, int width, int height)- Specified by:
drawRectin interfaceOutputDevice
-
fillRect
public void fillRect(int x, int y, int width, int height)- Specified by:
fillRectin interfaceOutputDevice
-
setClip
@Deprecated public void setClip(java.awt.Shape s)
Deprecated.- Specified by:
setClipin interfaceOutputDevice
-
getClip
@Deprecated public java.awt.Shape getClip()
Deprecated.- Specified by:
getClipin interfaceOutputDevice
-
clip
@Deprecated public void clip(java.awt.Shape s)
Deprecated.- Specified by:
clipin interfaceOutputDevice
-
translate
public void translate(double tx, double ty)- Specified by:
translatein interfaceOutputDevice
-
getGraphics
public java.awt.Graphics2D getGraphics()
-
drawOval
public void drawOval(int x, int y, int width, int height)- Specified by:
drawOvalin interfaceOutputDevice
-
fillOval
public void fillOval(int x, int y, int width, int height)- Specified by:
fillOvalin interfaceOutputDevice
-
getRenderingHint
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key key)
- Specified by:
getRenderingHintin interfaceOutputDevice
-
setRenderingHint
public void setRenderingHint(java.awt.RenderingHints.Key key, java.lang.Object value)- Specified by:
setRenderingHintin interfaceOutputDevice
-
setFont
public void setFont(FSFont font)
- Specified by:
setFontin interfaceOutputDevice
-
getFont
public Java2DFont getFont()
-
setStroke
public void setStroke(java.awt.Stroke s)
- Specified by:
setStrokein interfaceOutputDevice
-
getStroke
public java.awt.Stroke getStroke()
- Specified by:
getStrokein interfaceOutputDevice
-
fill
public void fill(java.awt.Shape s)
- Specified by:
fillin interfaceOutputDevice
-
draw
public void draw(java.awt.Shape s)
- Specified by:
drawin interfaceOutputDevice
-
drawImage
public void drawImage(FSImage image, int x, int y, boolean interpolate)
- Specified by:
drawImagein interfaceOutputDevice
-
isSupportsSelection
@Deprecated public boolean isSupportsSelection()
Deprecated.- Specified by:
isSupportsSelectionin interfaceOutputDevice
-
isSupportsCMYKColors
public boolean isSupportsCMYKColors()
- Specified by:
isSupportsCMYKColorsin interfaceOutputDevice
-
drawWithGraphics
public void drawWithGraphics(float x, float y, float width, float height, OutputDeviceGraphicsDrawer renderer)Description copied from interface:OutputDeviceDraw something using a Graphics2D at the given rectangle.- Specified by:
drawWithGraphicsin interfaceOutputDevice
-
setPaint
public void setPaint(java.awt.Paint paint)
- Specified by:
setPaintin 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:OutputDeviceApply 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:
pushTransformsin 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:
popTransformsin interfaceOutputDevice
-
getAbsoluteTransformOriginX
@Deprecated public float getAbsoluteTransformOriginX()
Deprecated.- Specified by:
getAbsoluteTransformOriginXin interfaceOutputDevice
-
getAbsoluteTransformOriginY
@Deprecated public float getAbsoluteTransformOriginY()
Deprecated.- Specified by:
getAbsoluteTransformOriginYin 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:OutputDeviceApplies 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:
pushTransformLayerin interfaceOutputDevice
-
popTransformLayer
public void popTransformLayer()
Description copied from interface:OutputDeviceReverts 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:
popTransformLayerin interfaceOutputDevice
-
popClip
public void popClip()
Description copied from interface:OutputDeviceReverts the last clip on the stack. The fast renderer MUST usepushClipandpopClipin preference toclipandsetClip. 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:
popClipin interfaceOutputDevice
-
pushClip
public void pushClip(java.awt.Shape s)
Description copied from interface:OutputDeviceApplies a clip on the output device. This is a cumulative operation. The fast renderer MUST usepushClipandpopClipin preference toclipandsetClip. 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:
pushClipin interfaceOutputDevice
-
isFastRenderer
public boolean isFastRenderer()
Description copied from interface:OutputDeviceThe new (2018) fast renderer is in use.- Specified by:
isFastRendererin interfaceOutputDevice
-
startStructure
public java.lang.Object startStructure(StructureType type, Box box)
Description copied from interface:OutputDevicePropagate the structure heirachy to allow for PDF/UA compliance.- Specified by:
startStructurein interfaceOutputDevice
-
endStructure
public void endStructure(java.lang.Object token)
- Specified by:
endStructurein interfaceOutputDevice
-
drawLinearGradient
public void drawLinearGradient(FSLinearGradient lg, java.awt.Shape bounds)
- Specified by:
drawLinearGradientin interfaceOutputDevice
-
-