mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
-Dui.no.bangs.and.whistles=true to disable all gradients as well as scrollbar animation
This commit is contained in:
@@ -76,12 +76,12 @@ public class
|
||||
int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
|
||||
_height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
|
||||
if (dark) {
|
||||
g2d.setPaint(new GradientPaint(_x, _y, ColorUtil.shift(UIUtil.getListBackground(), 1.3), _x, _y + effectiveBounds.height, UIUtil.getPanelBackground()));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, ColorUtil.shift(UIUtil.getListBackground(), 1.3), _x, _y + effectiveBounds.height, UIUtil.getPanelBackground()));
|
||||
g2d.fillRect(_x, _y, _width, _height);
|
||||
|
||||
g2d.setColor(Gray._0.withAlpha(50));
|
||||
} else {
|
||||
g2d.setPaint(new GradientPaint(_x, _y, new Color(255, 255, 255, 180), _x, _y + effectiveBounds.height, new Color(255, 255, 255, 100)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, new Color(255, 255, 255, 180), _x, _y + effectiveBounds.height, new Color(255, 255, 255, 100)));
|
||||
g2d.fillRect(_x, _y, _width, _height);
|
||||
|
||||
g2d.setColor(new Color(255, 255, 255, 100));
|
||||
@@ -152,7 +152,7 @@ public class
|
||||
int _height = r.height;
|
||||
|
||||
if (!isHideTabs()) {
|
||||
g2d.setPaint(new GradientPaint(_x, _y, col, _x, _y + _height - 3, panelBg));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, col, _x, _y + _height - 3, panelBg));
|
||||
|
||||
g2d.fill(selectedShape.fillPath.getShape());
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
|
||||
BufferedImage result = UIUtil.createImage(w, h, BufferedImage.TYPE_INT_ARGB);
|
||||
|
||||
Color defaultBg = UIUtil.isUnderDarcula() ? Gray._100 : Color.WHITE;
|
||||
final Paint bg = floating ? defaultBg : new GradientPaint(0, 0, new Color(255, 255, 255, 30), 0, h, new Color(255, 255, 255, 10));
|
||||
final Paint bg = floating ? defaultBg : UIUtil.getGradientPaint(0, 0, new Color(255, 255, 255, 30), 0, h, new Color(255, 255, 255, 10));
|
||||
final Color selection = UIUtil.getListSelectionBackground();
|
||||
|
||||
Graphics2D g2 = result.createGraphics();
|
||||
@@ -237,12 +237,12 @@ public abstract class AbstractNavBarUI implements NavBarUI {
|
||||
|
||||
g2d.setColor(c);
|
||||
if (gradient) {
|
||||
g2d.setPaint(new GradientPaint(0, 0, ColorUtil.toAlpha(c, 10), 0, h / 2, c));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.toAlpha(c, 10), 0, h / 2, c));
|
||||
}
|
||||
g2d.drawLine(0, 0, off, h / 2);
|
||||
|
||||
if (gradient) {
|
||||
g2d.setPaint(new GradientPaint(0, h / 2, c, 0, h, ColorUtil.toAlpha(c, 10)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, h / 2, c, 0, h, ColorUtil.toAlpha(c, 10)));
|
||||
}
|
||||
g2d.drawLine(off, h / 2, 0, h);
|
||||
|
||||
@@ -251,13 +251,13 @@ public abstract class AbstractNavBarUI implements NavBarUI {
|
||||
g2d.setColor(light);
|
||||
|
||||
if (gradient) {
|
||||
g2d.setPaint(new GradientPaint(0, 0, ColorUtil.toAlpha(light, 10), 0, h / 2, light));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.toAlpha(light, 10), 0, h / 2, light));
|
||||
}
|
||||
g2d.drawLine(0, 0, off, h / 2);
|
||||
|
||||
|
||||
if (gradient) {
|
||||
g2d.setPaint(new GradientPaint(0, h / 2, light, 0, h, ColorUtil.toAlpha(light, 10)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, h / 2, light, 0, h, ColorUtil.toAlpha(light, 10)));
|
||||
}
|
||||
g2d.drawLine(off, h / 2, 0, h);
|
||||
}
|
||||
|
||||
@@ -360,25 +360,25 @@ public abstract class ComboBoxAction extends AnAction implements CustomComponent
|
||||
final int w = getWidth();
|
||||
final int h = getHeight();
|
||||
if (getModel().isArmed() && getModel().isPressed()) {
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8)));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, UIUtil.getControlColor(), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.8)));
|
||||
}
|
||||
else {
|
||||
g2.setPaint(
|
||||
new GradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.9)));
|
||||
UIUtil.getGradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.1), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 0.9)));
|
||||
}
|
||||
g2.fillRect(2, 0, w - 2, h);
|
||||
GraphicsUtil.setupAntialiasing(g2);
|
||||
if (!UIUtil.isUnderDarcula()) {
|
||||
if (!myMouseInside) {
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker()));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, UIUtil.getBorderColor(), 0, h, UIUtil.getBorderColor().darker()));
|
||||
} else {
|
||||
g2.setPaint(new GradientPaint(0, 0, UIUtil.getBorderColor().darker(), 0, h, UIUtil.getBorderColor().darker().darker()));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, UIUtil.getBorderColor().darker(), 0, h, UIUtil.getBorderColor().darker().darker()));
|
||||
}
|
||||
} else {
|
||||
if (!myMouseInside) {
|
||||
g2.setPaint(new GradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.2), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 1.3)));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.2), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 1.3)));
|
||||
} else {
|
||||
g2.setPaint(new GradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.4), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 1.5)));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(UIUtil.getControlColor(), 1.4), 0, h, ColorUtil.shift(UIUtil.getControlColor(), 1.5)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ public interface StatusBarWidget extends Disposable {
|
||||
if (SystemInfo.isMac) {
|
||||
final Window window = SwingUtilities.getWindowAncestor(c);
|
||||
if (window != null && window.isActive()) {
|
||||
g2.setPaint(new GradientPaint(0, 0, LEFT1_FROM, 0, height, LEFT1_TO));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, LEFT1_FROM, 0, height, LEFT1_TO));
|
||||
g2.drawLine(x, y, x, y + height);
|
||||
|
||||
g2.setPaint(new GradientPaint(0, 0, LEFT2_FROM, 0, height, LEFT2_TO));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, LEFT2_FROM, 0, height, LEFT2_TO));
|
||||
g2.drawLine(x + 1, y, x + 1, y + height);
|
||||
|
||||
g2.setColor(PIXEL);
|
||||
@@ -116,7 +116,7 @@ public interface StatusBarWidget extends Disposable {
|
||||
g2.drawLine(x + 2, y, x + width - 2, y);
|
||||
}
|
||||
else {
|
||||
g2.setPaint(new GradientPaint(0, 0, LEFT1_FROM_INACTIVE, 0, height, LEFT1_TO_INACTIVE));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, LEFT1_FROM_INACTIVE, 0, height, LEFT1_TO_INACTIVE));
|
||||
g2.drawLine(x, y, x, y + height);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -58,7 +58,7 @@ class DarculaEditorTabsPainter implements JBEditorTabsPainter {
|
||||
final int x = rectangle.x;
|
||||
final int y = rectangle.y;
|
||||
final int h = rectangle.height;
|
||||
g.setPaint(new GradientPaint(x, y, Gray._78.withAlpha(160), x, y + h, Gray._78.withAlpha(120)));
|
||||
g.setPaint(UIUtil.getGradientPaint(x, y, Gray._78.withAlpha(160), x, y + h, Gray._78.withAlpha(120)));
|
||||
final int w = rectangle.width;
|
||||
g.fillRect(x, rectangle.y, w, h + (vertical ? 1 : 0));
|
||||
|
||||
@@ -96,9 +96,9 @@ class DarculaEditorTabsPainter implements JBEditorTabsPainter {
|
||||
g2d.setColor(tabColor);
|
||||
g2d.fill(selectedShape.fillPath.getShape());
|
||||
|
||||
g2d.setPaint(new GradientPaint(_x, _y, Gray._255.withAlpha(50), _x, _y + _height, Gray._255.withAlpha(0)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, Gray._255.withAlpha(50), _x, _y + _height, Gray._255.withAlpha(0)));
|
||||
} else {
|
||||
g2d.setPaint(new GradientPaint(_x, _y, Gray._85, _x, _y + _height, Gray._60));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, Gray._85, _x, _y + _height, Gray._60));
|
||||
}
|
||||
|
||||
g2d.fill(selectedShape.fillPath.getShape());
|
||||
|
||||
@@ -40,13 +40,13 @@ public class DefaultEditorTabsPainter implements JBEditorTabsPainter {
|
||||
int column,
|
||||
boolean vertical) {
|
||||
if (tabColor != null) {
|
||||
g2d.setPaint(new GradientPaint(x, y, Gray._200, x, y + effectiveBounds.height, Gray._130));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(x, y, Gray._200, x, y + effectiveBounds.height, Gray._130));
|
||||
g2d.fillRect(x, y, w, h);
|
||||
|
||||
g2d.setColor(ColorUtil.toAlpha(tabColor, 150));
|
||||
g2d.fillRect(x, y, w, h);
|
||||
} else {
|
||||
g2d.setPaint(new GradientPaint(x, y, Gray._255.withAlpha(180), x, y + effectiveBounds.height, Gray._255.withAlpha(100)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(x, y, Gray._255.withAlpha(180), x, y + effectiveBounds.height, Gray._255.withAlpha(100)));
|
||||
g2d.fillRect(x, y, w, h);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class DefaultEditorTabsPainter implements JBEditorTabsPainter {
|
||||
|
||||
private static void drawShadow(Graphics2D g, int x, int w, int shadowBottom) {
|
||||
int shadowTop = shadowBottom - ACTIVE_TAB_SHADOW_HEIGHT;
|
||||
g.setPaint(new GradientPaint(x, shadowTop, new Color(0, 0, 0, 0),
|
||||
g.setPaint(UIUtil.getGradientPaint(x, shadowTop, new Color(0, 0, 0, 0),
|
||||
x, shadowBottom, new Color(0, 0, 0, 30)));
|
||||
g.fillRect(x, shadowTop, w, ACTIVE_TAB_SHADOW_HEIGHT);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class DefaultEditorTabsPainter implements JBEditorTabsPainter {
|
||||
|
||||
final int x = rectangle.x;
|
||||
final int y = rectangle.y;
|
||||
g.setPaint(new GradientPaint(x, y, new Color(255, 255, 255, 160),
|
||||
g.setPaint(UIUtil.getGradientPaint(x, y, new Color(255, 255, 255, 160),
|
||||
x, rectangle.y + rectangle.height, new Color(255, 255, 255, 120)));
|
||||
g.fillRect(x, rectangle.y, rectangle.width, rectangle.height + (vertical ? 1 : 0));
|
||||
|
||||
@@ -127,9 +127,9 @@ public class DefaultEditorTabsPainter implements JBEditorTabsPainter {
|
||||
g2d.setColor(multiplyColor(tabColor));
|
||||
g2d.fill(selectedShape.fillPath.getShape());
|
||||
|
||||
g2d.setPaint(new GradientPaint(_x, _y, Gray._255.withAlpha(150), _x, _y + _height, Gray._255.withAlpha(0)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, Gray._255.withAlpha(150), _x, _y + _height, Gray._255.withAlpha(0)));
|
||||
} else {
|
||||
g2d.setPaint(new GradientPaint(_x, _y, Gray._255, _x, _y + _height, Gray._230));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(_x, _y, Gray._255, _x, _y + _height, Gray._230));
|
||||
}
|
||||
|
||||
g2d.fill(selectedShape.fillPath.getShape());
|
||||
|
||||
@@ -1661,7 +1661,7 @@ public class JBTabsImpl extends JComponent
|
||||
shapeInfo.fillPath.transformLine(shapeInfo.fillPath.getX(), paintTopY, shapeInfo.fillPath.getX(), paintBottomY);
|
||||
|
||||
|
||||
g2d.setPaint(new GradientPaint((float)gradientLine.getX1(), (float)gradientLine.getY1(),
|
||||
g2d.setPaint(UIUtil.getGradientPaint((float)gradientLine.getX1(), (float)gradientLine.getY1(),
|
||||
shapeInfo.fillPath.transformY1(shapeInfo.from, shapeInfo.to), (float)gradientLine.getX2(),
|
||||
(float)gradientLine.getY2(), shapeInfo.fillPath.transformY1(shapeInfo.to, shapeInfo.from)));
|
||||
g2d.fill(shapeInfo.fillPath.getShape());
|
||||
@@ -2051,12 +2051,12 @@ public class JBTabsImpl extends JComponent
|
||||
final Line2D.Float gradientLine =
|
||||
shape.transformLine(0, topY, 0, topY + shape.deltaY((int)(shape.getHeight() / 1.5)));
|
||||
|
||||
final GradientPaint gp = UIUtil.isUnderDarcula()
|
||||
? new GradientPaint(gradientLine.x1, gradientLine.y1,
|
||||
final Paint gp = UIUtil.isUnderDarcula()
|
||||
? UIUtil.getGradientPaint(gradientLine.x1, gradientLine.y1,
|
||||
shape.transformY1(backgroundColor, backgroundColor),
|
||||
gradientLine.x2, gradientLine.y2,
|
||||
shape.transformY1(backgroundColor, backgroundColor))
|
||||
: new GradientPaint(gradientLine.x1, gradientLine.y1,
|
||||
: UIUtil.getGradientPaint(gradientLine.x1, gradientLine.y1,
|
||||
shape.transformY1(backgroundColor.brighter().brighter(), backgroundColor),
|
||||
gradientLine.x2, gradientLine.y2,
|
||||
shape.transformY1(backgroundColor, backgroundColor.brighter().brighter()));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.LightColors;
|
||||
@@ -113,7 +114,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
|
||||
private void resetAnimator() {
|
||||
myAnimator.reset();
|
||||
if (scrollbar != null && scrollbar.getValueIsAdjusting() || myMouseIsOverThumb) {
|
||||
if (scrollbar != null && scrollbar.getValueIsAdjusting() || myMouseIsOverThumb || Registry.is("ui.no.bangs.and.whistles")) {
|
||||
myAnimator.suspend();
|
||||
myAnimationColorShift = ANIMATION_COLOR_SHIFT;
|
||||
}
|
||||
@@ -262,15 +263,15 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
|
||||
w -= 1;
|
||||
}
|
||||
|
||||
final GradientPaint paint;
|
||||
final Paint paint;
|
||||
final Color start = adjustColor(getGradientLightColor());
|
||||
final Color end = adjustColor(getGradientDarkColor());
|
||||
|
||||
if (vertical) {
|
||||
paint = new GradientPaint(1, 0, start, w + 1, 0, end);
|
||||
paint = UIUtil.getGradientPaint(1, 0, start, w + 1, 0, end);
|
||||
}
|
||||
else {
|
||||
paint = new GradientPaint(0, 1, start, 0, h + 1, end);
|
||||
paint = UIUtil.getGradientPaint(0, 1, start, 0, h + 1, end);
|
||||
}
|
||||
|
||||
g.setPaint(paint);
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.intellij.ide.ui.laf.darcula;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
@@ -42,7 +43,7 @@ public class DarculaTableHeaderUI extends BasicTableHeaderUI {
|
||||
final Graphics2D g = (Graphics2D)g2;
|
||||
final GraphicsConfig config = new GraphicsConfig(g);
|
||||
final Color bg = c.getBackground();
|
||||
g.setPaint(new GradientPaint(0,0, ColorUtil.shift(bg, 1.4), 0,c.getHeight(), ColorUtil.shift(bg, 0.9)));
|
||||
g.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(bg, 1.4), 0, c.getHeight(), ColorUtil.shift(bg, 0.9)));
|
||||
final int h = c.getHeight();
|
||||
final int w = c.getWidth();
|
||||
g.fillRect(0,0, w, h);
|
||||
|
||||
+3
-1
@@ -18,6 +18,7 @@ package com.intellij.ide.ui.laf.darcula.ui;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.InsetsUIResource;
|
||||
@@ -42,7 +43,8 @@ public class DarculaButtonPainter implements Border, UIResource {
|
||||
final GraphicsConfig config = new GraphicsConfig(g);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
|
||||
g2d.setPaint(new GradientPaint(width / 2, y + yOff + 1, Gray._80.withAlpha(90), width / 2, height - 2*yOff, Gray._90.withAlpha(90)));
|
||||
g2d.setPaint(
|
||||
UIUtil.getGradientPaint(width / 2, y + yOff + 1, Gray._80.withAlpha(90), width / 2, height - 2 * yOff, Gray._90.withAlpha(90)));
|
||||
//g.drawRoundRect(x + offset + 1, y + yOff + 1, width - 2 * offset, height - 2*yOff, 5, 5);
|
||||
|
||||
((Graphics2D)g).setPaint(Gray._100.withAlpha(180));
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ide.ui.laf.darcula.ui;
|
||||
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
@@ -37,10 +39,10 @@ public class DarculaButtonUI extends BasicButtonUI {
|
||||
final Insets ins = border.getBorderInsets(c);
|
||||
final int yOff = (ins.top + ins.bottom) / 4;
|
||||
if (((JButton)c).isDefaultButton()) {
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, new Color(0x384F6B), 0, c.getHeight(), new Color(0x233143)));
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, new Color(0x384F6B), 0, c.getHeight(), new Color(0x233143)));
|
||||
}
|
||||
else {
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, new Color(85, 90, 92), 0, c.getHeight(), new Color(65, 70, 72)));
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, new Color(85, 90, 92), 0, c.getHeight(), new Color(65, 70, 72)));
|
||||
}
|
||||
g.fillRoundRect(4, yOff, c.getWidth() - 2 * 4, c.getHeight() - 2 * yOff, 5, 5);
|
||||
}
|
||||
|
||||
+4
-4
@@ -81,7 +81,7 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
final int u = 1;
|
||||
|
||||
g.translate(x, y);
|
||||
final GradientPaint paint = new GradientPaint(w / 2, 0, b.getBackground().brighter(),
|
||||
final Paint paint = UIUtil.getGradientPaint(w / 2, 0, b.getBackground().brighter(),
|
||||
w / 2, h, b.getBackground());
|
||||
g.setPaint(paint);
|
||||
g.fillRect(u, u, w - 2 * u, h - 2 * u);
|
||||
@@ -94,15 +94,15 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
final boolean armed = b.getModel().isArmed();
|
||||
|
||||
if (c.hasFocus()) {
|
||||
g.setPaint(new GradientPaint(w/2, 1, armed ? Gray._100: Gray._120, w/2, h, armed ? Gray._55 : Gray._75));
|
||||
g.setPaint(UIUtil.getGradientPaint(w/2, 1, armed ? Gray._100: Gray._120, w/2, h, armed ? Gray._55 : Gray._75));
|
||||
g.fillRoundRect(0, 0, w - 2, h - 2, 4, 4);
|
||||
|
||||
DarculaUIUtil.paintFocusRing(g, 1, 1, w - 2, h - 2);
|
||||
} else {
|
||||
g.setPaint(new GradientPaint(w / 2, 1, Gray._110, w / 2, h, Gray._95));
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, Gray._110, w / 2, h, Gray._95));
|
||||
g.fillRoundRect(0, 0, w , h , 4, 4);
|
||||
|
||||
g.setPaint(new GradientPaint(w / 2, 1, Gray._120.withAlpha(90), w / 2, h, Gray._105.withAlpha(90)));
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, Gray._120.withAlpha(90), w / 2, h, Gray._105.withAlpha(90)));
|
||||
g.drawRoundRect(0, 1, w, h - 1, 4, 4);
|
||||
|
||||
g.setPaint(Gray._40.withAlpha(180));
|
||||
|
||||
+4
-2
@@ -22,6 +22,7 @@ import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -86,7 +87,8 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
|
||||
|
||||
//setup AA for lines
|
||||
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
|
||||
g.setPaint(new GradientPaint(0, 0, ColorUtil.shift(c.getBackground(), 1.5), 0, c.getHeight(), ColorUtil.shift(c.getBackground(), 1.2)));
|
||||
g.setPaint(
|
||||
UIUtil.getGradientPaint(0, 0, ColorUtil.shift(c.getBackground(), 1.5), 0, c.getHeight(), ColorUtil.shift(c.getBackground(), 1.2)));
|
||||
g.fillOval(0, 1, w - 1, h - 1);
|
||||
|
||||
if (b.hasFocus()) {
|
||||
@@ -94,7 +96,7 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
|
||||
int sysOffY = SystemInfo.isMac ? 0 : -1;
|
||||
DarculaUIUtil.paintFocusOval(g, x-6 + sysOffX, y-3 + sysOffY, w-2, h-2);
|
||||
} else {
|
||||
g.setPaint(new GradientPaint(w / 2, 1, Gray._160.withAlpha(90), w / 2, h, Gray._100.withAlpha(90)));
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, Gray._160.withAlpha(90), w / 2, h, Gray._100.withAlpha(90)));
|
||||
g.drawOval(0, 2, w - 1, h - 1);
|
||||
|
||||
g.setPaint(Gray._40.withAlpha(200));
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ public class IdeaActionButtonLook extends ActionButtonLook {
|
||||
|
||||
if (UIUtil.isUnderAquaLookAndFeel()) {
|
||||
if (state == ActionButtonComponent.PUSHED) {
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, ALPHA_40, dimension.width, dimension.height, ALPHA_20));
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, dimension.width, dimension.height, ALPHA_20));
|
||||
g.fillRect(0, 0, dimension.width - 1, dimension.height - 1);
|
||||
|
||||
g.setColor(ALPHA_120);
|
||||
@@ -53,7 +53,7 @@ public class IdeaActionButtonLook extends ActionButtonLook {
|
||||
g.drawRect(1, 1, dimension.width - 3, dimension.height - 3);
|
||||
}
|
||||
else if (state == ActionButtonComponent.POPPED) {
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, Gray._235, 0, dimension.height, Gray._200));
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, dimension.height, Gray._200));
|
||||
g.fillRect(1, 1, dimension.width - 3, dimension.height - 3);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class EditorHeaderComponent extends JPanel {
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
if (!UIUtil.isUnderGTKLookAndFeel()) {
|
||||
g2d.setPaint(new GradientPaint(0, 0, GRADIENT_C1, 0, getHeight(), GRADIENT_C2));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, GRADIENT_C1, 0, getHeight(), GRADIENT_C2));
|
||||
g2d.fillRect(1, 1, getWidth(), getHeight() - 1);
|
||||
g2d.setPaint(null);
|
||||
}
|
||||
|
||||
@@ -586,13 +586,13 @@ final class Stripe extends JPanel{
|
||||
if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) {
|
||||
bg = (BufferedImage) createImage(bounds.width, 50);
|
||||
Graphics2D graphics = bg.createGraphics();
|
||||
graphics.setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 10), bounds.width, 0, new Color(0, 0, 0, 0)));
|
||||
graphics.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 10), bounds.width, 0, new Color(0, 0, 0, 0)));
|
||||
graphics.fillRect(0, 0, bounds.width, 50);
|
||||
graphics.dispose();
|
||||
} else {
|
||||
bg = (BufferedImage) createImage(50, bounds.height);
|
||||
Graphics2D graphics = bg.createGraphics();
|
||||
graphics.setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 0), 0, bounds.height, new Color(0, 0, 0, 10)));
|
||||
graphics.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 0), 0, bounds.height, new Color(0, 0, 0, 10)));
|
||||
graphics.fillRect(0, 0, 50, bounds.height);
|
||||
graphics.dispose();
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ class ComboContentLayout extends ContentLayout {
|
||||
final GraphicsConfig c = new GraphicsConfig(g);
|
||||
c.setAntialiasing(true);
|
||||
|
||||
g2d.setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 10), 0, r.height, new Color(0, 0, 0, 30)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 10), 0, r.height, new Color(0, 0, 0, 30)));
|
||||
g2d.fillRect(0, 0, r.width, r.height);
|
||||
|
||||
g2d.setColor(new Color(0, 0, 0, 60));
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.awt.RelativeRectangle;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManagerEvent;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
@@ -87,15 +88,16 @@ abstract class ContentLayout {
|
||||
protected void fillTabShape(Graphics2D g2d, Shape shape, boolean isSelected, Rectangle bounds) {
|
||||
if (myUi.myWindow.isActive()) {
|
||||
if (isSelected) {
|
||||
g2d.setPaint(new GradientPaint(bounds.x, bounds.y, TAB_BG_ACTIVE_WND_SELECTED_FROM, bounds.x, (float)bounds.getMaxY(), TAB_BG_ACTIVE_WND_SELECTED_TO));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(bounds.x, bounds.y, TAB_BG_ACTIVE_WND_SELECTED_FROM, bounds.x, (float)bounds.getMaxY(),
|
||||
TAB_BG_ACTIVE_WND_SELECTED_TO));
|
||||
}
|
||||
else {
|
||||
g2d.setPaint(new GradientPaint(bounds.x, bounds.y, TAB_BG_ACTIVE_WND_UNSELECTED_FROM, bounds.x, (float)bounds.getMaxY(), TAB_BG_ACTIVE_WND_UNSELECTED_TO));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(bounds.x, bounds.y, TAB_BG_ACTIVE_WND_UNSELECTED_FROM, bounds.x, (float)bounds.getMaxY(), TAB_BG_ACTIVE_WND_UNSELECTED_TO));
|
||||
}
|
||||
}
|
||||
else {
|
||||
g2d.setPaint(
|
||||
new GradientPaint(bounds.x, bounds.y, TAB_BG_PASSIVE_WND_FROM, bounds.x, (float)bounds.getMaxY(), TAB_BG_PASSIVE_WND_TO));
|
||||
UIUtil.getGradientPaint(bounds.x, bounds.y, TAB_BG_PASSIVE_WND_FROM, bounds.x, (float)bounds.getMaxY(), TAB_BG_PASSIVE_WND_TO));
|
||||
}
|
||||
|
||||
g2d.fill(shape);
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ class TabContentLayout extends ContentLayout {
|
||||
}
|
||||
}
|
||||
else {
|
||||
g2d.setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 10), 0, r.height, new Color(0, 0, 0, 30)));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, new Color(0, 0, 0, 10), 0, r.height, new Color(0, 0, 0, 30)));
|
||||
g2d.fillRect(0, 0, r.width, r.height);
|
||||
|
||||
final Color c = new Color(255, 255, 255, UIUtil.isUnderDarcula() ? 10 : 80);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class MacStatusBarUI extends StatusBarUI implements Activatable {
|
||||
final Color top = active ? ACTIVE_TOP_COLOR : INACTIVE_TOP_COLOR;
|
||||
final Color bottom = active ? ACTIVE_BOTTOM_COLOR : INACTIVE_BOTTOM_COLOR;
|
||||
|
||||
final GradientPaint paint = new GradientPaint(0, 0, top, 0, height, bottom);
|
||||
final Paint paint = UIUtil.getGradientPaint(0, 0, top, 0, height, bottom);
|
||||
g.setPaint(paint);
|
||||
g.fillRect(0, 0, width, height);
|
||||
|
||||
|
||||
+3
-3
@@ -148,7 +148,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
|
||||
g2.setColor(UIUtil.getControlColor());
|
||||
}
|
||||
else {
|
||||
g2.setPaint(new GradientPaint(0, 0, new JBColor(Gray._190, Gray._120), 0, barHeight, new JBColor(Gray._230, Gray._160)));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, new JBColor(Gray._190, Gray._120), 0, barHeight, new JBColor(Gray._230, Gray._160)));
|
||||
}
|
||||
g2.fillRect(xOffset, yOffset, totalBarLength, barHeight);
|
||||
|
||||
@@ -194,10 +194,10 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget {
|
||||
end = end.darker();
|
||||
}
|
||||
if (invert) {
|
||||
g2.setPaint(new GradientPaint(0, 0, end, 0, height, start));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, end, 0, height, start));
|
||||
}
|
||||
else {
|
||||
g2.setPaint(new GradientPaint(0, 0, start, 0, height, end));
|
||||
g2.setPaint(UIUtil.getGradientPaint(0, 0, start, 0, height, end));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ public abstract class AppIcon {
|
||||
appImg.myG2d.setColor(backGround);
|
||||
appImg.myG2d.fill(rect);
|
||||
final Color color = isOk ? scheme.getOkColor() : scheme.getErrorColor();
|
||||
final GradientPaint paint = new GradientPaint(xInset + 1, y + 1, color.brighter(),
|
||||
final Paint paint = UIUtil.getGradientPaint(xInset + 1, y + 1, color.brighter(),
|
||||
xInset + 1, y + progressHeight - 1, color.darker().darker());
|
||||
appImg.myG2d.setPaint(paint);
|
||||
appImg.myG2d.fill(progress);
|
||||
|
||||
@@ -203,7 +203,7 @@ class SlideComponent extends JComponent {
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
if (myVertical) {
|
||||
g2d.setPaint(new GradientPaint(0f, 0f, Color.WHITE, 0f, getHeight(), Color.BLACK));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0f, 0f, Color.WHITE, 0f, getHeight(), Color.BLACK));
|
||||
g.fillRect(7, 10, 12, getHeight() - 20);
|
||||
|
||||
g.setColor(Gray._150);
|
||||
@@ -213,7 +213,7 @@ class SlideComponent extends JComponent {
|
||||
g.drawRect(8, 11, 10, getHeight() - 22);
|
||||
}
|
||||
else {
|
||||
g2d.setPaint(new GradientPaint(0f, 0f, Color.WHITE, getWidth(), 0f, Color.BLACK));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0f, 0f, Color.WHITE, getWidth(), 0f, Color.BLACK));
|
||||
g.fillRect(10, 7, getWidth() - 20, 12);
|
||||
|
||||
g.setColor(Gray._150);
|
||||
|
||||
@@ -272,4 +272,5 @@ new.project.wizard=false
|
||||
new.ruby.sdk.configurable=false
|
||||
diagrams.rendering.no.cache=true
|
||||
|
||||
wolf.the.problem.solver=true
|
||||
wolf.the.problem.solver=true
|
||||
ui.no.bangs.and.whistles=false
|
||||
|
||||
@@ -67,14 +67,14 @@ public class CaptionPanel extends JPanel {
|
||||
g.drawLine(0, 0, getWidth(), 0);
|
||||
g.setColor(BOTTOM_FLICK_ACTIVE);
|
||||
g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
||||
g2d.setPaint(new GradientPaint(0, 0, BND_ACTIVE_COLOR, 0, getHeight(), CNT_ACTIVE_COLOR));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, BND_ACTIVE_COLOR, 0, getHeight(), CNT_ACTIVE_COLOR));
|
||||
}
|
||||
else {
|
||||
g.setColor(TOP_FLICK_PASSIVE);
|
||||
g.drawLine(0, 0, getWidth(), 0);
|
||||
g.setColor(BOTTOM_FLICK_PASSIVE);
|
||||
g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
||||
g2d.setPaint(new GradientPaint(0, 0, BND_COLOR, 0, getHeight(), CNT_COLOR));
|
||||
g2d.setPaint(UIUtil.getGradientPaint(0, 0, BND_COLOR, 0, getHeight(), CNT_COLOR));
|
||||
}
|
||||
|
||||
g2d.fillRect(0, 1, getWidth(), getHeight() - 2);
|
||||
@@ -86,14 +86,14 @@ public class CaptionPanel extends JPanel {
|
||||
g.drawLine(0, 0, getWidth(), 0);
|
||||
g.setColor(Gray._50);
|
||||
g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
||||
g.setPaint(new GradientPaint(0, 0, Gray._100, 0, getHeight(), Gray._85));
|
||||
g.setPaint(UIUtil.getGradientPaint(0, 0, Gray._100, 0, getHeight(), Gray._85));
|
||||
}
|
||||
else {
|
||||
g.setColor(Gray._100);
|
||||
g.drawLine(0, 0, getWidth(), 0);
|
||||
g.setColor(Gray._50);
|
||||
g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
|
||||
g.setPaint(new GradientPaint(0, 0, Gray._120, 0, getHeight(), Gray._105));
|
||||
g.setPaint(UIUtil.getGradientPaint(0, 0, Gray._120, 0, getHeight(), Gray._105));
|
||||
}
|
||||
|
||||
g.fillRect(0, 1, getWidth(), getHeight() - 2);
|
||||
|
||||
@@ -132,13 +132,12 @@ public class ColorUtil {
|
||||
return (1 - (0.299 * c.getRed() + 0.587 * c.getGreen() + 0.114 * c.getBlue()) / 255) >= 0.5;
|
||||
}
|
||||
|
||||
public static Color mix(Color c1, Color c2, float balance) {
|
||||
assert balance >= 0 && balance <= 1 : "balance should be in 0..1";
|
||||
float[] rgbs1 = c1.getRGBComponents(null);
|
||||
float[] rgbs2 = c2.getRGBComponents(null);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
rgbs1[i] = rgbs1[i] * (1 - balance) + rgbs2[i] * balance;
|
||||
}
|
||||
return new Color(rgbs1[0], rgbs1[1], rgbs1[2], rgbs1[3]);
|
||||
@NotNull
|
||||
public static Color mix(@NotNull Color c1, @NotNull Color c2, double balance) {
|
||||
balance = Math.min(1, Math.max(0, balance));
|
||||
return new Color((int)((1 - balance) * c1.getRed() + c2.getRed() * balance + .5),
|
||||
(int)((1 - balance) * c1.getGreen() + c2.getGreen() * balance + .5),
|
||||
(int)((1 - balance) * c1.getBlue() + c2.getBlue() * balance + .5),
|
||||
(int)((1 - balance) * c1.getAlpha() + c2.getAlpha() * balance + .5));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,9 @@ public class MacUIUtil {
|
||||
public static void drawToolbarDecoratorBackground(Graphics g2, int width, int height) {
|
||||
final Graphics2D g = (Graphics2D)g2;
|
||||
final int h1 = height / 2;
|
||||
g.setPaint(new GradientPaint(0,0, Gray._247, 0, h1, Gray._240));
|
||||
g.setPaint(UIUtil.getGradientPaint(0,0, Gray._247, 0, h1, Gray._240));
|
||||
g.fillRect(0, 0, width, h1);
|
||||
g.setPaint(new GradientPaint(0,h1, Gray._229, 0, height, Gray._234));
|
||||
g.setPaint(UIUtil.getGradientPaint(0,h1, Gray._229, 0, height, Gray._234));
|
||||
g.fillRect(0, h1, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -1250,7 +1250,7 @@ public class UIUtil {
|
||||
|
||||
final Composite oldComposite = g.getComposite();
|
||||
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
|
||||
g.setPaint(new GradientPaint(startX, 2, c1, startX, height - 5, c2));
|
||||
g.setPaint(getGradientPaint(startX, 2, c1, startX, height - 5, c2));
|
||||
g.fillRect(startX, 3, endX - startX, height - 5);
|
||||
|
||||
if (drawRound) {
|
||||
@@ -1315,8 +1315,7 @@ public class UIUtil {
|
||||
|
||||
public static void drawGradientHToolbarBackground(final Graphics g, final int width, final int height) {
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
final GradientPaint gradientPaint = new GradientPaint(0, 0, Gray._215, 0, height, Gray._200);
|
||||
g2d.setPaint(gradientPaint);
|
||||
g2d.setPaint(getGradientPaint(0, 0, Gray._215, 0, height, Gray._200));
|
||||
g2d.fillRect(0, 0, width, height);
|
||||
}
|
||||
|
||||
@@ -1334,7 +1333,7 @@ public class UIUtil {
|
||||
g.setColor(getPanelBackground());
|
||||
g.fillRect(x, 0, width, height);
|
||||
|
||||
((Graphics2D)g).setPaint(new GradientPaint(0, 0, new Color(0, 0, 0, 5), 0, height, new Color(0, 0, 0, 20)));
|
||||
((Graphics2D)g).setPaint(getGradientPaint(0, 0, new Color(0, 0, 0, 5), 0, height, new Color(0, 0, 0, 20)));
|
||||
g.fillRect(x, 0, width, height);
|
||||
|
||||
g.setColor(new Color(0, 0, 0, toolWindow ? 90 : 50));
|
||||
@@ -2599,4 +2598,9 @@ public class UIUtil {
|
||||
public static Color getDecoratedRowColor() {
|
||||
return isUnderDarcula() ? DECORATED_ROW_BG_COLOR_DARK : DECORATED_ROW_BG_COLOR;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Paint getGradientPaint(float x1, float y1, @NotNull Color c1, float x2, float y2, @NotNull Color c2) {
|
||||
return (Registry.is("ui.no.bangs.and.whistles", false)) ? ColorUtil.mix(c1, c2, .5) : new GradientPaint(x1, y1, c1, x2, y2, c2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static com.intellij.ui.ColorUtil.*;
|
||||
|
||||
/**
|
||||
* User: Vassiliy.Kudryashov
|
||||
*/
|
||||
public class ColorUtilTest extends TestCase {
|
||||
public void testColorMix() {
|
||||
assertEquals(Color.GRAY, mix(Color.BLACK, Color.WHITE, .5));
|
||||
assertEquals(Color.LIGHT_GRAY, mix(Color.BLACK, Color.WHITE, .751));
|
||||
assertEquals(Color.BLACK, mix(Color.BLACK, Color.WHITE, 0));
|
||||
assertEquals(Color.WHITE, mix(Color.BLACK, Color.WHITE, 1));
|
||||
assertEquals(Color.WHITE, mix(Color.WHITE, Color.WHITE, 0));
|
||||
assertEquals(Color.WHITE, mix(Color.WHITE, Color.WHITE, .5));
|
||||
assertEquals(withAlpha(Color.GRAY, .17), mix(withAlpha(Color.WHITE, .17), withAlpha(Color.BLACK, .17), .5));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user