APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.java2d.pipe

public abstract Class RenderingEngine

extends Object
Class Inheritance
Known Direct Subclasses
sun.java2d.pipe.RenderingEngine.Tracer, sun.java2d.marlin.DMarlinRenderingEngine
Imports
java.awt.Shape, .BasicStroke, java.awt.geom.PathIterator, .AffineTransform, sun.awt.geom.PathConsumer2D

This class abstracts a number of features for which the Java 2D implementation relies on proprietary licensed software libraries. Access to those features is now achieved by retrieving the singleton instance of this class and calling the appropriate methods on it. The 3 primary features abstracted here include:
Shape createStrokedShape(Shape, [BasicStroke attributes]);
This method implements the functionality of the method of the same name on the BasicStroke class.
void strokeTo(Shape, [rendering parameters], PathConsumer2D);
This method performs widening of the source path on the fly and sends the results to the given PathConsumer2D object. This procedure avoids having to create an intermediate Shape object to hold the results of the createStrokedShape method. The main user of this method is the Java 2D non-antialiasing renderer.
AATileGenerator getAATileGenerator(Shape, [rendering parameters]);
This method returns an object which can iterate over the specified bounding box and produce tiles of coverage values for antialiased rendering. The details of the operation of the AATileGenerator object are explained in its class comments.
Additionally, the following informational method supplies important data about the implementation.
float getMinimumAAPenSize()
This method provides information on how small the BasicStroke line width can get before dropouts occur. Rendering with a BasicStroke is defined to never allow the line to have breaks, gaps, or dropouts even if the width is set to 0.0f, so this information allows the sun.java2d.SunGraphics2D class to detect the "thin line" case and set the rendering attributes accordingly.
At startup the runtime will load a single instance of this class. It searches the classpath for a registered provider of this API and returns either the last one it finds, or the instance whose class name matches the value supplied in the System property sun.java2d.renderer. Additionally, a runtime System property flag can be set to trace all calls to methods on the RenderingEngine in use by setting the sun.java2d.renderer.trace property to any non-null value.

Parts of the system that need to use any of the above features should call RenderingEngine.getInstance() to obtain the properly registered (and possibly trace-enabled) version of the RenderingEngine.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static RenderingEngine

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract Shape

Returns:

the widened path stored in a new Shape object
createStrokedShape
(Shape
the source path to be widened
src
,
float
the width of the widened path as per BasicStroke
width
,
int
the end cap decorations as per BasicStroke
caps
,
int
the segment join decorations as per BasicStroke
join
,
float
the miter limit as per BasicStroke
miterlimit
,
float[]
the dash length array as per BasicStroke
dashes
,
float
the initial dash phase as per BasicStroke
dashphase
)

Create a widened path as specified by the parameters.

public static void
feedConsumer(PathIterator pi, PathConsumer2D consumer)

Utility method to feed a PathConsumer2D object from a given PathIterator.

public abstract AATileGenerator

Returns:

the AATileGenerator instance to be consulted for tile coverages, or null if there is no output to render
getAATileGenerator
(Shape
the shape to be rendered (fill or draw)
s
,
AffineTransform
the transform to be applied to the shape and the stroke attributes
at
,
Region
the current clip in effect in device coordinates
clip
,
BasicStroke
if non-null, a BasicStroke whose attributes should be applied to this operation
bs
,
boolean
true if the transformed stroke attributes are smaller than the minimum dropout pen width
thin
,
boolean
true if the VALUE_STROKE_NORMALIZE RenderingHint is in effect
normalize
,
int[]
returns the bounds of the iteration
bbox
)

Construct an antialiased tile generator for the given shape with the given rendering attributes and store the bounds of the tile iteration in the bbox parameter.

public abstract AATileGenerator

Returns:

the AATileGenerator instance to be consulted for tile coverages, or null if there is no output to render
getAATileGenerator
(double
the X coordinate of the first corner of the parallelogram
x
,
double
the Y coordinate of the first corner of the parallelogram
y
,
double
the X coordinate delta of the first leg of the parallelogram
dx1
,
double
the Y coordinate delta of the first leg of the parallelogram
dy1
,
double
the X coordinate delta of the second leg of the parallelogram
dx2
,
double
the Y coordinate delta of the second leg of the parallelogram
dy2
,
double
the line width ratio for the first leg of the parallelogram
lw1
,
double
the line width ratio for the second leg of the parallelogram
lw2
,
Region
the current clip in effect in device coordinates
clip
,
int[]
returns the bounds of the iteration
bbox
)

Construct an antialiased tile generator for the given parallelogram store the bounds of the tile iteration in the bbox parameter.

public static synchronized RenderingEngine

Returns:

an instance of RenderingEngine
getInstance
()

Returns an instance of RenderingEngine as determined by the installation environment and runtime flags.

public abstract float
getMinimumAAPenSize()

Returns the minimum pen width that the antialiasing rasterizer can represent without dropouts occurring.

public abstract void
strokeTo(Shape
the source path to be widened
src
,
AffineTransform
the transform to be applied to the shape and the stroke attributes
at
,
BasicStroke
the BasicStroke object specifying the decorations to be applied to the widened path
bs
,
boolean
true if the transformed stroke attributes are smaller than the minimum dropout pen width
thin
,
boolean
indicates whether stroke normalization should be applied
normalize
,
boolean
indicates whether or not adjustments appropriate to antialiased rendering should be applied
antialias
,
PathConsumer2D
the PathConsumer2D instance to forward the widened geometry to
consumer
)

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

public void
strokeTo(Shape
the source path to be widened
src
,
AffineTransform
the transform to be applied to the shape and the stroke attributes
at
,
Region
the current clip in effect in device coordinates
clip
,
BasicStroke
the BasicStroke object specifying the decorations to be applied to the widened path
bs
,
boolean
true if the transformed stroke attributes are smaller than the minimum dropout pen width
thin
,
boolean
indicates whether stroke normalization should be applied
normalize
,
boolean
indicates whether or not adjustments appropriate to antialiased rendering should be applied
antialias
,
final PathConsumer2D
the PathConsumer2D instance to forward the widened geometry to
consumer
)

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

reImplback to summary
private static RenderingEngine reImpl

Constructor Detail

RenderingEngineback to summary
public RenderingEngine()

Method Detail

createStrokedShapeback to summary
public abstract Shape createStrokedShape(Shape src, float width, int caps, int join, float miterlimit, float[] dashes, float dashphase)

Create a widened path as specified by the parameters.

The specified src Shape is widened according to the specified attribute parameters as per the BasicStroke specification.

Parameters
src:Shape

the source path to be widened

width:float

the width of the widened path as per BasicStroke

caps:int

the end cap decorations as per BasicStroke

join:int

the segment join decorations as per BasicStroke

miterlimit:float

the miter limit as per BasicStroke

dashes:float[]

the dash length array as per BasicStroke

dashphase:float

the initial dash phase as per BasicStroke

Returns:Shape

the widened path stored in a new Shape object

Since
1.7
feedConsumerback to summary
public static void feedConsumer(PathIterator pi, PathConsumer2D consumer)

Utility method to feed a PathConsumer2D object from a given PathIterator. This method deals with the details of running the iterator and feeding the consumer a segment at a time.

getAATileGeneratorback to summary
public abstract AATileGenerator getAATileGenerator(Shape s, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, int[] bbox)

Construct an antialiased tile generator for the given shape with the given rendering attributes and store the bounds of the tile iteration in the bbox parameter. The at parameter specifies a transform that should affect both the shape and the BasicStroke attributes. The clip parameter specifies the current clip in effect in device coordinates and can be used to prune the data for the operation, but the renderer is not required to perform any clipping. If the BasicStroke parameter is null then the shape should be filled as is, otherwise the attributes of the BasicStroke should be used to specify a draw operation. The thin parameter indicates whether or not the transformed BasicStroke represents coordinates smaller than the minimum resolution of the antialiasing rasterizer as specified by the getMinimumAAPenWidth() method.

Upon returning, this method will fill the bbox parameter with 4 values indicating the bounds of the iteration of the tile generator. The iteration order of the tiles will be as specified by the pseudo-code:

    for (y = bbox[1]; y < bbox[3]; y += tileheight) {
        for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
        }
    }
If there is no output to be rendered, this method may return null.
Parameters
s:Shape

the shape to be rendered (fill or draw)

at:AffineTransform

the transform to be applied to the shape and the stroke attributes

clip:Region

the current clip in effect in device coordinates

bs:BasicStroke

if non-null, a BasicStroke whose attributes should be applied to this operation

thin:boolean

true if the transformed stroke attributes are smaller than the minimum dropout pen width

normalize:boolean

true if the VALUE_STROKE_NORMALIZE RenderingHint is in effect

bbox:int[]

returns the bounds of the iteration

Returns:AATileGenerator

the AATileGenerator instance to be consulted for tile coverages, or null if there is no output to render

Since
1.7
getAATileGeneratorback to summary
public abstract AATileGenerator getAATileGenerator(double x, double y, double dx1, double dy1, double dx2, double dy2, double lw1, double lw2, Region clip, int[] bbox)

Construct an antialiased tile generator for the given parallelogram store the bounds of the tile iteration in the bbox parameter. The parallelogram is specified as a starting point and 2 delta vectors that indicate the slopes of the 2 pairs of sides of the parallelogram. The 4 corners of the parallelogram are defined by the 4 points:

  • x, y
  • x+dx1, y+dy1
  • x+dx1+dx2, y+dy1+dy2
  • x+dx2, y+dy2
The lw1 and lw2 parameters provide a specification for an optionally stroked parallelogram if they are positive numbers. The lw1 parameter is the ratio of the length of the dx1, dx2 delta vector to half of the line width in that same direction. The lw2 parameter provides the same ratio for the other delta vector. If lw1 and lw2 are both greater than zero, then the parallelogram figure is doubled by both expanding and contracting each delta vector by its corresponding lw value. If either lw1 or lw2 are also greater than 1, then the inner (contracted) parallelogram disappears and the figure is simply a single expanded parallelogram. The clip parameter specifies the current clip in effect in device coordinates and can be used to prune the data for the operation, but the renderer is not required to perform any clipping.

Upon returning, this method will fill the bbox parameter with 4 values indicating the bounds of the iteration of the tile generator. The iteration order of the tiles will be as specified by the pseudo-code:

    for (y = bbox[1]; y < bbox[3]; y += tileheight) {
        for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
        }
    }
If there is no output to be rendered, this method may return null.
Parameters
x:double

the X coordinate of the first corner of the parallelogram

y:double

the Y coordinate of the first corner of the parallelogram

dx1:double

the X coordinate delta of the first leg of the parallelogram

dy1:double

the Y coordinate delta of the first leg of the parallelogram

dx2:double

the X coordinate delta of the second leg of the parallelogram

dy2:double

the Y coordinate delta of the second leg of the parallelogram

lw1:double

the line width ratio for the first leg of the parallelogram

lw2:double

the line width ratio for the second leg of the parallelogram

clip:Region

the current clip in effect in device coordinates

bbox:int[]

returns the bounds of the iteration

Returns:AATileGenerator

the AATileGenerator instance to be consulted for tile coverages, or null if there is no output to render

Since
1.7
getInstanceback to summary
public static synchronized RenderingEngine getInstance()

Returns an instance of RenderingEngine as determined by the installation environment and runtime flags.

A specific instance of the RenderingEngine can be chosen by specifying the runtime flag:

    java -Dsun.java2d.renderer=<classname>
If no specific RenderingEngine is specified on the command line or the requested class fails to load, then the Marlin renderer will be used as the default.

A printout of which RenderingEngine is loaded and used can be enabled by specifying the runtime flag:

    java -Dsun.java2d.renderer.verbose=true

Runtime tracing of the actions of the RenderingEngine can be enabled by specifying the runtime flag:

    java -Dsun.java2d.renderer.trace=<any string>
Returns:RenderingEngine

an instance of RenderingEngine

Since
1.7
getMinimumAAPenSizeback to summary
public abstract float getMinimumAAPenSize()

Returns the minimum pen width that the antialiasing rasterizer can represent without dropouts occurring.

Since
1.7
strokeToback to summary
public abstract void strokeTo(Shape src, AffineTransform at, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, PathConsumer2D consumer)

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

The specified src Shape is widened according to the parameters specified by the BasicStroke object. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_STROKE_NORMALIZE hint if the normalize boolean parameter is true. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_ANTIALIAS_ON hint if the antialias boolean parameter is true.

The geometry of the widened path is forwarded to the indicated PathConsumer2D object as it is calculated.

Parameters
src:Shape

the source path to be widened

at:AffineTransform

the transform to be applied to the shape and the stroke attributes

bs:BasicStroke

the BasicStroke object specifying the decorations to be applied to the widened path

thin:boolean

true if the transformed stroke attributes are smaller than the minimum dropout pen width

normalize:boolean

indicates whether stroke normalization should be applied

antialias:boolean

indicates whether or not adjustments appropriate to antialiased rendering should be applied

consumer:PathConsumer2D

the PathConsumer2D instance to forward the widened geometry to

Since
1.7
strokeToback to summary
public void strokeTo(Shape src, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, final PathConsumer2D consumer)

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

The specified src Shape is widened according to the parameters specified by the BasicStroke object. The clip region can be optionally given to let the renderer only send geometries overlapping the clip region. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_STROKE_NORMALIZE hint if the normalize boolean parameter is true. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_ANTIALIAS_ON hint if the antialias boolean parameter is true.

The geometry of the widened path is forwarded to the indicated PathConsumer2D object as it is calculated.

Parameters
src:Shape

the source path to be widened

at:AffineTransform

the transform to be applied to the shape and the stroke attributes

clip:Region

the current clip in effect in device coordinates

bs:BasicStroke

the BasicStroke object specifying the decorations to be applied to the widened path

thin:boolean

true if the transformed stroke attributes are smaller than the minimum dropout pen width

normalize:boolean

indicates whether stroke normalization should be applied

antialias:boolean

indicates whether or not adjustments appropriate to antialiased rendering should be applied

consumer:PathConsumer2D

the PathConsumer2D instance to forward the widened geometry to

Since
17
sun.java2d.pipe back to summary

pack-priv Class RenderingEngine.Tracer

extends RenderingEngine
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv RenderingEngine

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Shape
createStrokedShape(Shape src, float width, int caps, int join, float miterlimit, float[] dashes, float dashphase)

Implements abstract sun.java2d.pipe.RenderingEngine.createStrokedShape.

Create a widened path as specified by the parameters.

public AATileGenerator
getAATileGenerator(Shape s, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, int[] bbox)

Implements abstract sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Construct an antialiased tile generator for the given shape with the given rendering attributes and store the bounds of the tile iteration in the bbox parameter.

public AATileGenerator
getAATileGenerator(double x, double y, double dx1, double dy1, double dx2, double dy2, double lw1, double lw2, Region clip, int[] bbox)

Implements abstract sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Construct an antialiased tile generator for the given parallelogram store the bounds of the tile iteration in the bbox parameter.

public float
getMinimumAAPenSize()

Implements abstract sun.java2d.pipe.RenderingEngine.getMinimumAAPenSize.

Returns the minimum pen width that the antialiasing rasterizer can represent without dropouts occurring.

public void
strokeTo(Shape src, AffineTransform at, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, PathConsumer2D consumer)

Implements abstract sun.java2d.pipe.RenderingEngine.strokeTo.

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

public void
strokeTo(Shape src, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, PathConsumer2D consumer)

Overrides sun.java2d.pipe.RenderingEngine.strokeTo.

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

Inherited from sun.java2d.pipe.RenderingEngine:
feedConsumergetInstance

Field Detail

nameback to summary
pack-priv String name
targetback to summary
pack-priv RenderingEngine target

Constructor Detail

Tracerback to summary
public Tracer(RenderingEngine target)

Method Detail

createStrokedShapeback to summary
public Shape createStrokedShape(Shape src, float width, int caps, int join, float miterlimit, float[] dashes, float dashphase)

Implements abstract sun.java2d.pipe.RenderingEngine.createStrokedShape.

Doc from sun.java2d.pipe.RenderingEngine.createStrokedShape.

Create a widened path as specified by the parameters.

The specified src Shape is widened according to the specified attribute parameters as per the BasicStroke specification.

getAATileGeneratorback to summary
public AATileGenerator getAATileGenerator(Shape s, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, int[] bbox)

