Class ImageBackedFilterableRadianceIcon
- java.lang.Object
-
- org.pushingpixels.radiance.common.api.icon.ImageBackedFilterableRadianceIcon
-
- All Implemented Interfaces:
javax.swing.Icon
,AsynchronousLoading
,RadianceIcon
public class ImageBackedFilterableRadianceIcon extends java.lang.Object implements RadianceIcon, AsynchronousLoading
Implementation of theRadianceIcon
interface that supports color filtering of content by drawing it into offscreen images and applying the requestedRadianceIcon.ColorFilter
. Note that this is a heavy operation that consumes additional memory resources. If your original icon returnstrue
from itsRadianceIcon.supportsColorFilter()
, do not use this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ImageBackedFilterableRadianceIcon.InternalColorFilter
-
Nested classes/interfaces inherited from interface org.pushingpixels.radiance.common.api.icon.RadianceIcon
RadianceIcon.ColorFilter, RadianceIcon.Factory
-
-
Field Summary
Fields Modifier and Type Field Description private RadianceIcon.ColorFilter
colorFilter
private java.awt.image.BufferedImage
currColorized
private RadianceIcon
currDelegate
private int
height
private javax.swing.event.EventListenerList
listenerList
private RadianceIcon.Factory
sourceFactory
private int
width
-
Constructor Summary
Constructors Constructor Description ImageBackedFilterableRadianceIcon(RadianceIcon.Factory sourceFactory, RadianceIcon.ColorFilter colorFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAsynchronousLoadListener(AsynchronousLoadListener l)
Adds listener on the asynchronous loading events.int
getIconHeight()
int
getIconWidth()
boolean
isLoading()
Returns indication whether the content is still loading.private void
makeColorized()
void
paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
void
removeAsynchronousLoadListener(AsynchronousLoadListener l)
Removes listener on the asynchronous loading events.void
setColorFilter(RadianceIcon.ColorFilter colorFilter)
void
setDimension(java.awt.Dimension newDimension)
Changes the dimension ofthis
icon.boolean
supportsColorFilter()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pushingpixels.radiance.common.api.icon.RadianceIcon
toImage
-
-
-
-
Field Detail
-
sourceFactory
private RadianceIcon.Factory sourceFactory
-
width
private int width
-
height
private int height
-
currDelegate
private RadianceIcon currDelegate
-
listenerList
private javax.swing.event.EventListenerList listenerList
-
colorFilter
private RadianceIcon.ColorFilter colorFilter
-
currColorized
private java.awt.image.BufferedImage currColorized
-
-
Constructor Detail
-
ImageBackedFilterableRadianceIcon
public ImageBackedFilterableRadianceIcon(RadianceIcon.Factory sourceFactory, RadianceIcon.ColorFilter colorFilter)
-
-
Method Detail
-
setDimension
public void setDimension(java.awt.Dimension newDimension)
Description copied from interface:RadianceIcon
Changes the dimension ofthis
icon.- Specified by:
setDimension
in interfaceRadianceIcon
- Parameters:
newDimension
- New dimension forthis
icon.
-
supportsColorFilter
public boolean supportsColorFilter()
- Specified by:
supportsColorFilter
in interfaceRadianceIcon
-
setColorFilter
public void setColorFilter(RadianceIcon.ColorFilter colorFilter)
- Specified by:
setColorFilter
in interfaceRadianceIcon
-
makeColorized
private void makeColorized()
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
- Specified by:
paintIcon
in interfacejavax.swing.Icon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfacejavax.swing.Icon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfacejavax.swing.Icon
-
addAsynchronousLoadListener
public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoading
Adds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListener
in interfaceAsynchronousLoading
- Parameters:
l
- Listener to add.
-
removeAsynchronousLoadListener
public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoading
Removes listener on the asynchronous loading events.- Specified by:
removeAsynchronousLoadListener
in interfaceAsynchronousLoading
- Parameters:
l
- Listener to remove.
-
isLoading
public boolean isLoading()
Description copied from interface:AsynchronousLoading
Returns indication whether the content is still loading.- Specified by:
isLoading
in interfaceAsynchronousLoading
- Returns:
true
if the content is still loading,false
otherwise.
-
-