org.xhtmlrenderer.swing
Class ImageReplacedElement

java.lang.Object
  extended by org.xhtmlrenderer.swing.ImageReplacedElement
All Implemented Interfaces:
ReplacedElement
Direct Known Subclasses:
DeferredImageReplacedElement

public class ImageReplacedElement
extends Object
implements ReplacedElement

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.


Field Summary
protected  Image _image
           
 
Constructor Summary
protected ImageReplacedElement()
           
  ImageReplacedElement(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 > -1), otherwise original size is preserved.
 
Method Summary
 void detach(LayoutContext c)
          
 int getBaseline()
           
 Image getImage()
          The image we're replacing.
 int getIntrinsicHeight()
          
 int getIntrinsicWidth()
          
 Point getLocation()
          Returns the current location where the element will be rendered on the canvas
 boolean hasBaseline()
           
 boolean isRequiresInteractivePaint()
          
 void setLocation(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, wait
 

Field Detail

_image

protected Image _image
Constructor Detail

ImageReplacedElement

protected ImageReplacedElement()

ImageReplacedElement

public ImageReplacedElement(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 > -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 Detail

detach

public void detach(LayoutContext c)

Specified by:
detach in interface ReplacedElement

getIntrinsicHeight

public int getIntrinsicHeight()

Specified by:
getIntrinsicHeight in interface ReplacedElement

getIntrinsicWidth

public int getIntrinsicWidth()

Specified by:
getIntrinsicWidth in interface ReplacedElement

getLocation

public Point getLocation()
Returns the current location where the element will be rendered on the canvas

Specified by:
getLocation in interface ReplacedElement
Returns:
see desc

isRequiresInteractivePaint

public boolean isRequiresInteractivePaint()

Specified by:
isRequiresInteractivePaint in interface ReplacedElement

setLocation

public void setLocation(int x,
                        int y)
Assigns the new locations where the element will be rendered.

Specified by:
setLocation in interface ReplacedElement
Parameters:
x - new horizontal pos
y - new vertical pos

getImage

public Image getImage()
The image we're replacing.

Returns:
see desc

getBaseline

public int getBaseline()
Specified by:
getBaseline in interface ReplacedElement

hasBaseline

public boolean hasBaseline()
Specified by:
hasBaseline in interface ReplacedElement


Copyright © 2013. All Rights Reserved.