paint when you want to paint the image,
if you are implementing Icon you'll invoke this from
paintIcon.
The args argument is useful when additional state is needed.
paintToImage to render the image. The code that
lives here is equivalent to what previously would go in
paintIcon, for an Icon.
paint to draw the cached representation at
the specified location.
getImage to get the cached representation and
draw the image yourself. This is primarily useful when you are not
using VolatileImage.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Map |
| Access | Constructor and Description |
|---|---|
| public | CachedPainter(int
Max number of images to cache cacheCount)Creates an instance of |
| Modifier and Type | Method and Description |
|---|---|
| protected Image | createImage(Component
Component painting to c, int Width of image to create w, int Height to image to create h, GraphicsConfiguration GraphicsConfiguration that will be
rendered to, this may be null. config, Object[] Arguments passed to paint args)Creates the image to cache. |
| protected void | |
| private static ImageCache | |
| private GraphicsConfiguration | |
| private Image | |
| public void | paint(Component
Component rendering to, this may be null. c, Graphics Graphics to paint to g, int X-coordinate to render to x, int Y-coordinate to render to y, int Width to render in w, int Height to render in h, Object... Variable arguments that will be passed to paintToImage args)Renders the cached image to the passed in |
| private void | |
| protected void | paintImage(Component
Component painting to c, Graphics Graphics to paint to g, int X coordinate to paint to x, int Y coordinate to paint to y, int Width to paint to w, int Height to paint to h, Image Image to paint image, Object[] Arguments supplied to args)paintPaints the image to the specified location. |
| protected abstract void | paintToImage(Component
Component painting to, may be null. c, Image Image to paint to image, Graphics Graphics to paint to, obtained from the passed in Image. g, int Width to paint to w, int Height to paint to h, Object[] Arguments supplied to args)paintPaints the representation to cache to the supplied Graphics. |
| cacheMap | back to summary |
|---|---|
| private static final Map<Object, ImageCache> cacheMap | |
| CachedPainter | back to summary |
|---|---|
| public CachedPainter(int cacheCount) Creates an instance of
| |
| createImage | back to summary |
|---|---|
| protected Image createImage(Component c, int w, int h, GraphicsConfiguration config, Object[] args) Creates the image to cache. This returns an opaque image, subclasses that require translucency or transparency will need to override this method.
| |
| flush | back to summary |
|---|---|
| protected void flush() Clear the image cache | |
| getCache | back to summary |
|---|---|
| private static ImageCache getCache(Object key) | |
| getGraphicsConfiguration | back to summary |
|---|---|
| private GraphicsConfiguration getGraphicsConfiguration(Component c) | |
| getImage | back to summary |
|---|---|
| private Image getImage(Object key, Component c, int baseWidth, int baseHeight, int w, int h, Object... args) | |
| paint | back to summary |
|---|---|
| public void paint(Component c, Graphics g, int x, int y, int w, int h, Object... args) Renders the cached image to the passed in | |
| paint0 | back to summary |
|---|---|
| private void paint0(Component c, Graphics g, int x, int y, int w, int h, Object... args) | |
| paintImage | back to summary |
|---|---|
| protected void paintImage(Component c, Graphics g, int x, int y, int w, int h, Image image, Object[] args) Paints the image to the specified location. | |
| paintToImage | back to summary |
|---|---|
| protected abstract void paintToImage(Component c, Image image, Graphics g, int w, int h, Object[] args) Paints the representation to cache to the supplied Graphics. | |
| Modifier and Type | Field and Description |
|---|---|
| private Object[] | |
| private final int | |
| private final int | |
| private Component |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Image | getBaseImage()
Implements abstract java. Return the base image representing the best version of the image for rendering at the default width and height. |
| public int | getHeight(ImageObserver observer)
Overrides java. This method simply delegates to the same method on the base image and
it is equivalent to: |
| public Image | getResolutionVariant(double destWidth, double destHeight)
Implements java. Gets a specific image that is the best variant to represent this logical image at the indicated size. |
| public List | getResolutionVariants()
Implements java. Gets a readable list of all resolution variants. |
| public int | getWidth(ImageObserver observer)
Overrides java. This method simply delegates to the same method on the base image and
it is equivalent to: |
| public void |
| args | back to summary |
|---|---|
| private Object[] args | |
| baseHeight | back to summary |
|---|---|
| private final int baseHeight | |
| baseWidth | back to summary |
|---|---|
| private final int baseWidth | |
| c | back to summary |
|---|---|
| private Component c | |
| PainterMultiResolutionCachedImage | back to summary |
|---|---|
| public PainterMultiResolutionCachedImage(int baseWidth, int baseHeight) | |
| getBaseImage | back to summary |
|---|---|
| protected Image getBaseImage() Implements abstract java. Doc from java. Return the base image representing the best version of the image for rendering at the default width and height.
| |
| getHeight | back to summary |
|---|---|
| public int getHeight(ImageObserver observer) Overrides java. Doc from java. This method simply delegates to the same method on the base image and
it is equivalent to:
| |
| getResolutionVariant | back to summary |
|---|---|
| public Image getResolutionVariant(double destWidth, double destHeight) Implements java. Doc from java. Gets a specific image that is the best variant to represent this logical image at the indicated size.
| |
| getResolutionVariants | back to summary |
|---|---|
| public List Implements java. Doc from java. Gets a readable list of all resolution variants. The list must be nonempty and contain at least one resolution variant. Note that many implementations might return an unmodifiable list.
| |
| getWidth | back to summary |
|---|---|
| public int getWidth(ImageObserver observer) Overrides java. Doc from java. This method simply delegates to the same method on the base image and
it is equivalent to:
| |
| setParams | back to summary |
|---|---|
| public void setParams(Component c, Object[] args) | |