Package uk.ac.starlink.ttools.plot
Class PictureImageIcon
java.lang.Object
uk.ac.starlink.ttools.plot.PictureImageIcon
- All Implemented Interfaces:
Icon
Adapter class that makes a Picture usable as an Icon, suitable for
use in a pixel (non-vector) context.
Rendering is done to an off-screen volatile image for performance.
This rendered image is optionally cached for subsequent use.
- Since:
- 25 Jan 2012
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionPictureImageIcon(Picture picture, boolean caching) Constructs an icon with default transparency.PictureImageIcon(Picture picture, boolean caching, int transparency) Constructs an icon with specific transparency characteristics. -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheImage(GraphicsConfiguration gc, Color bg) Forces creation of a cached image for display.static BufferedImagecreateImage(Picture picture, GraphicsConfiguration gc, Color bg, Integer transparency) Creates an image containing the graphic content of this icon, suitable for caching or painting to a graphics context.intintvoid
-
Constructor Details
-
PictureImageIcon
Constructs an icon with specific transparency characteristics.- Parameters:
picture- picture to paintcaching- true iff painted image is cached rather than just drawn off-screen every timetransparency- transparency mode- See Also:
-
PictureImageIcon
Constructs an icon with default transparency.- Parameters:
picture- picture to paintcaching- true iff painted image is cached rather than just drawn off-screen every time
-
-
Method Details
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidthin interfaceIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeightin interfaceIcon
-
paintIcon
-
cacheImage
Forces creation of a cached image for display. If this is not called explicitly then in caching mode a cached image will be created when this icon is first painted.- Parameters:
gc- graphics config in which this icon will be displayedbg- background colour for image; null is legal but may lead to unpredictable effects.
-
createImage
public static BufferedImage createImage(Picture picture, GraphicsConfiguration gc, Color bg, Integer transparency) Creates an image containing the graphic content of this icon, suitable for caching or painting to a graphics context.- Parameters:
picture- picture to paint on the imagegc- graphics config in which this icon will be displayedbg- background colour for image; null is legal but may lead to unpredictable effects.transparency- integer value of Transparency code, or null- Returns:
- image containing picture graphics
-