Package com.teamten.typeset.element
Class Box
java.lang.Object
com.teamten.typeset.element.Element
com.teamten.typeset.element.NonDiscardableElement
com.teamten.typeset.element.Box
- All Implemented Interfaces:
Dimensions
Represents a 2D box of something, like a word or an image. Can be used by itself to make an empty space.
-
Field Summary
Fields inherited from class com.teamten.typeset.element.Element
DRAW_DEBUG
-
Constructor Summary
ConstructorsModifierConstructorDescriptionBox
(long width, long height, long depth) Box
(long width, long height, long depth, long shift) protected
Box
(Dimensions dimensions) protected
Box
(Dimensions dimensions, long shift) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawDebugRectangle
(org.apache.pdfbox.pdmodel.PDPageContentStream contents, long x, long y) Draw a debug rectangle at specified point, which represents the left-most point at the baseline.long
getDepth()
The distance from the baseline to the bottom of the box.protected String
A string that specifies the three dimensions of the box.long
The distance from the baseline to the top of the box.long
getShift()
The amount to shift this box, to the right during vertical layout and up during horizontal layout.long
getWidth()
The width (horizontally) of this box.long
layOutHorizontally
(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a horizontal sequence.long
layOutVertically
(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) Add the element to the contents as part of a vertical sequence.toString()
Methods inherited from class com.teamten.typeset.element.Element
getVerticalSize, println, println, shouldSkipElementAtStart, toTextString, toTextString, visit
-
Constructor Details
-
Box
public Box(long width, long height, long depth, long shift) -
Box
public Box(long width, long height, long depth) -
Box
-
Box
-
-
Method Details
-
drawDebugRectangle
protected void drawDebugRectangle(org.apache.pdfbox.pdmodel.PDPageContentStream contents, long x, long y) throws IOException Draw a debug rectangle at specified point, which represents the left-most point at the baseline.- Throws:
IOException
-
getWidth
public long getWidth()The width (horizontally) of this box.- Specified by:
getWidth
in interfaceDimensions
- Specified by:
getWidth
in classElement
-
getHeight
public long getHeight()The distance from the baseline to the top of the box.- Specified by:
getHeight
in interfaceDimensions
- Specified by:
getHeight
in classElement
-
getDepth
public long getDepth()The distance from the baseline to the bottom of the box.- Specified by:
getDepth
in interfaceDimensions
- Specified by:
getDepth
in classElement
-
getShift
public long getShift()The amount to shift this box, to the right during vertical layout and up during horizontal layout. -
layOutHorizontally
public long layOutHorizontally(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:Element
Add the element to the contents as part of a horizontal sequence.- Specified by:
layOutHorizontally
in classElement
- Parameters:
x
- the left-most point of the element.y
- the baseline of the element.contents
- the stream to add the element to.- Returns:
- how much to move right afterward.
- Throws:
IOException
-
layOutVertically
public long layOutVertically(long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException Description copied from class:Element
Add the element to the contents as part of a vertical sequence.- Specified by:
layOutVertically
in classElement
- Parameters:
x
- the left-most point of the element.y
- the upper-left point of the element.contents
- the stream to add the element to.- Returns:
- how much to move down afterward.
- Throws:
IOException
-
toString
-
getDimensionString
A string that specifies the three dimensions of the box.
-