mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
antialiasing for wave underscore
This commit is contained in:
@@ -19,8 +19,10 @@ import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -37,6 +39,8 @@ import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -682,13 +686,24 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co
|
||||
}
|
||||
// 2. Waved effect
|
||||
if (attributes.isWaved()) {
|
||||
if (attributes.getWaveColor() != null) {
|
||||
g.setColor(attributes.getWaveColor());
|
||||
}
|
||||
final int wavedAt = textBaseline + 1;
|
||||
for (int x = offset; x <= offset + fragmentWidth; x += 4) {
|
||||
UIUtil.drawLine(g, x, wavedAt, x + 2, wavedAt + 2);
|
||||
UIUtil.drawLine(g, x + 3, wavedAt + 1, x + 4, wavedAt);
|
||||
GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
|
||||
Stroke oldStroke = g.getStroke();
|
||||
try {
|
||||
g.setStroke(new BasicStroke(.7F));
|
||||
if (attributes.getWaveColor() != null) {
|
||||
g.setColor(attributes.getWaveColor());
|
||||
}
|
||||
final int wavedAt = textBaseline + 1;
|
||||
GeneralPath wavePath = new GeneralPath(PathIterator.WIND_EVEN_ODD);
|
||||
wavePath.moveTo(offset, wavedAt);
|
||||
for (int x = offset; x <= offset + fragmentWidth; x += 4) {
|
||||
wavePath.lineTo(x + 2, wavedAt + 2);
|
||||
wavePath.lineTo(x + 4, wavedAt);
|
||||
}
|
||||
g.draw(wavePath);
|
||||
} finally {
|
||||
config.restore();
|
||||
g.setStroke(oldStroke);
|
||||
}
|
||||
}
|
||||
// 3. Underline
|
||||
|
||||
Reference in New Issue
Block a user