|
|
@ -42,7 +42,18 @@ import static com.fine.theme.utils.FineUIScale.scale; |
|
|
|
public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { |
|
|
|
public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { |
|
|
|
|
|
|
|
|
|
|
|
public enum Type { |
|
|
|
public enum Type { |
|
|
|
disable, white, origin |
|
|
|
/** |
|
|
|
|
|
|
|
* 灰化图 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
disable, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 白化图,用于反白场景 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
white, |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 原始效果图 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
origin |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private final Dimension size; |
|
|
|
private final Dimension size; |
|
|
@ -74,14 +85,14 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void paintIcon(Component c, Graphics g, int x, int y) { |
|
|
|
public void paintIcon(Component c, Graphics g, int x, int y) { |
|
|
|
if (type == Type.disable) { |
|
|
|
if (type == Type.disable) { |
|
|
|
g = GrayGraphics(g); |
|
|
|
g = grayGraphics(g); |
|
|
|
} |
|
|
|
} |
|
|
|
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints(g); |
|
|
|
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints(g); |
|
|
|
render(c, g, x, y); |
|
|
|
render(c, g, x, y); |
|
|
|
FlatUIUtils.resetRenderingHints(g, oldRenderingHints); |
|
|
|
FlatUIUtils.resetRenderingHints(g, oldRenderingHints); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Graphics2D GrayGraphics(Graphics g) { |
|
|
|
public Graphics2D grayGraphics(Graphics g) { |
|
|
|
Object grayFilterObj = UIManager.get("Component.grayFilter"); |
|
|
|
Object grayFilterObj = UIManager.get("Component.grayFilter"); |
|
|
|
RGBImageFilter grayFilter = (grayFilterObj instanceof RGBImageFilter) |
|
|
|
RGBImageFilter grayFilter = (grayFilterObj instanceof RGBImageFilter) |
|
|
|
? (RGBImageFilter) grayFilterObj |
|
|
|
? (RGBImageFilter) grayFilterObj |
|
|
|