java.lang.Object
org.xhtmlrenderer.swing.InstantImageReplacedElement
- All Implemented Interfaces:
ReplacedElement,ImageReplacedElement
An ImageReplacedElement is a
ReplacedElement that contains a Image. It's used as a
container for images included within XML being rendered. The image contained is immutable.-
Constructor Summary
ConstructorsConstructorDescriptionInstantImageReplacedElement(Image image, int targetWidth, int targetHeight) Creates a new ImageReplacedElement and scales it to the size specified if either width or height has a valid value (values are greater than -1), otherwise original size is preserved. -
Method Summary
Modifier and TypeMethodDescriptiongetImage()The image we're replacingintintReturns the current location where the element will be rendered on the canvasprotected Imageimage()voidsetLocation(int x, int y) Assigns the new locations where the element will be rendered.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xhtmlrenderer.swing.ImageReplacedElement
detach, getBaseline, hasBaseline, isRequiresInteractivePaint
-
Constructor Details
-
InstantImageReplacedElement
Creates a new ImageReplacedElement and scales it to the size specified if either width or height has a valid value (values are greater than -1), otherwise original size is preserved. The idea is that the image was loaded at a certain size (that's the Image instance here) and that at the time we create the ImageReplacedElement we have a target W/H we want to use.- Parameters:
image- An image.targetWidth- The width we'd like the image to have, in pixels.targetHeight- The height we'd like the image to have, in pixels.
-
-
Method Details
-
image
-
getIntrinsicHeight
public int getIntrinsicHeight()- Specified by:
getIntrinsicHeightin interfaceReplacedElement
-
getIntrinsicWidth
public int getIntrinsicWidth()- Specified by:
getIntrinsicWidthin interfaceReplacedElement
-
getLocation
Description copied from interface:ReplacedElementReturns the current location where the element will be rendered on the canvas- Specified by:
getLocationin interfaceReplacedElement
-
setLocation
public void setLocation(int x, int y) Description copied from interface:ReplacedElementAssigns the new locations where the element will be rendered.- Specified by:
setLocationin interfaceReplacedElement- Parameters:
x- new horizontal positiony- new vertical position
-
getImage
The image we're replacing- Specified by:
getImagein interfaceImageReplacedElement
-