Top Description Fields Constructors Methods
com.openhtmltopdf.swing

public Class ImageReplacedElement

extends Object
implements ReplacedElement
Class Inheritance
All Implemented Interfaces
com.openhtmltopdf.extend.ReplacedElement
Imports
java.awt.*, java.awt.image.BufferedImage, com.openhtmltopdf.extend.ReplacedElement, com.openhtmltopdf.layout.LayoutContext, com.openhtmltopdf.util.ImageUtil

An ImageReplacedElement is a ReplacedElement that contains a java.awt.Image. It's used as a container for images included within XML being rendered. The image contained is immutable.

Field Summary

Modifier and TypeField and Description
protected Image
private Point

Constructor Summary

AccessConstructor and Description
protected
public
ImageReplacedElement(Image
An image.
image
,
int
The width we'd like the image to have, in pixels.
targetWidth
,
int
The height we'd like the image to have, in pixels.
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

Modifier and TypeMethod and Description
public void
public int
public Image

Returns:

see desc
getImage
()

The image we're replacing.

public int
public int
public Point
getLocation()

Implements com.openhtmltopdf.extend.ReplacedElement.getLocation.

Returns the current location where the element will be rendered on the canvas

public boolean
public boolean
public void
setLocation(int
new horizontal pos
x
,
int
new vertical pos
y
)

Implements com.openhtmltopdf.extend.ReplacedElement.setLocation.

Assigns the new locations where the element will be rendered.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_imageback to summary
protected Image _image
_locationback to summary
private Point _location

Constructor Detail

ImageReplacedElementback to summary
protected ImageReplacedElement()
ImageReplacedElementback to summary
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:Image

An image.

targetWidth:int

The width we'd like the image to have, in pixels.

targetHeight:int

The height we'd like the image to have, in pixels.

Method Detail

detachback to summary
public void detach(LayoutContext c)

Implements com.openhtmltopdf.extend.ReplacedElement.detach.

getBaselineback to summary
public int getBaseline()

Implements com.openhtmltopdf.extend.ReplacedElement.getBaseline.

getImageback to summary
public Image getImage()

The image we're replacing.

Returns:Image

see desc

getIntrinsicHeightback to summary
public int getIntrinsicHeight()

Implements com.openhtmltopdf.extend.ReplacedElement.getIntrinsicHeight.

getIntrinsicWidthback to summary
public int getIntrinsicWidth()

Implements com.openhtmltopdf.extend.ReplacedElement.getIntrinsicWidth.

getLocationback to summary
public Point getLocation()

Implements com.openhtmltopdf.extend.ReplacedElement.getLocation.

Doc from com.openhtmltopdf.extend.ReplacedElement.getLocation.

Returns the current location where the element will be rendered on the canvas

Returns:Point

see desc

hasBaselineback to summary
public boolean hasBaseline()

Implements com.openhtmltopdf.extend.ReplacedElement.hasBaseline.

isRequiresInteractivePaintback to summary
public boolean isRequiresInteractivePaint()

Implements com.openhtmltopdf.extend.ReplacedElement.isRequiresInteractivePaint.

setLocationback to summary
public void setLocation(int x, int y)

Implements com.openhtmltopdf.extend.ReplacedElement.setLocation.

Doc from com.openhtmltopdf.extend.ReplacedElement.setLocation.

Assigns the new locations where the element will be rendered.

Parameters
x:int

new horizontal pos

y:int

new vertical pos