Class DrawUtil

java.lang.Object
com.intellij.util.ui.DrawUtil
Direct Known Subclasses:
UIUtil

public class DrawUtil extends Object
  • Field Details

    • LOG

      protected static final Logger LOG
  • Constructor Details

    • DrawUtil

      public DrawUtil()
  • Method Details

    • drawFramingLines

      public static void drawFramingLines(@NotNull Graphics2D g, int startX, int endX, int topY, int bottomY, @NotNull Color color)
      Draws two horizontal lines, the first at topY, the second at bottomY. The purpose of this method (and the ground of the name) is to draw two lines framing a horizontal filled rectangle.
      Parameters:
      g - Graphics context to draw with.
      startX - x-start point.
      endX - x-end point.
      topY - y-coordinate of the first line.
      bottomY - y-coordinate of the second line.
      color - color of the lines.
    • isRetina

      public static boolean isRetina(Graphics2D graphics)
    • isRetina

      public static boolean isRetina()
    • drawLinePickedOut

      public static void drawLinePickedOut(Graphics graphics, int x, int y, int x1, int y1)
    • drawLine

      public static void drawLine(Graphics g, int x1, int y1, int x2, int y2)
    • drawLine

      public static void drawLine(Graphics2D g, int x1, int y1, int x2, int y2, @Nullable Color bgColor, @Nullable Color fgColor)
    • getPanelBackground

      public static Color getPanelBackground()
    • isUnderDarcula

      public static boolean isUnderDarcula()
    • isUnderIntelliJLaF

      public static boolean isUnderIntelliJLaF()
    • drawDottedRectangle

      public static void drawDottedRectangle(Graphics g, int x, int y, int x1, int y1)
      Parameters:
      g - graphics.
      x - top left X coordinate.
      y - top left Y coordinate.
      x1 - right bottom X coordinate.
      y1 - right bottom Y coordinate.
    • drawBoldDottedLine

      public static void drawBoldDottedLine(Graphics2D g, int startX, int endX, int lineY, Color bgColor, Color fgColor, boolean opaque)
      Should be invoked only in EDT.
      Parameters:
      g - Graphics surface
      startX - Line start X coordinate
      endX - Line end X coordinate
      lineY - Line Y coordinate
      bgColor - Background color (optional)
      fgColor - Foreground color (optional)
      opaque - If opaque the image will be dr
    • drawSearchMatch

      public static void drawSearchMatch(Graphics2D g, int startX, int endX, int height)
    • drawSearchMatch

      public static void drawSearchMatch(Graphics2D g, int startX, int endX, int height, Color c1, Color c2)
    • drawRectPickedOut

      public static void drawRectPickedOut(Graphics2D g, int x, int y, int w, int h)
    • drawGradientHToolbarBackground

      public static void drawGradientHToolbarBackground(Graphics g, int width, int height)
    • drawHeader

      public static void drawHeader(Graphics g, int x, int width, int height, boolean active, boolean drawTopLine)
    • drawHeader

      public static void drawHeader(Graphics g, int x, int width, int height, boolean active, boolean toolWindow, boolean drawTopLine, boolean drawBottomLine)
    • drawDoubleSpaceDottedLine

      public static void drawDoubleSpaceDottedLine(Graphics2D g, int start, int end, int xOrY, Color fgColor, boolean horizontal)
    • createImage

      @NotNull public static BufferedImage createImage(int width, int height, int type)
    • createImageForGraphics

      @NotNull public static BufferedImage createImageForGraphics(Graphics2D g, int width, int height, int type)
    • drawImage

      public static void drawImage(Graphics g, Image image, int x, int y, ImageObserver observer)
    • drawImage

      public static void drawImage(Graphics g, Image image, int x, int y, int width, int height, ImageObserver observer)
    • drawImage

      public static void drawImage(Graphics g, BufferedImage image, BufferedImageOp op, int x, int y)
    • paintWithXorOnRetina

      public static void paintWithXorOnRetina(@NotNull Dimension size, @NotNull Graphics g, Consumer<Graphics2D> paintRoutine)
    • paintWithXorOnRetina

      public static void paintWithXorOnRetina(@NotNull Dimension size, @NotNull Graphics g, boolean useRetinaCondition, Consumer<Graphics2D> paintRoutine)
      Direct painting into component's graphics with XORMode is broken on retina-mode so we need to paint into an intermediate buffer first.
    • drawVDottedLine

      public static void drawVDottedLine(Graphics2D g, int lineX, int startY, int endY, @Nullable Color bgColor, Color fgColor)
    • drawHDottedLine

      public static void drawHDottedLine(Graphics2D g, int startX, int endX, int lineY, @Nullable Color bgColor, Color fgColor)
    • drawDottedLine

      public static void drawDottedLine(Graphics2D g, int x1, int y1, int x2, int y2, @Nullable Color bgColor, Color fgColor)
    • drawStringWithHighlighting

      public static void drawStringWithHighlighting(Graphics g, String s, int x, int y, Color foreground, Color highlighting)
    • getGradientPaint

      @NotNull public static Paint getGradientPaint(float x1, float y1, @NotNull Color c1, float x2, float y2, @NotNull Color c2)
    • isAppleRetina

      public static boolean isAppleRetina()
    • setupComposite

      public static void setupComposite(@NotNull Graphics2D g)
      Configures composite to use for drawing text with the given graphics container.

      The whole idea is that XRender-based pipeline doesn't support AlphaComposite.SRC and we should use AlphaComposite.SRC_OVER instead.

      Parameters:
      g - target graphics container
    • setupComponentAntialiasing

      public static void setupComponentAntialiasing(JComponent component)