APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.font

public final Class ImageGraphicAttribute

extends GraphicAttribute
Class Inheritance
Imports
java.awt.Image, .Graphics2D, java.awt.geom.Rectangle2D

The ImageGraphicAttribute class is an implementation of GraphicAttribute which draws images in a TextLayout.
See Also
GraphicAttribute

Field Summary

Modifier and TypeField and Description
private Image
private float
private float
private float
private float
Inherited from java.awt.font.GraphicAttribute:
BOTTOM_ALIGNMENTCENTER_BASELINEHANGING_BASELINEROMAN_BASELINETOP_ALIGNMENT

Constructor Summary

AccessConstructor and Description
public
ImageGraphicAttribute(Image
the Image rendered by this ImageGraphicAttribute. This object keeps a reference to image.
image
,
int
one of the alignments from this ImageGraphicAttribute
alignment
)

Constructs an ImageGraphicAttribute from the specified Image.

public
ImageGraphicAttribute(Image
the Image rendered by this ImageGraphicAttribute. This object keeps a reference to image.
image
,
int
one of the alignments from this ImageGraphicAttribute
alignment
,
float
the X coordinate of the point within the Image that appears at the origin of the ImageGraphicAttribute in the text line.
originX
,
float
the Y coordinate of the point within the Image that appears at the origin of the ImageGraphicAttribute in the text line.
originY
)

Constructs an ImageGraphicAttribute from the specified Image.

Method Summary

Modifier and TypeMethod and Description
public void
draw(Graphics2D graphics, float x, float y)

Implements abstract java.awt.font.GraphicAttribute.draw.

Renders this GraphicAttribute at the specified location.

public boolean

Returns:

true if this ImageGraphicAttribute equals rhs; false otherwise.
equals
(Object
the Object to compare for equality
rhs
)

Overrides java.lang.Object.equals.

Compares this ImageGraphicAttribute to the specified Object.

public boolean

Returns:

true if this ImageGraphicAttribute equals rhs; false otherwise.
equals
(ImageGraphicAttribute
the ImageGraphicAttribute to compare for equality
rhs
)

Compares this ImageGraphicAttribute to the specified ImageGraphicAttribute.

public float

Returns:

the advance of this ImageGraphicAttribute.
getAdvance
()

Implements abstract java.awt.font.GraphicAttribute.getAdvance.

Returns the advance of this ImageGraphicAttribute.

public float

Returns:

the ascent of this ImageGraphicAttribute.
getAscent
()

Implements abstract java.awt.font.GraphicAttribute.getAscent.

Returns the ascent of this ImageGraphicAttribute.

public Rectangle2D

Returns:

a Rectangle2D that encloses all of the bits rendered by this ImageGraphicAttribute.
getBounds
()

Overrides java.awt.font.GraphicAttribute.getBounds.

Returns a Rectangle2D that encloses all of the bits rendered by this ImageGraphicAttribute, relative to the rendering position.

public float

Returns:

the descent of this ImageGraphicAttribute.
getDescent
()

Implements abstract java.awt.font.GraphicAttribute.getDescent.

Returns the descent of this ImageGraphicAttribute.

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this ImageGraphicAttribute.

Inherited from java.awt.font.GraphicAttribute:
getAlignmentgetJustificationInfogetOutline

Field Detail

fImageback to summary
private Image fImage
fImageHeightback to summary
private float fImageHeight
fImageWidthback to summary
private float fImageWidth
fOriginXback to summary
private float fOriginX
fOriginYback to summary
private float fOriginY

Constructor Detail

ImageGraphicAttributeback to summary
public ImageGraphicAttribute(Image image, int alignment)

Constructs an ImageGraphicAttribute from the specified Image. The origin is at (0, 0).

Parameters
image:Image

the Image rendered by this ImageGraphicAttribute. This object keeps a reference to image.

alignment:int

one of the alignments from this ImageGraphicAttribute

ImageGraphicAttributeback to summary
public ImageGraphicAttribute(Image image, int alignment, float originX, float originY)

Constructs an ImageGraphicAttribute from the specified Image. The point (originX, originY) in the Image appears at the origin of the ImageGraphicAttribute within the text.

Parameters
image:Image

the Image rendered by this ImageGraphicAttribute. This object keeps a reference to image.

alignment:int

one of the alignments from this ImageGraphicAttribute

originX:float

the X coordinate of the point within the Image that appears at the origin of the ImageGraphicAttribute in the text line.

originY:float

the Y coordinate of the point within the Image that appears at the origin of the ImageGraphicAttribute in the text line.

Method Detail

drawback to summary
public void draw(Graphics2D graphics, float x, float y)

Implements abstract java.awt.font.GraphicAttribute.draw.

Doc from java.awt.font.GraphicAttribute.draw.

Renders this GraphicAttribute at the specified location.

equalsback to summary
public boolean equals(Object rhs)

Overrides java.lang.Object.equals.

Compares this ImageGraphicAttribute to the specified Object.

Parameters
rhs:Object

the Object to compare for equality

Returns:boolean

true if this ImageGraphicAttribute equals rhs; false otherwise.

equalsback to summary
public boolean equals(ImageGraphicAttribute rhs)

Compares this ImageGraphicAttribute to the specified ImageGraphicAttribute.

Parameters
rhs:ImageGraphicAttribute

the ImageGraphicAttribute to compare for equality

Returns:boolean

true if this ImageGraphicAttribute equals rhs; false otherwise.

getAdvanceback to summary
public float getAdvance()

Implements abstract java.awt.font.GraphicAttribute.getAdvance.

Returns the advance of this ImageGraphicAttribute. The advance of an ImageGraphicAttribute is the distance from the origin to the right edge of the image.

Returns:float

the advance of this ImageGraphicAttribute.

getAscentback to summary
public float getAscent()

Implements abstract java.awt.font.GraphicAttribute.getAscent.

Returns the ascent of this ImageGraphicAttribute. The ascent of an ImageGraphicAttribute is the distance from the top of the image to the origin.

Returns:float

the ascent of this ImageGraphicAttribute.

getBoundsback to summary
public Rectangle2D getBounds()

Overrides java.awt.font.GraphicAttribute.getBounds.

Returns a Rectangle2D that encloses all of the bits rendered by this ImageGraphicAttribute, relative to the rendering position. A graphic can be rendered beyond its origin, ascent, descent, or advance; but if it is, this method's implementation must indicate where the graphic is rendered.

Returns:Rectangle2D

a Rectangle2D that encloses all of the bits rendered by this ImageGraphicAttribute.

getDescentback to summary
public float getDescent()

Implements abstract java.awt.font.GraphicAttribute.getDescent.

Returns the descent of this ImageGraphicAttribute. The descent of an ImageGraphicAttribute is the distance from the origin to the bottom of the image.

Returns:float

the descent of this ImageGraphicAttribute.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this ImageGraphicAttribute.

Returns:int

a hash code value for this object.