Package com.intellij.util.ui
Class DrawUtil
java.lang.Object
com.intellij.util.ui.DrawUtil
- Direct Known Subclasses:
UIUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImagecreateImage(int width, int height, int type) static BufferedImagecreateImageForGraphics(Graphics2D g, int width, int height, int type) static voiddrawBoldDottedLine(Graphics2D g, int startX, int endX, int lineY, Color bgColor, Color fgColor, boolean opaque) Should be invoked only in EDT.static voiddrawDottedLine(Graphics2D g, int x1, int y1, int x2, int y2, Color bgColor, Color fgColor) static voiddrawDottedRectangle(Graphics g, int x, int y, int x1, int y1) static voiddrawDoubleSpaceDottedLine(Graphics2D g, int start, int end, int xOrY, Color fgColor, boolean horizontal) static voiddrawFramingLines(Graphics2D g, int startX, int endX, int topY, int bottomY, Color color) Draws two horizontal lines, the first attopY, the second atbottomY.static voiddrawGradientHToolbarBackground(Graphics g, int width, int height) static voiddrawHDottedLine(Graphics2D g, int startX, int endX, int lineY, Color bgColor, Color fgColor) static voiddrawHeader(Graphics g, int x, int width, int height, boolean active, boolean drawTopLine) static voiddrawHeader(Graphics g, int x, int width, int height, boolean active, boolean toolWindow, boolean drawTopLine, boolean drawBottomLine) static voiddrawImage(Graphics g, BufferedImage image, BufferedImageOp op, int x, int y) static voiddrawImage(Graphics g, Image image, int x, int y, int width, int height, ImageObserver observer) static voiddrawImage(Graphics g, Image image, int x, int y, ImageObserver observer) static voiddrawLine(Graphics2D g, int x1, int y1, int x2, int y2, Color bgColor, Color fgColor) static voidstatic voiddrawLinePickedOut(Graphics graphics, int x, int y, int x1, int y1) static voiddrawRectPickedOut(Graphics2D g, int x, int y, int w, int h) static voiddrawSearchMatch(Graphics2D g, int startX, int endX, int height) static voiddrawSearchMatch(Graphics2D g, int startX, int endX, int height, Color c1, Color c2) static voiddrawStringWithHighlighting(Graphics g, String s, int x, int y, Color foreground, Color highlighting) static voiddrawVDottedLine(Graphics2D g, int lineX, int startY, int endY, Color bgColor, Color fgColor) static PaintgetGradientPaint(float x1, float y1, Color c1, float x2, float y2, Color c2) static Colorstatic booleanstatic booleanisRetina()static booleanisRetina(Graphics2D graphics) static booleanstatic booleanstatic voidpaintWithXorOnRetina(Dimension size, 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.static voidpaintWithXorOnRetina(Dimension size, Graphics g, Consumer<Graphics2D> paintRoutine) static voidsetupComponentAntialiasing(JComponent component) static voidConfigures composite to use for drawing text with the given graphics container.
-
Field Details
-
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 attopY, the second atbottomY. 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
-
isRetina
public static boolean isRetina() -
drawLinePickedOut
-
drawLine
-
drawLine
public static void drawLine(Graphics2D g, int x1, int y1, int x2, int y2, @Nullable Color bgColor, @Nullable Color fgColor) -
getPanelBackground
-
isUnderDarcula
public static boolean isUnderDarcula() -
isUnderIntelliJLaF
public static boolean isUnderIntelliJLaF() -
drawDottedRectangle
- 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 surfacestartX- Line start X coordinateendX- Line end X coordinatelineY- Line Y coordinatebgColor- Background color (optional)fgColor- Foreground color (optional)opaque- If opaque the image will be dr
-
drawSearchMatch
-
drawSearchMatch
public static void drawSearchMatch(Graphics2D g, int startX, int endX, int height, Color c1, Color c2) -
drawRectPickedOut
-
drawGradientHToolbarBackground
-
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
-
createImageForGraphics
@NotNull public static BufferedImage createImageForGraphics(Graphics2D g, int width, int height, int type) -
drawImage
-
drawImage
public static void drawImage(Graphics g, Image image, int x, int y, int width, int height, ImageObserver observer) -
drawImage
-
paintWithXorOnRetina
-
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
-
getGradientPaint
-
isAppleRetina
public static boolean isAppleRetina() -
setupComposite
Configures composite to use for drawing text with the given graphics container. The whole idea is that XRender-based pipeline doesn't supportAlphaComposite.SRCand we should useAlphaComposite.SRC_OVERinstead.- Parameters:
g- target graphics container
-
setupComponentAntialiasing
-