public class VectorImage extends java.lang.Object implements PaintableCollector
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> |
RENDERING_HINTS_QUALITY
Best quality rendering hints.
|
Constructor and Description |
---|
VectorImage(java.awt.geom.Dimension2D virtualSize)
Constructor.
|
VectorImage(double virtualSize)
Constructor.
|
VectorImage(double virtualWidth,
double virtualHeight)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPaintable(Paintable paintable)
Add a paintable.
|
java.awt.Image |
getImage(int size)
Get a square image from this icon.
|
java.awt.Image |
getImage(int width,
int height)
Get an image with the given width and height from this icon.
|
java.util.Collection<Paintable> |
getPaintables()
Get the paintables of the vector image.
|
VectorImage |
getRecoloredImage(Function1<java.awt.Color,java.awt.Color> recolor)
Get a recolored version of this vector image.
|
java.awt.geom.Dimension2D |
getVirtualSize()
Get the virtual size of this icon.
|
void |
paintTo(java.awt.Graphics2D g2)
Paint this object to the given graphics context.
|
void |
paintTo(java.awt.Graphics2D g2,
double x,
double y,
double width,
double height)
Paint this icon to the given graphics context into the given rectangle.
|
void |
paintToRect(java.awt.Graphics2D g2,
int x,
int y,
int width,
int height)
Paint this object to the given integer rectangle.
|
void |
paintToRect(java.awt.Graphics2D g2,
java.awt.Rectangle rectangle)
Paint this object to the given integer rectangle.
|
void |
prepareGraphics(java.awt.Graphics2D g2,
double x,
double y,
double width,
double height)
Prepare a graphics context so this icon would be placed in a given rectangle
|
public static final java.util.Map<java.awt.RenderingHints.Key,java.lang.Object> RENDERING_HINTS_QUALITY
public VectorImage(@NotNull java.awt.geom.Dimension2D virtualSize)
virtualSize
- virtual size of this itempublic VectorImage(double virtualSize)
virtualSize
- virtual size (width and height) of this icon (positive value expected)public VectorImage(double virtualWidth, double virtualHeight)
virtualWidth
- virtual width of this icon (positive value expected)virtualHeight
- virtual height of this icon (positive value expected)public void addPaintable(@NotNull Paintable paintable)
addPaintable
in interface PaintableCollector
paintable
- paintable to add@NotNull public java.util.Collection<Paintable> getPaintables()
@NotNull public VectorImage getRecoloredImage(@NotNull Function1<java.awt.Color,java.awt.Color> recolor)
recolor
- recolor function which substitutes one color with another@NotNull public java.awt.geom.Dimension2D getVirtualSize()
@NotNull public java.awt.Image getImage(int size)
size
- image size (positive value expected)@NotNull public java.awt.Image getImage(int width, int height)
width
- image width (positive value expected)height
- image height (positive value expected)public void prepareGraphics(@NotNull java.awt.Graphics2D g2, double x, double y, double width, double height)
g2
- graphics context (changed after return)x
- x (minimal coordinate) of rectangley
- y (minimal coordinate) of rectanglewidth
- width of rectangle (positive)height
- height of rectangle (positive)public void paintTo(@NotNull java.awt.Graphics2D g2)
g2
- graphics context (unchanged after return)public void paintTo(@NotNull java.awt.Graphics2D g2, double x, double y, double width, double height)
g2
- graphics context (not changed)x
- x (minimal coordinate) of rectangley
- y (minimal coordinate) of rectanglewidth
- width of rectangle (positive)height
- height of rectangle (positive)public void paintToRect(@NotNull java.awt.Graphics2D g2, int x, int y, int width, int height)
g2
- graphics context (not changed)x
- x coordinate to paint toy
- y coordinate to paint towidth
- width to use for paintingheight
- height to use for paintingpublic void paintToRect(@NotNull java.awt.Graphics2D g2, @NotNull java.awt.Rectangle rectangle)
g2
- graphics context (not changed)rectangle
- rectangle to draw to (has to be sane, i.e. width and height needs to be positive)