本文整理汇总了Java中com.intellij.ui.ColorUtil.toAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java ColorUtil.toAlpha方法的具体用法?Java ColorUtil.toAlpha怎么用?Java ColorUtil.toAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.ColorUtil
的用法示例。
在下文中一共展示了ColorUtil.toAlpha方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDialogBalloonBuilder
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
@Override
public BalloonBuilder createDialogBalloonBuilder(@NotNull JComponent content, String title) {
final BalloonPopupBuilderImpl builder = new BalloonPopupBuilderImpl(myStorage, content);
final Color bg = UIManager.getColor("Panel.background");
final Color borderOriginal = Color.darkGray;
final Color border = ColorUtil.toAlpha(borderOriginal, 75);
builder
.setDialogMode(true)
.setTitle(title)
.setAnimationCycle(200)
.setFillColor(bg).setBorderColor(border).setHideOnClickOutside(false)
.setHideOnKeyOutside(false)
.setHideOnAction(false)
.setCloseButtonEnabled(true)
.setShadow(true);
return builder;
}
示例2: paint
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public void paint(Editor editor, Graphics g, Rectangle r) {
final TextAttributes color = editor.getColorsScheme().getAttributes(myKey);
Color bgColor = color.getBackgroundColor();
if (bgColor == null) {
bgColor = color.getForegroundColor();
}
if (editor.getSettings().isLineNumbersShown() || ((EditorGutterComponentEx)editor.getGutter()).isAnnotationsShown()) {
if (bgColor != null) {
bgColor = ColorUtil.toAlpha(bgColor, 150);
}
}
if (bgColor != null) {
g.setColor(bgColor);
}
g.fillRect(r.x, r.y, r.width, r.height);
final LineData lineData = getLineData(editor.xyToLogicalPosition(new Point(0, r.y)).line);
if (lineData != null && lineData.isCoveredByOneTest()) {
g.drawImage( ImageLoader.loadFromResource("/gutter/unique.png"), r.x, r.y, 8, 8, editor.getComponent());
}
}
示例3: createDialogBalloonBuilder
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@NotNull
@Override
public BalloonBuilder createDialogBalloonBuilder(@NotNull JComponent content, String title) {
final BalloonPopupBuilderImpl builder = new BalloonPopupBuilderImpl(myStorage, content);
final Color bg = UIManager.getColor("Panel.background");
final Color borderOriginal = Color.darkGray;
final Color border = ColorUtil.toAlpha(borderOriginal, 75);
builder
.setDialogMode(true)
.setTitle(title)
.setAnimationCycle(200)
.setFillColor(bg)
.setBorderColor(border)
.setHideOnClickOutside(false)
.setHideOnKeyOutside(false)
.setHideOnAction(false)
.setCloseButtonEnabled(true)
.setShadow(true);
return builder;
}
示例4: createDialogBalloonBuilder
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Nonnull
@Override
public BalloonBuilder createDialogBalloonBuilder(@Nonnull JComponent content, String title) {
final BalloonPopupBuilderImpl builder = new BalloonPopupBuilderImpl(myStorage, content);
final Color bg = UIManager.getColor("Panel.background");
final Color borderOriginal = Color.darkGray;
final Color border = ColorUtil.toAlpha(borderOriginal, 75);
builder
.setDialogMode(true)
.setTitle(title)
.setAnimationCycle(200)
.setFillColor(bg).setBorderColor(border).setHideOnClickOutside(false)
.setHideOnKeyOutside(false)
.setHideOnAction(false)
.setCloseButtonEnabled(true)
.setShadow(true);
return builder;
}
示例5: paintComponent
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
protected void paintComponent(final Graphics g) {
if (myCompact) {
super.paintComponent(g);
return;
}
final GraphicsConfig c = GraphicsUtil.setupAAPainting(g);
UISettings.setupAntialiasing(g);
int arc = 8;
Color bg = getBackground();
final Rectangle bounds = myProcessName.getBounds();
final Rectangle label = SwingUtilities.convertRectangle(myProcessName.getParent(), bounds, this);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
if (!UIUtil.isUnderDarcula()) {
bg = ColorUtil.toAlpha(bg.darker().darker(), 230);
g.setColor(bg);
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, getHeight() / 2, getWidth() - 1, getHeight() / 2, arc, arc);
g.fillRect(0, (int)label.getMaxY() + 1, getWidth() - 1, getHeight() / 2);
} else {
bg = bg.brighter();
g.setColor(bg);
g.drawLine(0, (int)label.getMaxY() + 1, getWidth() - 1, (int)label.getMaxY() + 1);
}
g.setColor(bg);
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
c.restore();
}
示例6: paintFocusRing
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public static void paintFocusRing(Graphics2D g, Color ringColor, Rectangle bounds, boolean oval) {
int correction = UIUtil.isUnderDarcula() ? 50 : 0;
final Color[] colors = new Color[]{
ColorUtil.toAlpha(ringColor, 180 - correction),
ColorUtil.toAlpha(ringColor, 120 - correction),
ColorUtil.toAlpha(ringColor, 70 - correction),
ColorUtil.toAlpha(ringColor, 100 - correction),
ColorUtil.toAlpha(ringColor, 50 - correction)
};
final Object oldAntialiasingValue = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Object oldStrokeControlValue = g.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, !oval &&
USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
final Rectangle r = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6);
g.setColor(colors[0]);
drawRectOrOval(g, oval, 5, r.x + 2, r.y + 2, r.width - 5, r.height - 5);
g.setColor(colors[1]);
drawRectOrOval(g, oval, 7, r.x + 1, r.y + 1, r.width - 3, r.height - 3);
g.setColor(colors[2]);
drawRectOrOval(g, oval, 9, r.x, r.y, r.width - 1, r.height - 1);
g.setColor(colors[3]);
drawRectOrOval(g, oval, 0, r.x + 3, r.y + 3, r.width - 7, r.height - 7);
g.setColor(colors[4]);
drawRectOrOval(g, oval, 0, r.x + 4, r.y + 4, r.width - 9, r.height - 9);
// restore rendering hints
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAntialiasingValue);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
}
示例7: paintComponent
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
protected void paintComponent(final Graphics g) {
if (myCompact) {
super.paintComponent(g);
return;
}
final GraphicsConfig c = GraphicsUtil.setupAAPainting(g);
GraphicsUtil.setupAntialiasing(g, true, true);
int arc = 8;
Color bg = getBackground();
final Rectangle bounds = myProcessName.getBounds();
final Rectangle label = SwingUtilities.convertRectangle(myProcessName.getParent(), bounds, this);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
if (!UIUtil.isUnderDarcula()) {
bg = ColorUtil.toAlpha(bg.darker().darker(), 230);
g.setColor(bg);
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, getHeight() / 2, getWidth() - 1, getHeight() / 2, arc, arc);
g.fillRect(0, (int)label.getMaxY() + 1, getWidth() - 1, getHeight() / 2);
} else {
bg = bg.brighter();
g.setColor(bg);
g.drawLine(0, (int)label.getMaxY() + 1, getWidth() - 1, (int)label.getMaxY() + 1);
}
g.setColor(bg);
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
c.restore();
}
示例8: paintSearchFocusRing
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public static void paintSearchFocusRing(Graphics2D g, Rectangle bounds) {
int correction = UIUtil.isUnderDarcula() ? 50 : 0;
final Color[] colors = new Color[]{
ColorUtil.toAlpha(GLOW_COLOR, 180 - correction),
ColorUtil.toAlpha(GLOW_COLOR, 120 - correction),
ColorUtil.toAlpha(GLOW_COLOR, 70 - correction),
ColorUtil.toAlpha(GLOW_COLOR, 100 - correction),
ColorUtil.toAlpha(GLOW_COLOR, 50 - correction)
};
final Object oldAntialiasingValue = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Object oldStrokeControlValue = g.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
final Rectangle r = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6);
g.setColor(colors[0]);
g.drawRoundRect(r.x + 2, r.y + 2, r.width - 5, r.height - 5, r.height - 5, r.height - 5);
g.setColor(colors[1]);
g.drawRoundRect(r.x + 1, r.y + 1, r.width - 3, r.height - 3, r.height - 3, r.height - 3);
g.setColor(colors[2]);
g.drawRoundRect(r.x, r.y, r.width - 1, r.height - 1, r.height - 1, r.height - 1);
g.setColor(colors[3]);
g.drawRoundRect(r.x+3, r.y+3, r.width - 7, r.height - 7, r.height - 7, r.height - 7);
g.setColor(colors[4]);
g.drawRoundRect(r.x+4, r.y+4, r.width - 9, r.height - 9, r.height - 9, r.height - 9);
// restore rendering hints
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAntialiasingValue);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
}
示例9: getFileColor
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
public Color getFileColor(@NotNull final VirtualFile file) {
Color color = super.getFileColor(file);
if (myProblemSolver.isProblemFile(file)) {
return ColorUtil.toAlpha(color, WaverGraphicsDecorator.WAVE_ALPHA_KEY);
}
return color;
}
示例10: paintComponent
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
@Override
protected void paintComponent(final Graphics g) {
if (myCompact) {
super.paintComponent(g);
return;
}
final GraphicsConfig c = GraphicsUtil.setupAAPainting(g);
UISettings.setupAntialiasing(g);
int arc = 8;
Color bg = getBackground();
final Rectangle bounds = myProcessName.getBounds();
final Rectangle label = SwingUtilities.convertRectangle(myProcessName.getParent(), bounds, this);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
if (!UIUtil.isUnderDarcula()) {
bg = ColorUtil.toAlpha(bg.darker().darker(), 230);
g.setColor(bg);
g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
g.setColor(UIUtil.getPanelBackground());
g.fillRoundRect(0, getHeight() / 2, getWidth() - 1, getHeight() / 2, arc, arc);
g.fillRect(0, (int)label.getMaxY() + 1, getWidth() - 1, getHeight() / 2);
}
else {
bg = bg.brighter();
g.setColor(bg);
g.drawLine(0, (int)label.getMaxY() + 1, getWidth() - 1, (int)label.getMaxY() + 1);
}
g.setColor(bg);
g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, arc, arc);
c.restore();
}
示例11: getMarkerForeground
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
protected Color getMarkerForeground(Crumb crumb) {
if (!EDITOR_BREADCRUMBS_MARKER) return null;
CrumbView found = getCrumbView(view -> view.crumb == crumb);
Color foreground = found == null ? null : found.foreground;
if (foreground == null) return null;
double alpha = 0.6;
return ColorUtil.toAlpha(foreground, (int)(alpha * foreground.getAlpha()));
}
示例12: paintFocusRing
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public static void paintFocusRing(Graphics2D g, Color ringColor, Rectangle bounds, boolean oval) {
int correction = UIUtil.isUnderDarcula() ? 50 : 0;
final Color[] colors = new Color[]{ColorUtil.toAlpha(ringColor, 180 - correction), ColorUtil.toAlpha(ringColor, 120 - correction),
ColorUtil.toAlpha(ringColor, 70 - correction), ColorUtil.toAlpha(ringColor, 100 - correction), ColorUtil.toAlpha(ringColor, 50 - correction)};
final Object oldAntialiasingValue = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Object oldStrokeControlValue = g.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, !oval && USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
final Rectangle r = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6);
g.setColor(colors[0]);
drawRectOrOval(g, oval, 5, r.x + 2, r.y + 2, r.width - 5, r.height - 5);
g.setColor(colors[1]);
drawRectOrOval(g, oval, 7, r.x + 1, r.y + 1, r.width - 3, r.height - 3);
g.setColor(colors[2]);
drawRectOrOval(g, oval, 9, r.x, r.y, r.width - 1, r.height - 1);
g.setColor(colors[3]);
drawRectOrOval(g, oval, 0, r.x + 3, r.y + 3, r.width - 7, r.height - 7);
g.setColor(colors[4]);
drawRectOrOval(g, oval, 0, r.x + 4, r.y + 4, r.width - 9, r.height - 9);
// restore rendering hints
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAntialiasingValue);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
}
示例13: paintComponent
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
protected void paintComponent(Graphics g) {
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
Graphics2D g2 = (Graphics2D)g;
if (myFraction > 1) {
myFraction = 1;
}
Dimension size = getSize();
double width = size.getWidth() - 2*myIndent;
g2.setPaint(UIUtil.getTextFieldBackground());
Rectangle2D rect = new Rectangle2D.Double(myIndent, 0, width, myHeight);
g2.fill(rect);
g2.setPaint(new JBColor(SHADOW1, JBColor.border()));
rect.setRect(myIndent, 0, width, myHeight);
int arcWidth = 5;
int arcHeight = 5;
g2.drawRoundRect(myIndent, 0, (int)width, myHeight, arcWidth, arcHeight);
g2.setPaint(SHADOW2);
int y_center = myHeight / 2;
int y_steps = myHeight / 2 - 3;
int alpha_step = y_steps > 0 ? (255 - 70) / y_steps : 255 - 70;
int x_offset = 4;
g.setClip(4 + myIndent, 3, (int)width - 6, myHeight - 4);
int bricksToDraw = myFraction == 0 ? 0 : getBricksToDraw(myFraction);
for (int i = 0; i < bricksToDraw; i++) {
g2.setPaint(myColor);
UIUtil.drawLine(g2, x_offset, y_center, x_offset + BRICK_WIDTH - 1, y_center);
for (int j = 0; j < y_steps; j++) {
Color color = ColorUtil.toAlpha(myColor, 255 - alpha_step * (j + 1));
g2.setPaint(color);
UIUtil.drawLine(g2, x_offset, y_center - 1 - j, x_offset + BRICK_WIDTH - 1, y_center - 1 - j);
if (!(y_center % 2 != 0 && j == y_steps - 1)) {
UIUtil.drawLine(g2, x_offset, y_center + 1 + j, x_offset + BRICK_WIDTH - 1, y_center + 1 + j);
}
}
g2.setColor(
ColorUtil.toAlpha(myColor, 255 - alpha_step * (y_steps / 2 + 1)));
g2.drawRect(x_offset, y_center - y_steps, BRICK_WIDTH - 1, myHeight - 7);
x_offset += BRICK_WIDTH + BRICK_SPACE;
}
config.restore();
}
示例14: paintGradient
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
private void paintGradient(Graphics2D g2d, Color background, int x1, int y1) {
Component view = getView();
if (background != null && view != null) {
int x2 = x1, x3 = getWidth() - x2, x4 = x3;
int y2 = y1, y3 = getHeight() - y2, y4 = y3;
if (myInsets.left > 0 && view.getX() < 0) {
x2 += myInsets.left;
}
if (myInsets.top > 0 && view.getY() < 0) {
y2 += myInsets.top;
}
if (myInsets.right > 0 && view.getX() > getWidth() - view.getWidth()) {
x3 -= myInsets.right;
}
if (myInsets.bottom > 0 && view.getY() > getHeight() - view.getHeight()) {
y3 -= myInsets.bottom;
}
Component parent = myAlways ? null : getParent();
if (parent instanceof JScrollPane) {
JScrollPane pane = (JScrollPane)parent;
JScrollBar vBar = pane.getVerticalScrollBar();
if (vBar != null && vBar.isVisible()) {
if (vBar.getX() < getX()) {
x2 = x1;
}
else {
x3 = x4;
}
}
JScrollBar hBar = pane.getHorizontalScrollBar();
if (hBar != null && hBar.isVisible()) {
if (hBar.getY() < getY()) {
y2 = y1;
}
else {
y3 = y4;
}
}
}
Color transparent = ColorUtil.toAlpha(background, 0);
if (x1 != x2) {
g2d.setPaint(new GradientPaint(x1, y1, background, x2, y1, transparent));
g2d.fillPolygon(new int[]{x1, x2, x2, x1}, new int[]{y1, y2, y3, y4}, 4);
}
if (x3 != x4) {
g2d.setPaint(new GradientPaint(x3, y1, transparent, x4, y1, background));
g2d.fillPolygon(new int[]{x4, x3, x3, x4}, new int[]{y1, y2, y3, y4}, 4);
}
if (y1 != y2) {
g2d.setPaint(new GradientPaint(x1, y1, background, x1, y2, transparent));
g2d.fillPolygon(new int[]{x1, x2, x3, x4}, new int[]{y1, y2, y2, y1}, 4);
}
if (y3 != y4) {
g2d.setPaint(new GradientPaint(x1, y3, transparent, x1, y4, background));
g2d.fillPolygon(new int[]{x1, x2, x3, x4}, new int[]{y4, y3, y3, y4}, 4);
}
}
}
示例15: paintSearchFocusRing
import com.intellij.ui.ColorUtil; //导入方法依赖的package包/类
public static void paintSearchFocusRing(Graphics2D g, Rectangle bounds, int maxArcSize) {
int correction = UIUtil.isUnderAquaLookAndFeel() ? 30 : UIUtil.isUnderDarcula() ? 50 : 0;
final Color[] colors = new Color[]{
ColorUtil.toAlpha(getGlow(), 180 - correction),
ColorUtil.toAlpha(getGlow(), 120 - correction),
ColorUtil.toAlpha(getGlow(), 70 - correction),
ColorUtil.toAlpha(getGlow(), 100 - correction),
ColorUtil.toAlpha(getGlow(), 50 - correction)
};
final Object oldAntialiasingValue = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
final Object oldStrokeControlValue = g.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);
final Rectangle r = new Rectangle(bounds.x - 3, bounds.y - 3, bounds.width + 6, bounds.height + 6);
int arcSize = r.height - 1;
if (maxArcSize>0) arcSize = Math.min(maxArcSize, arcSize);
if (arcSize %2 == 1) arcSize--;
g.setColor(colors[0]);
g.drawRoundRect(r.x + 2, r.y + 2, r.width - 5, r.height - 5, arcSize-4, arcSize-4);
g.setColor(colors[1]);
g.drawRoundRect(r.x + 1, r.y + 1, r.width - 3, r.height - 3, arcSize-2, arcSize-2);
g.setColor(colors[2]);
g.drawRoundRect(r.x, r.y, r.width - 1, r.height - 1, arcSize, arcSize);
g.setColor(colors[3]);
g.drawRoundRect(r.x+3, r.y+3, r.width - 7, r.height - 7, arcSize-6, arcSize-6);
g.setColor(colors[4]);
g.drawRoundRect(r.x+4, r.y+4, r.width - 9, r.height - 9, arcSize-8, arcSize-8);
// restore rendering hints
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAntialiasingValue);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue);
}