Methods Summary |
---|
com.sun.perseus.j2d.Box | addNodeBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t)
return addTransformedBBox(bbox, x, y, width, height, t);
|
protected void | computeRenderingTile(com.sun.perseus.j2d.Tile tile, com.sun.perseus.j2d.Transform t, com.sun.perseus.j2d.GraphicsProperties gp)Computes the rendering tile for the given set of GraphicsProperties.
tile.snapBox(addNodeBBox(null, t));
|
TraitAnim | createTraitAnimImpl(java.lang.String traitName)
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return new FloatTraitAnim(this, traitName, TRAIT_TYPE_FLOAT);
} else if (SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE
== traitName) {
return new StringTraitAnim(this, NULL_NS, traitName);
} else {
return super.createTraitAnimImpl(traitName);
}
|
TraitAnim | createTraitAnimNSImpl(java.lang.String traitNamespace, java.lang.String traitName)
if (traitNamespace == SVGConstants.XLINK_NAMESPACE_URI
&&
traitName == SVGConstants.SVG_HREF_ATTRIBUTE) {
return new StringTraitAnim(this, traitNamespace, traitName);
}
return super.createTraitAnimNSImpl(traitNamespace, traitName);
|
public int | getAlign()
return align;
|
float | getFloatTraitImpl(java.lang.String name)ImageNode handles x, y, width and height traits.
Other attributes are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return getX();
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return getY();
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return getWidth();
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return getHeight();
} else {
return super.getFloatTraitImpl(name);
}
|
public float | getHeight()
return height;
|
public java.lang.String | getHref()
return href;
|
public com.sun.perseus.j2d.RasterImage | getImage()
return image;
|
public java.lang.String | getLocalName()
return SVGConstants.SVG_IMAGE_TAG;
|
public java.lang.String[] | getRequiredTraits()
return REQUIRED_TRAITS;
|
public java.lang.String[][] | getRequiredTraitsNS()
return REQUIRED_TRAITS_NS;
|
public com.sun.perseus.util.RunnableQueue.RunnableHandler | getRunnableHandler()
return ownerDocument.getRunnableHandler();
|
public java.lang.String | getTraitImpl(java.lang.String name)ImageNode handles x, y, width and height traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
return Float.toString(getX());
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
return Float.toString(getY());
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
return Float.toString(getWidth());
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(getHeight());
} else if (SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE == name) {
return alignToStringTrait(align);
} else {
return super.getTraitImpl(name);
}
|
java.lang.String | getTraitNSImpl(java.lang.String namespaceURI, java.lang.String name)ImageNode handles the xlink href attribute
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == name) {
if (href == null) {
return "";
}
return href;
} else {
return super.getTraitNSImpl(namespaceURI, name);
}
|
public com.sun.perseus.util.RunnableQueue | getUpdateQueue()
return ownerDocument.getUpdateQueue();
|
public float | getWidth()
return width;
|
public float | getX()
return x;
|
public float | getY()
return y;
|
public boolean | hasNodeRendering()An ImageNode has something to render
return true;
|
protected boolean | isHitVP(float[] pt)Returns true if this node is hit by the input point. The input point
is in viewport space.
if (!getVisibility()) {
return false;
}
getInverseTransformState().transformPoint(pt, ownerDocument.upt);
pt = ownerDocument.upt;
return (pt[0] > x && pt[0] < (x + width)
&& pt[1] > y && pt[1] < (y + height));
|
protected boolean | isProxyHitVP(float[] pt, AbstractRenderingNodeProxy proxy)Returns true if the proxy node is hit by the input point. The input point
is in viewport space.
proxy.getInverseTransformState().transformPoint(pt, ownerDocument.upt);
pt = ownerDocument.upt;
return (pt[0] > x && pt[0] < (x + width)
&& pt[1] > y && pt[1] < (y + height));
|
public void | loadImage()Implementation. Loads the image through the ownerDocument's
ImageLoader. If this image's paintNeedsLoad is true, this
will block until the image data has been retrieved. Otherwise,
a request to asynchronously load the image is placed.
// Note that if absoluteURI is null, it is because either href is null
// or this node is not hooked into the tree. In these cases, we stick
// to the loadingImage
if (absoluteURI != null) {
if (paintNeedsLoad) {
image = ownerDocument.getImageLoader()
.getImageAndWait(absoluteURI);
if (image == ownerDocument.getImageLoader().getBrokenImage()) {
throw new IllegalStateException();
}
} else {
ownerDocument.getImageLoader().getImageLater(absoluteURI, this);
}
}
imageLoaded = true;
|
public ElementNode | newInstance(DocumentNode doc)Used by DocumentNode to create a new instance from
a prototype ImageNode .
return new ImageNode(doc);
|
void | paintRendered(com.sun.perseus.j2d.RenderGraphics rg, com.sun.perseus.j2d.GraphicsProperties gp, com.sun.perseus.j2d.PaintTarget pt, com.sun.perseus.j2d.Transform tx)Paints this node into the input RenderGraphics.
if (!gp.getVisibility()) {
return;
}
rg.setTransform(tx);
rg.setOpacity(getOpacity());
if (!imageLoaded) {
loadImage();
}
//
// Scale the image so that it fits into width/height
// and is centered
//
int iw = image.getWidth();
int ih = image.getHeight();
if (align == StructureNode.ALIGN_NONE) {
rg.drawImage(image, x, y, width, height);
} else {
float ws = width / iw;
float hs = height / ih;
float is = ws;
if (hs < ws) {
is = hs;
}
float oh = ih * is;
float ow = iw * is;
float dx = (width - ow) / 2;
float dy = (height - oh) / 2;
rg.drawImage(image, (x + dx), (y + dy), ow, oh);
}
|
public void | setAlign(int newAlign)
if (newAlign == align) {
return;
}
modifyingNode();
this.align = newAlign;
modifiedNode();
|
void | setFloatArrayTrait(java.lang.String name, float[][] value)Set the trait value as float.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value[0][0]);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value[0][0]);
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setWidth(value[0][0]);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
checkPositive(name, value[0][0]);
setHeight(value[0][0]);
} else {
super.setFloatArrayTrait(name, value);
}
|
public void | setFloatTraitImpl(java.lang.String name, float value)ImageNode handles x, y, rx, ry, width and height traits.
Other traits are handled by the super class.
try {
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(value);
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(value);
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
setWidth(value);
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
setHeight(value);
} else {
super.setFloatTraitImpl(name, value);
}
} catch (IllegalArgumentException iae) {
throw illegalTraitValue(name, Float.toString(value));
}
|
public void | setHeight(float newHeight)
if (newHeight < 0) {
throw new IllegalArgumentException();
}
if (newHeight == height) {
return;
}
modifyingNode();
renderingDirty();
this.height = newHeight;
computeCanRenderHeightBit(height);
modifiedNode();
|
public void | setHref(java.lang.String newHref)
if (newHref == null) {
throw new IllegalArgumentException();
}
if (equal(newHref, href)) {
return;
}
modifyingNode();
renderingDirty();
this.href = newHref;
this.image = ownerDocument.getImageLoader().getLoadingImage();
ownerDocument.getImageLoader().removeRasterImageConsumer(absoluteURI,
this);
this.absoluteURI = null;
this.imageLoaded = false;
// Only declare the new URI to load if this node is
// part of the document tree and if its href is set
// to a non-null value.
if (isInDocumentTree() && href != null) {
willNeedImage();
}
modifiedNode();
|
public void | setImage(com.sun.perseus.j2d.RasterImage image, java.lang.String uri)Sets the node's image if the computed absolute URI
is equal to the input uri.
// This is done to handle situations where the href/parent
// or other change occur while the image is loading.
if (absoluteURI != null && absoluteURI.equals(uri)) {
if (this.image != image) {
modifyingNode();
this.image = image;
modifiedNode();
}
}
|
protected void | setParentQuiet(ModelNode newParent)Sets this node's parent but does not generate change
events.
super.setParentQuiet(newParent);
// Reset the image if this node has a different parent that
// impacts the computation of the absoluteURI
if (href != null && !href.equals(absoluteURI)) {
willNeedImage();
}
|
public void | setTraitImpl(java.lang.String name, java.lang.String value)ImageNode handles x, y, rx, ry, width and height traits.
Other traits are handled by the super class.
if (SVGConstants.SVG_X_ATTRIBUTE == name) {
setX(parseFloatTrait(name, value));
} else if (SVGConstants.SVG_Y_ATTRIBUTE == name) {
setY(parseFloatTrait(name, value));
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == name) {
setWidth(parsePositiveFloatTrait(name, value));
} else if (SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
setHeight(parsePositiveFloatTrait(name, value));
} else if (SVGConstants
.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE.equals(name)) {
if (SVGConstants
.SVG_SVG_PRESERVE_ASPECT_RATIO_DEFAULT_VALUE.equals(value)) {
setAlign(StructureNode.ALIGN_XMIDYMID);
} else if (SVGConstants.SVG_NONE_VALUE.equals(value)) {
setAlign(StructureNode.ALIGN_NONE);
} else {
throw illegalTraitValue(name, value);
}
} else {
super.setTraitImpl(name, value);
}
|
public void | setTraitNSImpl(java.lang.String namespaceURI, java.lang.String name, java.lang.String value)ImageNode supports the xlink:href trait.
try {
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == name) {
setHref(value);
} else {
super.setTraitNSImpl(namespaceURI, name, value);
}
} catch (IllegalArgumentException iae) {
throw illegalTraitValue(name, value);
}
|
public void | setWidth(float newWidth)
if (newWidth < 0) {
throw new IllegalArgumentException();
}
if (newWidth == width) {
return;
}
modifyingNode();
renderingDirty();
this.width = newWidth;
computeCanRenderWidthBit(width);
modifiedNode();
|
public void | setX(float newX)
if (newX == x) {
return;
}
modifyingNode();
renderingDirty();
this.x = newX;
modifiedNode();
|
public void | setY(float newY)
if (newY == y) {
return;
}
modifyingNode();
renderingDirty();
this.y = newY;
modifiedNode();
|
boolean | supportsTrait(java.lang.String traitName)Supported traits: x, y, width, height
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName
||
SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTrait(traitName);
}
|
boolean | supportsTraitNS(java.lang.String namespaceURI, java.lang.String traitName)Supported traits: xlink:href
if (SVGConstants.XLINK_NAMESPACE_URI == namespaceURI
&&
SVGConstants.SVG_HREF_ATTRIBUTE == traitName) {
return true;
} else {
return super.supportsTraitNS(namespaceURI, traitName);
}
|
java.lang.String | toStringTrait(java.lang.String name, float[][] value)
if (SVGConstants.SVG_X_ATTRIBUTE == name
||
SVGConstants.SVG_Y_ATTRIBUTE == name
||
SVGConstants.SVG_WIDTH_ATTRIBUTE == name
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == name) {
return Float.toString(value[0][0]);
} else {
return super.toStringTrait(name, value);
}
|
public float[][] | validateFloatArrayTrait(java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (SVGConstants.SVG_X_ATTRIBUTE == traitName
||
SVGConstants.SVG_Y_ATTRIBUTE == traitName) {
return new float[][]{{parseFloatTrait(traitName, value)}};
} else if (SVGConstants.SVG_WIDTH_ATTRIBUTE == traitName
||
SVGConstants.SVG_HEIGHT_ATTRIBUTE == traitName) {
return new float[][] {{parsePositiveFloatTrait(traitName, value)}};
} else {
return super.validateFloatArrayTrait(traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|
java.lang.String | validateTraitNS(java.lang.String namespaceURI, java.lang.String traitName, java.lang.String value, java.lang.String reqNamespaceURI, java.lang.String reqLocalName, java.lang.String reqTraitNamespace, java.lang.String reqTraitName)Validates the input trait value.
if (namespaceURI != null) {
return super.validateTraitNS(namespaceURI,
traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
if (SVGConstants.SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE
.equals(traitName)) {
if (!SVGConstants
.SVG_SVG_PRESERVE_ASPECT_RATIO_DEFAULT_VALUE.equals(value)
&&
!SVGConstants.SVG_NONE_VALUE.equals(value)) {
throw illegalTraitValue(traitName, value);
}
return value;
} else {
return super.validateTraitNS(namespaceURI,
traitName,
value,
reqNamespaceURI,
reqLocalName,
reqTraitNamespace,
reqTraitName);
}
|
void | willNeedImage()Implementation. Declares to the ImageLoader that an image will be
needed.
imageLoaded = false;
image = ownerDocument.getImageLoader().getLoadingImage();
absoluteURI
= ownerDocument.getImageLoader().resolveURI(href, getURIBase());
if (absoluteURI == null) {
if (paintNeedsLoad) {
throw new IllegalArgumentException();
} else {
absoluteURI = BROKEN_URI;
imageLoaded = true;
image = ownerDocument.getImageLoader().getBrokenImage();
return;
}
} else {
ownerDocument.getImageLoader().addRasterImageConsumer(absoluteURI,
this);
ownerDocument.getImageLoader().needsURI(absoluteURI);
}
|