public class TLcdSVGIcon extends Object implements ILcdIcon, ILcdResizeableIcon
Constructor and Description |
---|
TLcdSVGIcon(Document aDocument)
Constructs a new
TLcdSVGIcon object to display the given SVG document. |
TLcdSVGIcon(String aSource)
Constructs a new
TLcdSVGIcon object to display the given SVG file. |
TLcdSVGIcon(String aSource,
int aWidth,
int aHeight)
Constructs a new
TLcdSVGIcon object to display an SVG
(Scalable Vector Graphics) icon. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
boolean |
equals(Object aO) |
Color |
getColor()
Returns the color that will be used to paint the SVG icon.
|
int |
getIconHeight()
Returns the fixed height of the icon.
|
int |
getIconWidth()
Returns the fixed width of the icon.
|
Document |
getSVGDocument()
Returns the XML content of this icon.
|
double |
getWorldHeight()
Get the world-height of the icon,
|
double |
getWorldScalingFactor()
Get the ratio of the icon's world-width to the icon's width in pixels.
|
double |
getWorldWidth()
Get the world-width of the icon,
|
int |
hashCode() |
boolean |
isWorldSized()
Determines whether this icon is assumed to be world-sized.
|
void |
paintIcon(Component aComponent,
Graphics aGraphics,
int aX,
int aY)
Draw the
ILcdIcon at the specified location. |
void |
setColor(Color aColor)
Specifies a color to be used to paint the SVG icon.
|
void |
setIconHeight(int aHeight)
Specifies the height of the SVG icon to be displayed.
|
void |
setIconWidth(int aWidth)
Specifies the width of the SVG icon to be displayed.
|
void |
setSize(int aWidth,
int aHeight)
Specifies the width and height of the SVG icon to be displayed.
|
String |
toString() |
public TLcdSVGIcon(String aSource)
TLcdSVGIcon
object to display the given SVG file.
The size of the icon will be the bounds of the SVG content in SVG user space (typically pixels).
This includes primitive paint, filtering, clipping and masking.aSource
- the source of the icon to be displayedpublic TLcdSVGIcon(Document aDocument)
TLcdSVGIcon
object to display the given SVG document.
The size of the icon will be the bounds of the SVG content in SVG user space (typically pixels).
This includes primitive paint, filtering, clipping and masking.aDocument
- the XML document containing the SVG contentpublic TLcdSVGIcon(String aSource, int aWidth, int aHeight)
TLcdSVGIcon
object to display an SVG
(Scalable Vector Graphics) icon. The displayed icon is retrieved from the
given source and its size will be as specified in aWidth and aHeight.aSource
- the source of the icon to be displayedaWidth
- the width of the icon to be displayedaHeight
- the height of the icon to be displayedpublic Document getSVGDocument()
public void paintIcon(Component aComponent, Graphics aGraphics, int aX, int aY)
ILcdIcon
ILcdIcon
at the specified location. ILcdIcon
implementations
may use the Component
argument to get properties useful for
painting, e.g. the foreground or background color.paintIcon
in interface ILcdIcon
aComponent
- a Component to retrieve properties from.aGraphics
- the Graphics on which the icon will be painted.aX
- the x position where the icon will be painted. x is the first coordinate of the top left
corner point of the icon.aY
- the y position where the icon will be painted. y is the second coordinate of the top left
corner point of the icon.public int getIconWidth()
ILcdIcon
getIconWidth
in interface ILcdIcon
public int getIconHeight()
ILcdIcon
getIconHeight
in interface ILcdIcon
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public void setIconWidth(int aWidth)
setIconWidth
in interface ILcdResizeableIcon
aWidth
- the width of the icon to be displayedgetIconWidth()
public void setIconHeight(int aHeight)
setIconHeight
in interface ILcdResizeableIcon
aHeight
- the height of the icon to be displayedgetIconHeight()
public void setSize(int aWidth, int aHeight)
setIconWidth(int)
and
setIconHeight(int)
one after another.aWidth
- the width of the icon to be displayedaHeight
- the height of the icon to be displayedpublic Color getColor()
null
.setColor(java.awt.Color)
public void setColor(Color aColor)
aColor
- the color used to paint the icon to be displayed, or
null
to use the colors as specified by the SVG file itselfgetColor()
public boolean isWorldSized()
public double getWorldWidth()
public double getWorldHeight()
public double getWorldScalingFactor()
TLcdGXYIconPainter.setScale(double)
. When this is set correctly,
the painter can correctly determine how it needs to scale the icon to correctly render it in world-size.