Java 类com.intellij.openapi.ui.impl.ShadowBorderPainter 实例源码

项目:intellij-ce-playground    文件:BalloonImpl.java   
@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);

  final Graphics2D g2d = (Graphics2D)g;

  Point pointTarget = SwingUtilities.convertPoint(myLayeredPane, myBalloon.myTargetPoint, this);

  Rectangle shapeBounds = myContent.getBounds();

  final int shadowSize = myBalloon.getShadowBorderSize();
  if (shadowSize > 0) {
    if (myShadow == null) {
      initComponentImage(pointTarget, shapeBounds);
      myShadow = ShadowBorderPainter.createShadow(myImage, 0, 0, false, shadowSize / 2);
    }
  }

  if (myImage == null && myAlpha != -1) {
    initComponentImage(pointTarget, shapeBounds);
  }

  if (myImage != null && myAlpha != -1) {
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, myAlpha));
    paintShadow(g);
    UIUtil.drawImage(g2d, myImage, 0, 0, null);
  }
  else {
    paintShadow(g);
    myBalloon.myPosition.paintComponent(myBalloon, shapeBounds, (Graphics2D)g, pointTarget);
  }
}
项目:tools-idea    文件:BalloonImpl.java   
@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);

  final Graphics2D g2d = (Graphics2D)g;

  Point pointTarget = SwingUtilities.convertPoint(myLayeredPane, myBalloon.myTargetPoint, this);

  Rectangle shapeBounds = myContent.getBounds();

  final int shadowSize = myBalloon.getShadowBorderSize();
  if (shadowSize > 0) {
    if (myShadow == null) {
      initComponentImage(pointTarget, shapeBounds);
      myShadow = ShadowBorderPainter.createShadow(myImage, 0, 0, false, shadowSize / 2);
    }
  }

  if (myImage == null && myAlpha != -1) {
    initComponentImage(pointTarget, shapeBounds);
  }

  if (myImage != null && myAlpha != -1) {
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, myAlpha));

    UIUtil.drawImage(g2d, myImage, 0, 0, null);
  }
  else {
    if (myShadow != null) {
      UIUtil.drawImage(g, myShadow.getImage(), myShadow.getX(), myShadow.getY(), null);
    }
    myBalloon.myPosition.paintComponent(myBalloon, shapeBounds, (Graphics2D)g, pointTarget);
  }
}
项目:consulo    文件:BalloonImpl.java   
@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);

  final Graphics2D g2d = (Graphics2D)g;

  Point pointTarget = SwingUtilities.convertPoint(myLayeredPane, myBalloon.myTargetPoint, this);
  Rectangle shapeBounds = myContent.getBounds();
  int shadowSize = myBalloon.getShadowBorderSize();

  if (shadowSize > 0 && myShadow == null && myShadowBorderProvider == null) {
    initComponentImage(pointTarget, shapeBounds);
    myShadow = ShadowBorderPainter.createShadow(myImage, 0, 0, false, shadowSize / 2);
  }

  if (myImage == null && myAlpha != -1) {
    initComponentImage(pointTarget, shapeBounds);
  }

  if (myImage != null && myAlpha != -1) {
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, myAlpha));
  }

  if (myShadowBorderProvider != null) {
    myShadowBorderProvider.paintShadow(this, g);
  }

  if (myImage != null && myAlpha != -1) {
    paintShadow(g);
    UIUtil.drawImage(g2d, myImage, 0, 0, null);
  }
  else {
    paintShadow(g);
    myBalloon.myPosition.paintComponent(myBalloon, shapeBounds, (Graphics2D)g, pointTarget);
  }
}