|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object yext.svg.view.SVGBackgroundRenderer
public class SVGBackgroundRenderer
A background renderer that displays scalable vector graphics.
This renderer assumes that a GraphicsContext
can be retrieved from
the Graphics2D
instance it paints upon. The Graph2DView
instance associated to said context has be the view whose background has to
be painted.
YRenderingHints.getGraphicsContext(java.awt.Graphics2D)
Field Summary | |
---|---|
static byte |
BRICKED
Mode constant. |
static byte |
CENTERED
Mode constant. |
static byte |
DYNAMIC
Mode constant. |
static byte |
FULLSCREEN
Mode constant. |
static byte |
PLAIN
Mode constant. |
static byte |
SCALED
Mode constant. |
static byte |
TILED
Mode constant. |
Constructor Summary | |
---|---|
SVGBackgroundRenderer()
Initializes a new SVGBackgroundRenderer instance that
displays a solid, white background. |
|
SVGBackgroundRenderer(SVGModel model)
Initializes a new SVGBackgroundRenderer instance that
displays the specified SVG graphics. |
|
SVGBackgroundRenderer(URL svgURL)
Initializes a new SVGBackgroundRenderer instance that
displays the SVG document referenced by the specified URL. |
Method Summary | |
---|---|
Color |
getColor()
Returns the color used to paint the background. |
YPoint |
getImageOrigin()
Returns the image origin (upper left corner) of the displayed background graphic. |
byte |
getMode()
Returns the mode in which the background should be painted. |
SVGModel |
getModel()
Returns the underlying SVG model for this renderer. |
URL |
getSVGURL()
Returns the URL of the SVG document that is displayed by this renderer. |
void |
paint(Graphics2D gfx,
int x,
int y,
int w,
int h)
Paints the scalable vector graphics associated to this renderer upon the specified graphics instance. |
void |
setColor(Color color)
Sets the color used to paint the background. |
void |
setImageOrigin(YPoint origin)
Sets the origin (upper left corner) of the displayed background graphic. |
void |
setMode(byte mode)
Sets the mode in which the background should be painted. |
void |
setModel(SVGModel model)
Sets the underlying SVG model for this renderer. |
void |
setSVGURL(URL svgURL)
Sets the URL of the SVG document to be displayed by this renderer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte FULLSCREEN
getMode()
,
Constant Field Valuespublic static final byte TILED
getMode()
,
Constant Field Valuespublic static final byte BRICKED
getMode()
,
Constant Field Valuespublic static final byte CENTERED
getMode()
,
getColor()
,
Constant Field Valuespublic static final byte PLAIN
getMode()
,
getImageOrigin()
,
getColor()
,
Constant Field Valuespublic static final byte DYNAMIC
getMode()
,
getColor()
,
Constant Field Valuespublic static final byte SCALED
getMode()
,
getColor()
,
Constant Field ValuesConstructor Detail |
---|
public SVGBackgroundRenderer()
SVGBackgroundRenderer
instance that
displays a solid, white background.
public SVGBackgroundRenderer(URL svgURL)
SVGBackgroundRenderer
instance that
displays the SVG document referenced by the specified URL.
svgURL
- the URL of the SVG document to display.getSVGURL()
,
setSVGURL(java.net.URL)
public SVGBackgroundRenderer(SVGModel model)
SVGBackgroundRenderer
instance that
displays the specified SVG graphics.
model
- the SVG graphics to display. May not be null
!
IllegalArgumentException
- if the specified model is null
.setModel(SVGModel)
Method Detail |
---|
public void setMode(byte mode)
By default the mode is PLAIN
.
public byte getMode()
By default the mode is PLAIN
.
public void setColor(Color color)
By default the background color is white.
color
- the color used to paint the background.getColor()
public Color getColor()
By default the background color is white.
setColor(java.awt.Color)
public void setImageOrigin(YPoint origin)
DYNAMIC
, the specified coordinates are interpreted
as as world (graph) coordinates.
For modes PLAIN
and TILED
, the specified coordinates are
interpreted as view (component) coordinates.
For all other modes image origin is ignored.
The default is (0,0)
.
origin
- the upper left corner of the displayed background graphic.
May not be null
!
IllegalArgumentException
- if the specified point is null
.getImageOrigin()
,
getMode()
,
setMode(byte)
public YPoint getImageOrigin()
DYNAMIC
, the specified coordinates are interpreted
as as world (graph) coordinates.
For modes PLAIN
and TILED
, the specified coordinates are
interpreted as view (component) coordinates.
For all other modes image origin is ignored.
The default is (0,0)
.
setImageOrigin(YPoint)
,
getMode()
,
setMode(byte)
public URL getSVGURL()
null
if background graphic has not been initialized from an URL.setSVGURL(java.net.URL)
,
getModel()
public void setSVGURL(URL svgURL)
svgURL
- the URL of the SVG document to display.getSVGURL()
public SVGModel getModel()
setModel(yext.svg.view.SVGModel)
public void setModel(SVGModel model)
model
- the SVG graphics to display. May not be null
!
IllegalArgumentException
- if the specified model is null
.getModel()
public void paint(Graphics2D gfx, int x, int y, int w, int h)
This method assume that a GraphicsContext
can be retrieved from the
graphics instance it paints upon. The Graph2DView
instance
associated to said context has be the view whose background is painted.
paint
in interface BackgroundRenderer
gfx
- the graphics instance to paint upon.getMode()
,
YRenderingHints.getGraphicsContext(java.awt.Graphics2D)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |