|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cytoscape.render.immed.GraphGraphics
public final class GraphGraphics
The purpose of this class is to make the proper calls on a Graphics2D object to efficiently render nodes, labels, and edges. This is procedural programming at its finest [sarcasm].
This class deals with two coordinate systems: an image coordinate system and a node coordinate system. The programmer who uses this API will be dealing mostly with the node coordinate system, especially when rendering individual nodes and edges. The clear() method specifies the mapping from the node coordinate system to the image coordinate system. The two coordinate systems do have the same orientations: increasing X values point to the right and increasing Y values point to the bottom. The image coordinate system dictates that (0,0) is the upper left corner of the image and that each unit represents a pixel width (or height). if (m_debug) { if (!EventQueue.isDispatchThread()) throw new IllegalStateException( "calling thread is not AWT event dispatcher"); if (!(xMin < xMax)) throw new IllegalArgumentException("xMin not less than xMax"); if (!(yMin < yMax)) throw new IllegalArgumentException("yMin not less than yMax"); if (nodeShape == SHAPE_ROUNDED_RECTANGLE) { final double width = ((double) xMax) - xMin; final double height = ((double) yMax) - yMin; if (!(Math.max(width, height) < (2.0d * Math.min(width, height)))) throw new IllegalArgumentException( "rounded rectangle does not meet cotextnstraint " + "max(width, height) < 2 * min(width, height)"); } }
NOTE: Every method on an instance of this class needs to be called by the AWT event dispatching thread save the constructor. However, checks for this are made only if debug is set to true (see constructur). In fact, in certain situations [such as rendering to a non-image such as a vector graphic] it may make sense to never call any of the methods from the AWT event dispatching thread.
Field Summary | |
---|---|
static byte |
ARROW_ARROWHEAD
|
static byte |
ARROW_DELTA
|
static byte |
ARROW_DIAMOND
|
static byte |
ARROW_DISC
|
static byte |
ARROW_HALF_BOTTOM
|
static byte |
ARROW_HALF_TOP
|
static byte |
ARROW_NONE
|
static byte |
ARROW_TEE
|
static int |
CUSTOM_SHAPE_MAX_VERTICES
This value is currently 100. |
Image |
image
The image that was passed into the constructor. |
static int |
MAX_EDGE_ANCHORS
This value is currently 64. |
static byte |
SHAPE_DIAMOND
|
static byte |
SHAPE_ELLIPSE
|
static byte |
SHAPE_HEXAGON
|
static byte |
SHAPE_OCTAGON
|
static byte |
SHAPE_PARALLELOGRAM
|
static byte |
SHAPE_RECTANGLE
Node shape constants |
static byte |
SHAPE_ROUNDED_RECTANGLE
|
static byte |
SHAPE_TRIANGLE
|
static byte |
SHAPE_VEE
|
Constructor Summary | |
---|---|
GraphGraphics(Image image,
boolean debug)
All rendering operations will be performed on the specified image. |
Method Summary | |
---|---|
void |
clear(Paint bgPaint,
double xCenter,
double yCenter,
double scaleFactor)
Clears image area with background paint specified and sets an appropriate transformation of coordinate systems. |
boolean |
computeEdgeIntersection(byte nodeShape,
float xMin,
float yMin,
float xMax,
float yMax,
float offset,
float ptX,
float ptY,
float[] returnVal)
Computes the intersection point between a node outline and a line segment; one point of the line segment lies at the center of the node outline. |
boolean |
customNodeShapeExists(byte shape)
Determines whether the specified shape is a custom defined node shape. |
byte |
defineCustomNodeShape(float[] coords,
int offset,
int vertexCount)
The custom node shape that is defined is a polygon specified by the coordinates supplied. |
void |
drawCustomGraphicFull(Shape shape,
float xOffset,
float yOffset,
Paint paint)
Fills an arbitrary graphical shape with high detail. |
void |
drawEdgeFull(byte arrow0Type,
float arrow0Size,
Paint arrow0Paint,
byte arrow1Type,
float arrow1Size,
Paint arrow1Paint,
float x0,
float y0,
EdgeAnchors anchors,
float x1,
float y1,
float edgeThickness,
Stroke edgeStroke,
Paint edgePaint)
Draws an edge with medium to high detail, depending on parameters specified. |
void |
drawEdgeLow(float x0,
float y0,
float x1,
float y1,
Color edgeColor)
This is the method that will render an edge very quickly. |
void |
drawNodeFull(byte nodeShape,
float xMin,
float yMin,
float xMax,
float yMax,
Paint fillPaint,
float borderWidth,
Paint borderPaint)
Draws a node with medium to high detail, depending on parameters specified. |
void |
drawNodeLow(float xMin,
float yMin,
float xMax,
float yMax,
Color fillColor)
This is the method that will render a node very quickly. |
void |
drawTextFull(Font font,
double scaleFactor,
String text,
float xCenter,
float yCenter,
float theta,
Paint paint,
boolean drawTextAsShape)
Renders text onto the underlying image with medium to high detail, depending on parameters specified. |
void |
drawTextLow(Font font,
String text,
float xCenter,
float yCenter,
Color color)
This method will render text very quickly. |
static Map<Byte,Shape> |
getArrowShapes()
Get list of arrow heads. |
float[] |
getCustomNodeShape(byte customShape)
Returns the vertices of a previously defined custom node shape. |
byte[] |
getCustomNodeShapes()
DOCUMENT ME! |
boolean |
getEdgePath(byte arrow0Type,
float arrow0Size,
byte arrow1Type,
float arrow1Size,
float x0,
float y0,
EdgeAnchors anchors,
float x1,
float y1,
GeneralPath path)
Computes the path that an edge takes; this method is useful if a user interface would allow user selection of edges, for example. |
FontRenderContext |
getFontRenderContextFull()
Returns the context that is used by drawTextFull() to produce text shapes to be drawn to the screen. |
FontRenderContext |
getFontRenderContextLow()
Returns the context that is used by drawTextLow() to produce text shapes to be drawn to the screen. |
void |
getNodeShape(byte nodeShape,
float xMin,
float yMin,
float xMax,
float yMax,
GeneralPath path)
Computes the path a node shape takes; this method is useful if a user interface would allow user selection of nodes, for example. |
static Map<Byte,Shape> |
getNodeShapes()
get list of node shapes. |
AffineTransform |
getTransform()
Called to get the current AffineTransform Matrix. |
void |
importCustomNodeShapes(GraphGraphics grafx)
If this is a new instance, imports the custom node shapes from the GraphGraphics specified into this GraphGraphics. |
void |
xformImageToNodeCoords(double[] coords)
Uses the current transform to map the specified image coordinates to node coordinates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte SHAPE_RECTANGLE
public static final byte SHAPE_DIAMOND
public static final byte SHAPE_ELLIPSE
public static final byte SHAPE_HEXAGON
public static final byte SHAPE_OCTAGON
public static final byte SHAPE_PARALLELOGRAM
public static final byte SHAPE_ROUNDED_RECTANGLE
public static final byte SHAPE_TRIANGLE
public static final byte SHAPE_VEE
public static final int CUSTOM_SHAPE_MAX_VERTICES
public static final byte ARROW_NONE
public static final byte ARROW_DELTA
public static final byte ARROW_DIAMOND
public static final byte ARROW_DISC
public static final byte ARROW_TEE
public static final byte ARROW_HALF_TOP
public static final byte ARROW_HALF_BOTTOM
public static final byte ARROW_ARROWHEAD
public static final int MAX_EDGE_ANCHORS
public final Image image
Constructor Detail |
---|
public GraphGraphics(Image image, boolean debug)
The image argument passed to this constructor must support at least three methods: getGraphics(), getWidth(ImageObserver), and getHeight(ImageObserver). The image.getGraphics() method must return an instance of java.awt.Graphics2D. The hypothetical method calls image.getWidth(null) and image.getHeight(null) must return the corresponding dimension immediately.
Notice that it is not possible to resize the image area with this API. This is not a problem; instances of this class are very lightweight and are for the most part stateless; simply instantiate a new GraphGraphics when the image area changes.
image
- an off-screen image; passing an image gotten from a call to
java.awt.Component.createImage(int, int) works well, although
experience shows that for full support of non-opaque colors,
java.awt.image.BufferedImage should be used instead.debug
- if this is true, extra [and time-consuming] error checking
will take place in each method call; it is recommended to have
this value set to true during the testing phase; set it to
false once you are sure that code does not mis-use this
module.Method Detail |
---|
public final void clear(Paint bgPaint, double xCenter, double yCenter, double scaleFactor)
The background paint is not blended with colors that may already be on the underlying image; if a translucent color is used in the background paint, the underlying image itself becomes translucent.
It is mandatory to call this method before making the first rendering call.
bgPaint
- paint to use when clearing the image before painting a new
frame; translucency is honored, provided that the underlying
image supports it.xCenter
- the X component of the translation transform for the frame
about to be rendered; a node whose center is at the X
coordinate xCenter will be rendered exactly in the middle of
the image going across; increasing X values (in the node
coordinate system) result in movement towards the right on the
image.yCenter
- the Y component of the translation transform for the frame
about to be rendered; a node whose center is at the Y
coordinate yCenter will be rendered exactly in the middle of
the image going top to bottom; increasing Y values (in the
node coordinate system) result in movement towards the bottom
on the image.scaleFactor
- the scaling that is to take place when rendering; a distance
of 1 in node coordinates translates to a distance of
scaleFactor in the image coordinate system (usually one unit
in the image coordinate system equates to one pixel width).
IllegalArgumentException
- if scaleFactor is not positive.public final void xformImageToNodeCoords(double[] coords)
coords
- an array of length [at least] two which acts both as the input
and as the output of this method; coords[0] is the input X
coordinate in the image coordinate system and is written as
the X coordinate in the node coordinate system by this method;
coords[1] is the input Y coordinate in the image coordinate
system and is written as the Y coordinate in the node
coordinate system by this method; the exact transform which
takes place is defined by the previous call to the clear()
method.public final AffineTransform getTransform()
public final void drawNodeLow(float xMin, float yMin, float xMax, float yMax, Color fillColor)
xMin, yMin, xMax, and yMax specify the extents of the node in the node coordinate space, not the image coordinate space. Thus, these values will likely not change from frame to frame, as zoom and pan operations are performed.
This method will not work unless clear() has been called at least once previously.
xMin
- an extent of the node to draw, in node coordinate space.yMin
- an extent of the node to draw, in node coordinate space.xMax
- an extent of the node to draw, in node coordinate space.yMax
- an extent of the node to draw, in node coordinate space.fillColor
- the [fully opaque] color to use when drawing the node.
IllegalArgumentException
- if xMin is not less than xMax, if yMin is not less than
yMax, or if fillColor is not opaque.public final void drawNodeFull(byte nodeShape, float xMin, float yMin, float xMax, float yMax, Paint fillPaint, float borderWidth, Paint borderPaint)
There is an imposed constraint on borderWidth which, using the implemented algorithms, prevents strange-looking borders. The constraint is that borderWidth may not exceed the minimum of the node width and node height divided by six. In addition, for custom node shapes, this requirement may be more constrained, depending on the kinks in the custom node shape.
There is a constraint that only applies to SHAPE_ROUNDED_RECTANGLE which imposes that the maximum of the width and height be strictly less than twice the minimum of the width and height of the node.
This method will not work unless clear() has been called at least once previously.
nodeShape
- the shape of the node to draw (one of the SHAPE_* constants or
a custom node shape).xMin
- an extent of the node shape to draw, in node coordinate space;
the drawn shape will theoretically contain a point that lies
on this X coordinate.yMin
- an extent of the node shape to draw, in node coordinate space;
the drawn shape will theoretically contain a point that lies
on this Y coordinate.xMax
- an extent of the node shape to draw, in node coordinate space;
the drawn shape will theoretically contain a point that lies
on this X coordinate.yMax
- an extent of the node shape to draw, in node coordinate space;
the drawn shape will theoretically contain a point that lies
on this Y coordinate.fillPaint
- the paint to use when drawing the node area minus the border
(the "interior" of the node).borderWidth
- the border width, in node coordinate space; if this value is
zero, the rendering engine skips over the process of rendering
the border, which gives a significant performance boost.borderPaint
- if borderWidth is not zero, this paint is used for rendering
the node border; otherwise, this parameter is ignored (and may
be null).
IllegalArgumentException
- if xMin is not less than xMax or if yMin is not less than
yMax, if borderWidth is negative or is greater than
Math.min(xMax - xMin, yMax - yMin) / 6 (for custom node
shapes borderWidth may be even more limited, depending on
the specific shape), if nodeShape is
SHAPE_ROUNDED_RECTANGLE and the condition max(width,
height) < 2 * min(width, height) does not hold, or if
nodeShape is neither one of the SHAPE_* constants nor a
previously defined custom node shape.public final void getNodeShape(byte nodeShape, float xMin, float yMin, float xMax, float yMax, GeneralPath path)
nodeShape
- the shape (SHAPE_* constant or custom shape) of the node in
question.xMin
- an extent of the node in question, in node coordinate space.yMin
- an extent of the node in question, in node coordinate space.xMax
- an extent of the node in question, in node coordinate space.yMax
- an extent of the node in question, in node coordinate space.path
- the computed path is returned in this parameter; the computed
path's coordinate system is the node coordinate system; the
computed path is closed.public final byte defineCustomNodeShape(float[] coords, int offset, int vertexCount)
If we define the value xCenter to be the average of the minimum and maximum X values of the vertices and if we define yCenter likewise, then the specified polygon must meet the following constraints:
In addition to these constraints, when rendering custom nodes with nonzero border width, possible problems may arise if the border width is large with respect to the kinks in the polygon.
coords
- vertexCount * 2 consecutive coordinate values are read from
this array starting at coords[offset]; coords[offset],
coords[offset + 1], coords[offset + 2], coords[offset + 3] and
so on are interpreted as x0, y0, x1, y1, and so on; the
initial vertex need not be repeated as the last vertex
specified.offset
- the starting index of where to read coordinates from in the
coords parameter.vertexCount
- the number of vertices to read from coords; vertexCount * 2
entries in coords are read.
IllegalArgumentException
- if any of the constraints are not met, or if the specified
polygon has more than CUSTOM_SHAPE_MAX_VERTICES vertices.
IllegalStateException
- if too many custom node shapes are already defined; a
little over one hundered custom node shapes can be
defined.public final boolean customNodeShapeExists(byte shape)
public final byte[] getCustomNodeShapes()
public final float[] getCustomNodeShape(byte customShape)
public final void importCustomNodeShapes(GraphGraphics grafx)
grafx
- custom node shapes will be imported from this GraphGraphics.
IllegalStateException
- if at least one custom node shape is already defined in
this GraphGraphics.public static Map<Byte,Shape> getNodeShapes()
public static Map<Byte,Shape> getArrowShapes()
public final void drawEdgeLow(float x0, float y0, float x1, float y1, Color edgeColor)
The points (x0, y0) and (x1, y1) specify the endpoints of edge to be rendered in the node coordinate space, not the image coordinate space. Thus, these values will likely not change from frame to frame, as zoom and pan operations are performed. If these two points are identical, nothing is drawn.
This method will not work unless clear() has been called at least once previously.
x0
- the X coordinate of the begin point of edge to render.y0
- the Y coordinate of the begin point of edge to render.x1
- the X coordinate of the end point of edge to render.y1
- the Y coordinate of the end point of edge to render.edgeColor
- the [fully opaque] color to use when drawing the edge.
IllegalArgumentException
- if edgeColor is not opaque.public final void drawEdgeFull(byte arrow0Type, float arrow0Size, Paint arrow0Paint, byte arrow1Type, float arrow1Size, Paint arrow1Paint, float x0, float y0, EdgeAnchors anchors, float x1, float y1, float edgeThickness, Stroke edgeStroke, Paint edgePaint)
The arrow types must each be one of the ARROW_* constants. The arrow at endpoint 1 is always "on top of" the arrow at endpoint 0 if they overlap because the arrow at endpoint 0 gets rendered first.
If an arrow other than ARROW_NONE is rendered, its size must be greater than or equal to edge thickness specified. The table below describes, to some extent, the nature of each arrow type.
arrow type description ARROW_NONE the edge line segment has endpoint specified, and the line segment has a round end (center of round semicircle end exactly equal to endpoint specified); arrow size and arrow paint are ignored ARROW_DELTA the sharp tip of the arrowhead is exactly at the endpint specified; the delta is as wide as the arrow size specified and twice that in length ARROW_DIAMOND the sharp tip of the arrowhead is exactly at the endpoint specified; the diamond is as wide as the arrow size specified and twice that in length ARROW_DISC the disc arrowhead is placed such that its center is at the specified endpoint; the diameter of the disk is the arrow size specified ARROW_TEE the center of the tee intersection lies at the specified endpoint; the width of the top of the tee is one quarter of the arrow size specified, and the span of the top of the tee is two times the arrow size ARROW_HALF_TOP Draws a line the width of the stroke away from the node at the midpoint between the edge and the node on the "top" of the edge. ARROW_HALF_BOTTOM Draws a line the width of the stroke away from the node at the midpoint between the edge and the node on the "bottom" of the edge.
Note that if the edge segment length is zero then nothing gets rendered.
This method will not work unless clear() has been called at least once previously.
A discussion pertaining to edge anchors. At most MAX_EDGE_ANCHORS edge anchors may be specified. The edge anchors are used to define cubic Bezier curves. The exact algorithm for determining the Bezier curves from the input parameters is too complicated to describe in this Javadoc. Some parts of the algorithm:
In order to specify a straight-line edge path, simply duplicate each edge anchor in the EdgeAnchors instance. For example, a smooth curve would be drawn by specifying consecutive-pairwise disctinct points {(x0,y0), A0, A1, A2, (x1,y1)}; a straight-line edge path would be drawn by specifying {(x0, y0), A0, A0, A1, A1, A2, A2, (x1, y1)}.
- the conglomerated curve is [probably] not going to pass through the edge anchors points specified; the curve will pass through the midpoint between every consecutive pair of anchors
- when determining the edge path as a whole, an ordered list of points is created by putting point (x0, y0) at the beginning of the list, followed by the anchor points, followed by point (x1, y1); then, duplicate points are removed from the beginning and end of this list
- from the list described above, the first two points define the arrow direction at point (x0, y0) and the initial curve direction; likewise, the last two points in this list define the arrow direction at point (x1, y1) and the ending curve direction
arrow0Type
- the type of arrow shape to use for drawing the arrow at point
(x0, y0); this value must be one of the ARROW_* constants.arrow0Size
- the size of arrow at point (x0, y0); how size is interpreted
for different arrow types is described in the table above.arrow0Paint
- the paint to use when drawing the arrow at point (x0, y0).arrow1Type
- the type of arrow shape to use for drawing the arrow at point
(x1, y1); this value must be one of the ARROW_* constants.arrow1Size
- the size of arrow at point (x1, y1); how size is interpreted
for different arrow types is described in the table above.arrow1Paint
- the paint to use when drawing the arrow at point (x1, y1).x0
- the X coordinate of the first edge endpoint.y0
- the Y coordinate of the first edge endpoint.anchors
- anchor points between the two edge endpoints; null is an
acceptable value to indicate no edge anchors.x1
- the X coordinate of the second edge endpoint.y1
- the Y coordinate of the second edge endpoint.edgeThickness
- the thickness of the edge segment; the edge segment is the
part of the edge between the two endpoint arrows.edgeStroke
- the Stroke to use when drawing the edge segment.edgePaint
- the paint to use when drawing the edge segment.
IllegalArgumentException
- if edgeThickness is less than zero, if any one of the arrow
configurations does not meet specified criteria, or if more
than MAX_EDGE_ANCHORS anchors are specified.public final boolean getEdgePath(byte arrow0Type, float arrow0Size, byte arrow1Type, float arrow1Size, float x0, float y0, EdgeAnchors anchors, float x1, float y1, GeneralPath path)
arrow0Type
- the type of arrow shape used for drawing the arrow at point
(x0, y0); this value must be one of the ARROW_* constants.arrow0Size
- the size of arrow at point (x0, y0).arrow1Type
- the type of arrow shape used for drawing the arrow at point
(x1, y1); this value must be one of the ARROW_* constants.arrow1Size
- the size of arrow at point (x1, y1).x0
- the X coordinate of the first edge endpoint.y0
- the Y coordinate of the first edge endpoint.anchors
- anchor points between the two edge endpoints; null is an
acceptable value to indicate no edge anchors.x1
- the X coordinate of the second edge endpoint.y1
- the Y coordinate of the second edge endpoint.path
- the computed path is returned in this parameter; the computed
path's coordinate system is the node coordinate system; the
computed path is not closed.
IllegalArgumentException
- if any one of the edge arrow criteria specified in
drawEdgeFull() is not satisfied.public final boolean computeEdgeIntersection(byte nodeShape, float xMin, float yMin, float xMax, float yMax, float offset, float ptX, float ptY, float[] returnVal)
There is a constraint that only applies to SHAPE_ROUNDED_RECTANGLE which imposes that the maximum of the width and height be strictly less than twice the minimum of the width and height of the node.
nodeShape
- the shape of the node in question; this must be one of the
SHAPE_* constants or a custom node shape.xMin
- an extent of the node in question, in node coordinate space.yMin
- an extent of the node in question, in node coordinate space.xMax
- an extent of the node in question, in node coordinate space.yMax
- an extent of the node in question, in node coordinate space.offset
- most of the time this value will be zero, in which case the
point computed is the exact intersection point of line segment
and node outline; if this value is greater than zero, the
point computed is one that lies on the line segment, is
"outside" of the node outline, and is distance offset from the
node outline.ptX
- specifies the X coordinate of the endpoint of the line segment
that is not the endpoint lying in the center of the node
shape.ptY
- specifies the Y coordinate of the endpoint of the line segment
that is not the endpoint lying in the center of the node
shape.returnVal
- if true is returned, returnVal[0] is set to be the X
coordinate of the computed point and returnVal[1] is set to be
the Y coordinate of the computed point; if false is returned,
this array is not modified.
IllegalArgumentException
- if xMin is not less than xMax or if yMin is not less than
yMax, if offset is negative, if nodeShape is
SHAPE_ROUNDED_RECTANGLE and the condition max(width,
height) < 2 * min(width, height) does not hold, or if
nodeShape is neither one of the SHAPE_* constants nor a
previously defined custom node shape.public final void drawTextLow(Font font, String text, float xCenter, float yCenter, Color color)
For the sake of maximum performance, this method works differently from the other rendering methods with respect to the scaling factor specified in clear(). That is, the font used to render the specified text will not be scaled; its exact size will be used when the text is rendered onto the underlying image. On the other hand, the parameters xCenter and yCenter specify coordinates in the node coordinate system, and so the point (xCenter, yCenter) will be transformed according the clear() transform in determining the location of the text on the underlying image.
font
- the font to use in drawing text; the size of this font
specifies the actual point size of what will be rendered onto
the underlying image.text
- the text to render.xCenter
- the X coordinate of the center point of where to place the
rendered text; specified in the node coordinate system.yCenter
- the Y coordinate of the center point of where to place the
rendered text; specified in the node coordinate system.color
- the [fully opaque] color to use in rendering the text.
IllegalArgumentException
- if color is not opaque.public final FontRenderContext getFontRenderContextLow()
public final void drawTextFull(Font font, double scaleFactor, String text, float xCenter, float yCenter, float theta, Paint paint, boolean drawTextAsShape)
font
- the font to be used when rendering specified text; the
rendering of glyph shapes generated by this font (using the
context returned by getFontRenderContextFull()) is subjected
to the same transformation as are nodes and edges (the
transformation is defined by the clear() method); therefore,
it is the point size of the font in addition to the scaling
factor defined by clear() that determines the resulting size
of text rendered to the graphics context.scaleFactor
- in order to prevent very small fonts from "degenerating" it is
necessary to allow users to specify a scale factor in addition
to the font size and transform defined by the clear() method;
if this value is 1.0, no additional scaling is performed;
otherwise, the size of the font is multiplied by this value to
yield a new virtual font size.text
- the text to render.xCenter
- the text string is drawn such that its logical bounds
rectangle with specified font is centered on this X coordinate
(in the node coordinate system).yCenter
- the text string is drawn such that its logical bounds
rectangle with specified font is centered on this Y coordinate
(in the node coordinate system).theta
- in radians, specifies the angle of the text.paint
- the paint to use in rendering the text.drawTextAsShape
- this flag controls the way that text is drawn to the
underlying graphics context; by default, all text rendering
operations involve calling the operation
Graphics2D.drawString(String, float, float) after setting
specified font in the underlying graphics context; however, if
this flag is set, the text to be rendered is converted to a
primitive shape using font specified, and this shape is then
rendered using Graphics2D.fill(Shape); on some systems, the
shape filling method produces better-looking results when the
graphics context is associated with an image that is to be
rendered to the screen; however, on all systems tested, the
shape filling method results in a substantial performance hit
when the graphics context is associated with an image that is
to be rendered to the screen; it is recommended to set this
flag to true when either not much text is being rendered or
when the zoom level is very high; the Graphics2D.drawString()
operation has a difficult time when it needs to render text
under a transformation with a very large scale factor.public final FontRenderContext getFontRenderContextFull()
public final void drawCustomGraphicFull(Shape shape, float xOffset, float yOffset, Paint paint)
This method will not work unless clear() has been called at least once previously.
shape
- the shape to fill; the shape is specified in node coordinates.xOffset
- in node coordinates, a value to add to the X coordinates of
the shape's definition.yOffset
- in node coordinates, a value to add to the Y coordinates of
the shape's definition.paint
- the paint to use when filling the shape.
|
Cytoscape 2.8.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |