public interface Renderer
Renderer
provides methods to draw onto a target medium like a BufferedImage
. Methods use integer
pixel coordinates and the size of the medium is fixed. A typical use case is to compose a layout containing
SubPane
s and create a Renderer
representing the desired target medium and the layed out size.Modifier and Type | Method and Description |
---|---|
Renderer |
drawBorder(Area area,
int overflow)
Draw border in/around an Area.
|
Renderer |
drawEllipse(Area area)
Draw an ellipse or circle.
|
Renderer |
drawLine(int x1,
int y1,
int x2,
int y2)
Draw a line.
|
Renderer |
drawLine(Px2d p1,
Px2d p2)
Draw a line.
|
Renderer |
drawMolecule(Molecule mol,
Area area)
Render a
Molecule into an area. |
Renderer |
fillArea(Area area,
int overflow)
Fill an area.
|
Renderer |
fillEllipse(Area area)
Draw an ellipse or circle.
|
Renderer |
placeCenteredHorizontalTextInto(String sq,
Area area)
Place text into the middle of an area.
|
Renderer |
placeHorizontalTextInto(String text,
Halign halign,
Valign valign,
Area area,
int offsetX,
int offsetY)
Render text into an area.
|
Renderer |
placeVerticalTextInto(String text,
Halign halign,
Valign valign,
Area area,
int offsetX,
int offsetY)
Render rotated text into an area.
|
Renderer |
setColor(String spec)
Set color.
|
Renderer |
setFontHeight(int desiredHeight)
Set a suitable font size for a specific pixel height.
|
Renderer |
setFontHeight(int desiredHeight,
double scale)
Set a suitable font size for a specific pixel height.
|
Renderer |
setRGB(int r,
int g,
int b)
Set RGB color.
|
Renderer setColor(String spec)
spec
- Color to set. Should be compatible with Integer.decode(java.lang.String)
.Renderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer setRGB(int r, int g, int b)
r
- Red component, value must be between 0
and 255
, inclusiveg
- Green component, value must be between 0
and 255
, inclusiveb
- Blue component, value must be between 0
and 255
, inclusiveRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer drawLine(int x1, int y1, int x2, int y2)
x1
- First endpointy1
- First endpointx2
- Second endpointy2
- Second endpointRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer drawLine(Px2d p1, Px2d p2)
p1
- First endpointp2
- Second endpointRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer drawBorder(Area area, int overflow)
area
- Areaoverflow
- Use 0
to draw the inside bounds, 1
to draw immediate outside bounds.Renderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer fillArea(Area area, int overflow)
area
- Area to fill.overflow
- Use 0
to fill the represented area, 1
to fill the area and its immediate outside
boundsRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer drawEllipse(Area area)
Area
. In case of a Graphics
based
target the delegated method Graphics.drawOval(int, int, int, int)
will be invoked 1 pixel by 1 pixel
smaller size.area
- Area to fit intoRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer fillEllipse(Area area)
area
- Area to fit intoRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer setFontHeight(int desiredHeight)
desiredHeight
- Desired font heightRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer setFontHeight(int desiredHeight, double scale)
desiredHeight
- Desired font heightscale
- Scale factor to apply to the desired heightRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer placeCenteredHorizontalTextInto(String sq, Area area)
sq
- Text to placearea
- An areaRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer placeVerticalTextInto(String text, Halign halign, Valign valign, Area area, int offsetX, int offsetY)
text
- Single line text to renderhalign
- Horizontal alignment of the rendered text in the containing areavalign
- Vertical alignment of the rendered text in the containing areaarea
- The containing areaoffsetX
- X offset, applied after alignmentoffsetY
- Y offset, applied after alignmentRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.Renderer placeHorizontalTextInto(String text, Halign halign, Valign valign, Area area, int offsetX, int offsetY)
text
- Single line text to renderhalign
- Horizontal alignment of the text in the containing areavalign
- Vertical alignment of the text in the containing areaarea
- The containing areaoffsetX
- X offset, applied after alignmentoffsetY
- Y offset, applied after alignmentRenderer
which can be used equivalently to this
. An implementation might
choose to return this
.