use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.
the class TwoColorsIcon method paintIcon.
@Override
public void paintIcon(final Component component, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g.create();
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g2d);
try {
final int w = getIconWidth();
final int h = getIconHeight();
g2d.setPaint(getPaint(getIconColor()));
g2d.fillPolygon(new int[] { x, x + w, x }, new int[] { y, y, y + h }, 3);
g2d.setPaint(getPaint(mySecondColor));
g2d.fillPolygon(new int[] { x + w, x + w, x }, new int[] { y, y + h, y + h }, 3);
} catch (Exception e) {
g2d.dispose();
} finally {
config.restore();
}
}
use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.
the class UIUtil method drawSearchMatch.
public static void drawSearchMatch(Graphics2D g, float startXf, float endXf, int height, Color c1, Color c2) {
final boolean drawRound = endXf - startXf > 4;
GraphicsConfig config = new GraphicsConfig(g);
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
g.setPaint(getGradientPaint(startXf, 2, c1, startXf, height - 5, c2));
if (isJreHiDPI(g)) {
GraphicsConfig c = GraphicsUtil.setupRoundedBorderAntialiasing(g);
g.fill(new RoundRectangle2D.Float(startXf, 2, endXf - startXf, height - 4, 5, 5));
c.restore();
config.restore();
return;
}
int startX = (int) startXf;
int endX = (int) endXf;
g.fillRect(startX, 3, endX - startX, height - 5);
if (drawRound) {
g.drawLine(startX - 1, 4, startX - 1, height - 4);
g.drawLine(endX, 4, endX, height - 4);
g.setColor(new Color(100, 100, 100, 50));
g.drawLine(startX - 1, 4, startX - 1, height - 4);
g.drawLine(endX, 4, endX, height - 4);
g.drawLine(startX, 3, endX - 1, 3);
g.drawLine(startX, height - 3, endX - 1, height - 3);
}
config.restore();
}
use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.
the class LabelIcon method paintIcon.
private void paintIcon(@NotNull Graphics2D g2) {
GraphicsConfig config = GraphicsUtil.setupAAPainting(g2);
float scale = mySize / 8.0f;
for (int i = myColors.length - 1; i >= 0; i--) {
if (i != myColors.length - 1) {
g2.setColor(myBgColor);
paintTag(g2, scale, scale * 2 * i + 1, 0);
}
g2.setColor(myColors[i]);
paintTag(g2, scale, scale * 2 * i, 0);
}
config.restore();
}
Aggregations