Package org.aoju.bus.core.lang
Class Graphics
java.lang.Object
org.aoju.bus.core.lang.Graphics
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Graphics2DcreateGraphics(BufferedImage image, Color color) static Graphics绘制图片static Graphics绘制图片static GraphicsdrawString(Graphics g, String text, Font font, Color color, int width, int height) 绘制字符串,默认抗锯齿static Graphics绘制字符串,默认抗锯齿static Graphics绘制字符串,默认抗锯齿。static GraphicsdrawStringColourful(Graphics g, String text, Font font, int width, int height) 绘制字符串,使用随机颜色,默认抗锯齿static intgetCenterY(Graphics g, int backgroundHeight) 获取文字居中高度的Y坐标(距离上边距距离) 此方法依赖FontMetrics,如果获取失败,默认为背景高度的1/3static Graphics2DsetAlpha(Graphics2D g, float alpha) 设置画笔透明度
-
Constructor Details
-
Graphics
public Graphics()
-
-
Method Details
-
createGraphics
- Parameters:
image-BufferedImagecolor-Color背景颜色以及当前画笔颜色,null表示不设置背景色- Returns:
Graphics2D
-
getCenterY
获取文字居中高度的Y坐标(距离上边距距离) 此方法依赖FontMetrics,如果获取失败,默认为背景高度的1/3- Parameters:
g-Graphics2D画笔backgroundHeight- 背景高度- Returns:
- 最小高度,-1表示无法获取
-
drawStringColourful
-
drawString
-
drawString
-
drawString
-
drawImg
-
drawImg
-
setAlpha
设置画笔透明度- Parameters:
g- 画笔alpha- 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字- Returns:
- 画笔
-