Package com.reportmill.graphics
Class RMImageFill
- java.lang.Object
-
- com.reportmill.base.RMObject
-
- com.reportmill.graphics.RMFill
-
- com.reportmill.graphics.RMImageFill
-
- All Implemented Interfaces:
RMArchiver.Archiving,java.lang.Cloneable
- Direct Known Subclasses:
RMShadowFill
public class RMImageFill extends RMFill
This class is used to fill a shape's path with an image.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTRIBUTE_FILL_STYLEstatic java.lang.StringATTRIBUTE_ROLLstatic java.lang.StringATTRIBUTE_SCALE_Xstatic java.lang.StringATTRIBUTE_SCALE_Ystatic java.lang.StringATTRIBUTE_Xstatic java.lang.StringATTRIBUTE_Ystatic byteSTYLE_FITstatic byteSTYLE_FIT_IFNEEDEDstatic byteSTYLE_STRETCHstatic byteSTYLE_TILE
-
Constructor Summary
Constructors Constructor Description RMImageFill()Creates a plain image fill.RMImageFill(java.lang.Object aSource)Creates an image fill for the given source.RMImageFill(java.lang.Object aSource, byte aFillStyle, float aMargin)Creates an image fill from an image source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Imageawt()Returns the AWT image for this image fill.RMFillderiveFill(RMColor aColor)Creates a new fill from this image fill, but with a new color.RMImageFillderiveFill(RMImageData anImageData)Creates a new image fill from this fill, but with a new image.RMImageFillderiveFill(java.lang.String aName, java.lang.Number aValue)Creates a new image fill identical to this image fill, but with new value for given attribute.booleanequals(java.lang.Object anObj)Standard equals implementation.java.lang.ObjectfromXML(RXArchiver anArchiver, RXElement anElement)XML unarchival.bytegetFillStyle()Returns the fill style (Stretch, Tile, Fit or FitIfNeeded).RMRectgetImageBounds(RMRect aRect)Returns the image bounds for a given rect.RMRectgetImageBounds(RMShape aShape)Returns the image bounds for a given shape.RMImageDatagetImageData()Returns the image data associated with this image fill.floatgetImageMargins()Returns the inset for the image when drawn in a given bounds.RMShapegetImageShape()Returns an RMShape representation of the image fill's image (for rare vector based images like PDF).RMSizegetImageSize2D()Returns the image size of the image for this image fill.intgetPageNumber()Returns the page number of the image fill's image that is displayed (for rare multi-page images like PDF).floatgetRoll()Returns the rotation of the image fill image.floatgetScaleX()Returns the scale x of the image fill image.floatgetScaleY()Returns the scale y of the image fill image.java.lang.StringgetType()Returns the type of the image for this image fill (gif, jpg, png, etc.).floatgetX()Returns the X location (or offset) of the image fill image.floatgetY()Returns the Y location (or offset) of the image fill image.java.lang.ObjectinitWithArchiver(RMArchiver anArchiver)Legacy unarchival.voidpaintShape(RMShape aShape, RMPath aPath, java.awt.Graphics2D g, RMShapePainter sp)Render this fill in a Java2D Graphics2D.voidsetFillStyle(byte aValue)Returns the fill style (Stretch, Tile, Fit or FitIfNeeded).voidsetImageData(RMImageData anImageData)Sets the image data associated with this image fill.voidsetImageMargins(float aValue)Sets the inset for the image when drawn in a given bounds.voidsetPageNumber(int aNum)Sets the page number of the image fill's image that is displayed (for rare multi-page images like PDF).booleanshouldClipToPath()Returns whether fill should clip to path when painting.RXElementtoXML(RXArchiver anArchiver)XML archival.-
Methods inherited from class com.reportmill.graphics.RMFill
getBounds, getChild, getChildCount, getColor, setColor
-
Methods inherited from class com.reportmill.base.RMObject
clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals
-
-
-
-
Field Detail
-
STYLE_STRETCH
public static final byte STYLE_STRETCH
- See Also:
- Constant Field Values
-
STYLE_TILE
public static final byte STYLE_TILE
- See Also:
- Constant Field Values
-
STYLE_FIT
public static final byte STYLE_FIT
- See Also:
- Constant Field Values
-
STYLE_FIT_IFNEEDED
public static final byte STYLE_FIT_IFNEEDED
- See Also:
- Constant Field Values
-
ATTRIBUTE_FILL_STYLE
public static final java.lang.String ATTRIBUTE_FILL_STYLE
- See Also:
- Constant Field Values
-
ATTRIBUTE_X
public static final java.lang.String ATTRIBUTE_X
- See Also:
- Constant Field Values
-
ATTRIBUTE_Y
public static final java.lang.String ATTRIBUTE_Y
- See Also:
- Constant Field Values
-
ATTRIBUTE_ROLL
public static final java.lang.String ATTRIBUTE_ROLL
- See Also:
- Constant Field Values
-
ATTRIBUTE_SCALE_X
public static final java.lang.String ATTRIBUTE_SCALE_X
- See Also:
- Constant Field Values
-
ATTRIBUTE_SCALE_Y
public static final java.lang.String ATTRIBUTE_SCALE_Y
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RMImageFill
public RMImageFill()
Creates a plain image fill.
-
RMImageFill
public RMImageFill(java.lang.Object aSource)
Creates an image fill for the given source.
-
RMImageFill
public RMImageFill(java.lang.Object aSource, byte aFillStyle, float aMargin)Creates an image fill from an image source.
-
-
Method Detail
-
getImageData
public RMImageData getImageData()
Returns the image data associated with this image fill.
-
setImageData
public void setImageData(RMImageData anImageData)
Sets the image data associated with this image fill.
-
getFillStyle
public byte getFillStyle()
Returns the fill style (Stretch, Tile, Fit or FitIfNeeded).
-
setFillStyle
public void setFillStyle(byte aValue)
Returns the fill style (Stretch, Tile, Fit or FitIfNeeded).
-
getX
public float getX()
Returns the X location (or offset) of the image fill image.
-
getY
public float getY()
Returns the Y location (or offset) of the image fill image.
-
getRoll
public float getRoll()
Returns the rotation of the image fill image.
-
getScaleX
public float getScaleX()
Returns the scale x of the image fill image.
-
getScaleY
public float getScaleY()
Returns the scale y of the image fill image.
-
getImageMargins
public float getImageMargins()
Returns the inset for the image when drawn in a given bounds.
-
setImageMargins
public void setImageMargins(float aValue)
Sets the inset for the image when drawn in a given bounds.
-
deriveFill
public RMFill deriveFill(RMColor aColor)
Creates a new fill from this image fill, but with a new color.- Overrides:
deriveFillin classRMFill
-
deriveFill
public RMImageFill deriveFill(RMImageData anImageData)
Creates a new image fill from this fill, but with a new image.
-
deriveFill
public RMImageFill deriveFill(java.lang.String aName, java.lang.Number aValue)
Creates a new image fill identical to this image fill, but with new value for given attribute.
-
getType
public java.lang.String getType()
Returns the type of the image for this image fill (gif, jpg, png, etc.).
-
getImageSize2D
public RMSize getImageSize2D()
Returns the image size of the image for this image fill.
-
getImageBounds
public RMRect getImageBounds(RMRect aRect)
Returns the image bounds for a given rect.
-
getImageBounds
public RMRect getImageBounds(RMShape aShape)
Returns the image bounds for a given shape.
-
getPageNumber
public int getPageNumber()
Returns the page number of the image fill's image that is displayed (for rare multi-page images like PDF).
-
setPageNumber
public void setPageNumber(int aNum)
Sets the page number of the image fill's image that is displayed (for rare multi-page images like PDF).
-
shouldClipToPath
public boolean shouldClipToPath()
Returns whether fill should clip to path when painting.
-
getImageShape
public RMShape getImageShape()
Returns an RMShape representation of the image fill's image (for rare vector based images like PDF).
-
paintShape
public void paintShape(RMShape aShape, RMPath aPath, java.awt.Graphics2D g, RMShapePainter sp)
Render this fill in a Java2D Graphics2D.- Overrides:
paintShapein classRMFill
-
equals
public boolean equals(java.lang.Object anObj)
Standard equals implementation.
-
initWithArchiver
public java.lang.Object initWithArchiver(RMArchiver anArchiver)
Legacy unarchival.- Specified by:
initWithArchiverin interfaceRMArchiver.Archiving- Overrides:
initWithArchiverin classRMFill
-
toXML
public RXElement toXML(RXArchiver anArchiver)
XML archival.
-
fromXML
public java.lang.Object fromXML(RXArchiver anArchiver, RXElement anElement)
XML unarchival.
-
awt
public java.awt.Image awt()
Returns the AWT image for this image fill.
-
-