public class ImageResource extends Object
svg
is not null
and in the latter case,
baseImage
is not null
.Modifier and Type | Field and Description |
---|---|
private Image |
baseImage |
static Dimension |
DEFAULT_DIMENSION
Use this dimension to request original file dimension.
|
private Map<Dimension,Image> |
imgCache
Caches the image data for resized versions of the same image.
|
protected List<ImageOverlay> |
overlayInfo
ordered list of overlay images
|
private com.kitfox.svg.SVGDiagram |
svg
SVG diagram information in case of SVG vector image.
|
Constructor and Description |
---|
ImageResource(Image img)
Constructs a new
ImageResource from an image. |
ImageResource(ImageResource res,
List<ImageOverlay> overlayInfo)
Constructs a new
ImageResource from another one and sets overlays. |
ImageResource(com.kitfox.svg.SVGDiagram svg)
Constructs a new
ImageResource from SVG data. |
Modifier and Type | Method and Description |
---|---|
ImageIcon |
getImageIcon()
Returns the image icon at default dimension.
|
void |
getImageIcon(AbstractAction a)
Set both icons of an Action
|
ImageIcon |
getImageIcon(Dimension dim)
Get an ImageIcon object for the image of this resource
|
ImageIcon |
getImageIconBounded(Dimension maxSize)
Get image icon with a certain maximum size.
|
private final Map<Dimension,Image> imgCache
private com.kitfox.svg.SVGDiagram svg
public static final Dimension DEFAULT_DIMENSION
protected List<ImageOverlay> overlayInfo
public ImageResource(Image img)
ImageResource
from an image.img
- the imagepublic ImageResource(com.kitfox.svg.SVGDiagram svg)
ImageResource
from SVG data.svg
- SVG datapublic ImageResource(ImageResource res, List<ImageOverlay> overlayInfo)
ImageResource
from another one and sets overlays.res
- the existing resourceoverlayInfo
- the overlay to applypublic ImageIcon getImageIcon()
public void getImageIcon(AbstractAction a)
a
- The action for the iconspublic ImageIcon getImageIcon(Dimension dim)
dim
- The requested dimensions. Use (-1,-1) for the original size
and (width, -1) to set the width, but otherwise scale the image
proportionally.public ImageIcon getImageIconBounded(Dimension maxSize)
maxSize
- The maximum size. One of the dimensions (width or height) can be -1,
which means it is not bounded.