Search in sources :

Example 21 with GraphicsConfig

use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.

the class DiffDividerDrawUtil method paintSeparators.

public static void paintSeparators(@NotNull Graphics2D gg, int width, @NotNull Editor editor1, @NotNull Editor editor2, @NotNull DividerSeparatorPaintable paintable) {
    List<DividerSeparator> polygons = createVisibleSeparators(editor1, editor2, paintable);
    GraphicsConfig config = GraphicsUtil.setupAAPainting(gg);
    for (DividerSeparator polygon : polygons) {
        polygon.paint(gg, width);
    }
    config.restore();
}
Also used : GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Example 22 with GraphicsConfig

use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.

the class SwitcherToolWindowsListRenderer method doPaint.

@Override
protected void doPaint(Graphics2D g) {
    GraphicsConfig config = new GraphicsConfig(g);
    if (hide) {
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.15f));
    }
    super.doPaint(g);
    config.restore();
}
Also used : GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Example 23 with GraphicsConfig

use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.

the class JBOptionButton method paintChildren.

@Override
protected void paintChildren(Graphics g) {
    super.paintChildren(g);
    if (myPaintDefaultIfSingle && myOptions.length == 0) {
        return;
    }
    if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
        int x = getWidth() - getInsets().right - 10;
        Icon icon = AllIcons.Mac.YosemiteOptionButtonSelector;
        int y = (getHeight() - icon.getIconHeight()) / 2;
        GraphicsConfig config = isEnabled() ? new GraphicsConfig(g) : GraphicsUtil.paintWithAlpha(g, 0.6f);
        icon.paintIcon(this, g, x, y);
        config.restore();
        return;
    }
    boolean dark = UIUtil.isUnderDarcula();
    int off = dark ? 6 : 0;
    Icon icon = AllIcons.General.ArrowDown;
    if (UIUtil.isUnderIntelliJLaF() && !UIUtil.isUnderWin10LookAndFeel()) {
        icon = AllIcons.General.ArrowDown_white;
    }
    icon.paintIcon(this, g, myMoreRec.x - off, myMoreRec.y);
    if (dark)
        return;
    final Insets insets = getInsets();
    int y1 = myMoreRec.y - 2;
    int y2 = getHeight() - insets.bottom - 2;
    if (y1 < getInsets().top) {
        y1 = insets.top;
    }
    final int x = myMoreRec.x - 4;
    UIUtil.drawDottedLine(((Graphics2D) g), x, y1, x, y2, null, Color.darkGray);
}
Also used : JBInsets(com.intellij.util.ui.JBInsets) GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Example 24 with GraphicsConfig

use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.

the class IdeaActionButtonLook method paintBorder.

protected void paintBorder(Graphics g, Dimension size, int state) {
    GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    try {
        if (UIUtil.isUnderAquaLookAndFeel()) {
            if (state == ActionButtonComponent.POPPED) {
                g.setColor(JBColor.GRAY);
                ((Graphics2D) g).draw(getShape(size));
            }
        } else if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
        //do nothing
        } else if (UIUtil.isUnderWin10LookAndFeel()) {
            g.setColor(Gray.xC4);
            g.drawRect(1, 1, size.width - 3, size.height - 3);
            g.setColor(Gray.xD6);
            g.drawLine(2, 2, size.width - 3, 2);
            g.setColor(Gray.xD9);
            g.drawLine(2, 3, 2, size.width - 3);
            g.drawLine(size.width - 3, 3, size.width - 3, size.width - 3);
        } else {
            Color color = UIUtil.isUnderDarcula() ? ColorUtil.shift(UIUtil.getPanelBackground(), 2.04D) : Gray.xA1;
            g.setColor(color);
            ((Graphics2D) g).setStroke(BASIC_STROKE);
            ((Graphics2D) g).draw(getShape(size));
        }
    } finally {
        config.restore();
    }
}
Also used : JBColor(com.intellij.ui.JBColor) GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Example 25 with GraphicsConfig

use of com.intellij.openapi.ui.GraphicsConfig in project intellij-community by JetBrains.

the class SidePanelCountLabel method paintComponent.

@Override
protected void paintComponent(Graphics g) {
    g.setColor(isSelected() ? UIUtil.getListSelectionBackground() : UIUtil.SIDE_PANEL_BACKGROUND);
    g.fillRect(0, 0, getWidth(), getHeight());
    if (StringUtil.isEmpty(getText()))
        return;
    final JBColor deepBlue = new JBColor(new Color(0x97A4B2), new Color(92, 98, 113));
    g.setColor(isSelected() ? Gray._255.withAlpha(UIUtil.isUnderDarcula() ? 100 : 220) : deepBlue);
    final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
    g.fillRoundRect(0, 3, getWidth() - 6 - 1, getHeight() - 6, getHeight() - 6, getHeight() - 6);
    config.restore();
    setForeground(isSelected() ? deepBlue.darker() : UIUtil.getListForeground(true));
    super.paintComponent(g);
}
Also used : JBColor(com.intellij.ui.JBColor) JBColor(com.intellij.ui.JBColor) GraphicsConfig(com.intellij.openapi.ui.GraphicsConfig)

Aggregations

GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)38 JBColor (com.intellij.ui.JBColor)10 Border (javax.swing.border.Border)5 RoundRectangle2D (java.awt.geom.RoundRectangle2D)4 JBGradientPaint (com.intellij.ui.JBGradientPaint)2 Path2D (java.awt.geom.Path2D)2 Rectangle2D (java.awt.geom.Rectangle2D)2 BasicArrowButton (javax.swing.plaf.basic.BasicArrowButton)2 JTextComponent (javax.swing.text.JTextComponent)2 SettingsDialog (com.intellij.openapi.options.newEditor.SettingsDialog)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 JBInsets (com.intellij.util.ui.JBInsets)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 Area (java.awt.geom.Area)1 CompoundBorder (javax.swing.border.CompoundBorder)1 EmptyBorder (javax.swing.border.EmptyBorder)1 DimensionUIResource (javax.swing.plaf.DimensionUIResource)1 UIResource (javax.swing.plaf.UIResource)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1