Implements abstract sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Doc from sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Construct an antialiased tile generator for the given shape with the given rendering attributes and store the bounds of the tile iteration in the bbox parameter. The at parameter specifies a transform that should affect both the shape and the BasicStroke attributes. The clip parameter specifies the current clip in effect in device coordinates and can be used to prune the data for the operation, but the renderer is not required to perform any clipping. If the BasicStroke parameter is null then the shape should be filled as is, otherwise the attributes of the BasicStroke should be used to specify a draw operation. The thin parameter indicates whether or not the transformed BasicStroke represents coordinates smaller than the minimum resolution of the antialiasing rasterizer as specified by the getMinimumAAPenWidth() method.

Upon returning, this method will fill the bbox parameter with 4 values indicating the bounds of the iteration of the tile generator. The iteration order of the tiles will be as specified by the pseudo-code:

    for (y = bbox[1]; y < bbox[3]; y += tileheight) {
        for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
        }
    }
If there is no output to be rendered, this method may return null.
getAATileGeneratorback to summary
public AATileGenerator getAATileGenerator(double x, double y, double dx1, double dy1, double dx2, double dy2, double lw1, double lw2, Region clip, int[] bbox)

Implements abstract sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Doc from sun.java2d.pipe.RenderingEngine.getAATileGenerator.

Construct an antialiased tile generator for the given parallelogram store the bounds of the tile iteration in the bbox parameter. The parallelogram is specified as a starting point and 2 delta vectors that indicate the slopes of the 2 pairs of sides of the parallelogram. The 4 corners of the parallelogram are defined by the 4 points:

  • x, y
  • x+dx1, y+dy1
  • x+dx1+dx2, y+dy1+dy2
  • x+dx2, y+dy2
The lw1 and lw2 parameters provide a specification for an optionally stroked parallelogram if they are positive numbers. The lw1 parameter is the ratio of the length of the dx1, dx2 delta vector to half of the line width in that same direction. The lw2 parameter provides the same ratio for the other delta vector. If lw1 and lw2 are both greater than zero, then the parallelogram figure is doubled by both expanding and contracting each delta vector by its corresponding lw value. If either lw1 or lw2 are also greater than 1, then the inner (contracted) parallelogram disappears and the figure is simply a single expanded parallelogram. The clip parameter specifies the current clip in effect in device coordinates and can be used to prune the data for the operation, but the renderer is not required to perform any clipping.

Upon returning, this method will fill the bbox parameter with 4 values indicating the bounds of the iteration of the tile generator. The iteration order of the tiles will be as specified by the pseudo-code:

    for (y = bbox[1]; y < bbox[3]; y += tileheight) {
        for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
        }
    }
If there is no output to be rendered, this method may return null.
getMinimumAAPenSizeback to summary
public float getMinimumAAPenSize()

Implements abstract sun.java2d.pipe.RenderingEngine.getMinimumAAPenSize.

Doc from sun.java2d.pipe.RenderingEngine.getMinimumAAPenSize.

Returns the minimum pen width that the antialiasing rasterizer can represent without dropouts occurring.

strokeToback to summary
public void strokeTo(Shape src, AffineTransform at, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, PathConsumer2D consumer)

Implements abstract sun.java2d.pipe.RenderingEngine.strokeTo.

Doc from sun.java2d.pipe.RenderingEngine.strokeTo.

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

The specified src Shape is widened according to the parameters specified by the BasicStroke object. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_STROKE_NORMALIZE hint if the normalize boolean parameter is true. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_ANTIALIAS_ON hint if the antialias boolean parameter is true.

The geometry of the widened path is forwarded to the indicated PathConsumer2D object as it is calculated.

strokeToback to summary
public void strokeTo(Shape src, AffineTransform at, Region clip, BasicStroke bs, boolean thin, boolean normalize, boolean antialias, PathConsumer2D consumer)

Overrides sun.java2d.pipe.RenderingEngine.strokeTo.

Doc from sun.java2d.pipe.RenderingEngine.strokeTo.

Sends the geometry for a widened path as specified by the parameters to the specified consumer.

The specified src Shape is widened according to the parameters specified by the BasicStroke object. The clip region can be optionally given to let the renderer only send geometries overlapping the clip region. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_STROKE_NORMALIZE hint if the normalize boolean parameter is true. Adjustments are made to the path as appropriate for the java.awt.RenderingHints#VALUE_ANTIALIAS_ON hint if the antialias boolean parameter is true.

The geometry of the widened path is forwarded to the indicated PathConsumer2D object as it is calculated.