Browse Source

无jira任务 代码质量

newui
vito 11 months ago
parent
commit
edb588e7bf
  1. 3
      designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java
  2. 17
      designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java

3
designer-base/src/main/java/com/fine/theme/icon/GraphicsFilter.java

@ -41,8 +41,9 @@ public class GraphicsFilter
@Override
public void setPaint(Paint paint) {
if (paint instanceof Color)
if (paint instanceof Color) {
paint = filterColor((Color) paint);
}
super.setPaint(paint);
}

17
designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java

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

Loading…
Cancel
Save