public class SLGraphics
extends java.awt.Graphics2D
implements java.lang.Cloneable
Constructor and Description |
---|
SLGraphics(GroupShape<?,?> group)
Construct Java Graphics object which translates graphic calls in ppt drawing layer.
|
Modifier and Type | Method and Description |
---|---|
void |
addRenderingHints(java.util.Map<?,?> hints)
Sets the values of an arbitrary number of preferences for the rendering algorithms.
(为渲染算法设置任意数量的首选项的值。)
|
protected void |
applyPaint(SimpleShape<?,?> shape) |
protected void |
applyStroke(SimpleShape<?,?> shape) |
void |
clearRect(int x, int y, int width, int height)
Clears the specified rectangle by filling it with the background color of the current drawing surface.
(通过用当前绘图表面的背景颜色填充指定的矩形来清除它。)
|
void |
clip(java.awt.Shape s)
Intersects the current
Clip with the interior of the specified
Shape and sets the
Clip to the resulting intersection.
(将当前 Clip 与指定 Shape 的内部相交,并将 Clip 设置为生成的交点。)
|
void |
clipRect(int x, int y, int width, int height)
Intersects the current clip with the specified rectangle.
(将当前剪辑与指定的矩形相交。)
|
void |
copyArea(int x, int y, int width, int height, int dx, int dy) |
java.awt.Graphics |
create()
Creates a new
Graphics object that is a copy of this
Graphics object.
(创建一个新的 Graphics 对象,该对象是此 Graphics 对象的副本。)
|
void |
dispose()
Disposes of this graphics context and releases any system resources that it is using.
(处理此图形上下文并释放它正在使用的任何系统资源。)
|
void |
draw(java.awt.Shape shape)
Strokes the outline of a
Shape using the settings of the current
Graphics2D context.
(使用当前 Graphics2D 上下文的设置来描边 Shape 的轮廓。)
|
void |
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Draws the outline of a circular or elliptical arc covering the specified rectangle.
(绘制覆盖指定矩形的圆弧或椭圆弧的轮廓。)
|
void |
drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
Renders the text of the specified
GlyphVector using the
Graphics2D context's rendering attributes.
(使用 Graphics2D 上下文的呈现属性呈现指定 GlyphVector 的文本。)
|
void |
drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)
Renders a
BufferedImage that is filtered with a
BufferedImageOp .
(渲染使用 BufferedImageOp 过滤的 BufferedImage。)
|
boolean |
drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)
Renders an image, applying a transform from image space into user space before drawing.
(渲染图像,在绘制之前应用从图像空间到用户空间的变换。)
|
boolean |
drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Draws as much of the specified image as is currently available.
(绘制当前可用的尽可能多的指定图像。)
|
boolean |
drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
Draws as much of the specified image as is currently available.
(绘制当前可用的尽可能多的指定图像。)
|
boolean |
drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
(绘制尽可能多的指定图像,该图像已缩放以适合指定矩形。)
|
boolean |
drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
(绘制尽可能多的指定图像,该图像已缩放以适合指定矩形。)
|
boolean |
drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
(绘制当前可用的指定图像的指定区域,动态缩放以适合目标可绘制表面的指定区域。)
|
boolean |
drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
(绘制当前可用的指定图像的指定区域,动态缩放以适合目标可绘制表面的指定区域。)
|
void |
drawLine(int x1, int y1, int x2, int y2)
Draws a line, using the current color, between the points
(x1, y1) and
(x2, y2) in this graphics context's coordinate system.
(使用当前颜色在此图形上下文坐标系中的点 (x1, y1) 和 (x2, y2) 之间绘制一条线。)
|
void |
drawOval(int x, int y, int width, int height)
Draws the outline of an oval.
(绘制椭圆的轮廓。)
|
void |
drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draws a closed polygon defined by arrays of
x and
y coordinates.
(绘制由 x 和 y 坐标数组定义的闭合多边形。)
|
void |
drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Draws a sequence of connected lines defined by arrays of
x and
y coordinates.
(绘制由 x 和 y 坐标数组定义的连接线序列。)
|
void |
drawRect(int x, int y, int width, int height)
Draws the outline of the specified rectangle.
(绘制指定矩形的轮廓。)
|
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
Renders a
RenderedImage , applying a transform from image space into user space before drawing.
(渲染一个 RenderedImage,在绘制之前应用从图像空间到用户空间的变换。)
|
void |
drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
Renders a
RenderableImage , applying a transform from image space into user space before drawing.
(渲染一个 RenderableImage,在绘制之前应用从图像空间到用户空间的变换。)
|
void |
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Draws an outlined round-cornered rectangle using this graphics context's current color.
(使用此图形上下文的当前颜色绘制一个带轮廓的圆角矩形。)
|
void |
drawString(java.text.AttributedCharacterIterator iterator, float x, float y)
Renders the text of the specified iterator, using the
Graphics2D context's current
Paint .
(使用 Graphics2D 上下文的当前 Paint 呈现指定迭代器的文本。)
|
void |
drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
Draws the text given by the specified iterator, using this graphics context's current color.
(使用此图形上下文的当前颜色绘制由指定迭代器给出的文本。)
|
void |
drawString(java.lang.String s, float x, float y)
Renders the text specified by the specified
String , using the current text attribute state in the
Graphics2D context.
(使用 Graphics2D 上下文中的当前文本属性状态呈现由指定字符串指定的文本。)
|
void |
drawString(java.lang.String str, int x, int y)
Draws the text given by the specified string, using this graphics context's current font and color.
(使用此图形上下文的当前字体和颜色绘制由指定字符串给出的文本。)
|
void |
fill(java.awt.Shape shape)
Fills the interior of a
Shape using the settings of the
Graphics2D context.
(使用 Graphics2D 上下文的设置填充 Shape 的内部。)
|
void |
fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Fills a circular or elliptical arc covering the specified rectangle.
(填充覆盖指定矩形的圆弧或椭圆弧。)
|
void |
fillOval(int x, int y, int width, int height)
Fills an oval bounded by the specified rectangle with the current color.
(用当前颜色填充由指定矩形包围的椭圆。)
|
void |
fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a closed polygon defined by arrays of
x and
y coordinates.
(填充由 x 和 y 坐标数组定义的封闭多边形。)
|
void |
fillRect(int x, int y, int width, int height)
Fills the specified rectangle.
(填充指定的矩形。)
|
void |
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Fills the specified rounded corner rectangle with the current color.
(用当前颜色填充指定的圆角矩形。)
|
java.awt.Color |
getBackground()
Returns the background color used for clearing a region.
(返回用于清除区域的背景颜色。)
|
java.awt.Shape |
getClip()
Gets the current clipping area.
(获取当前剪辑区域。)
|
java.awt.Rectangle |
getClipBounds()
Returns the bounding rectangle of the current clipping area.
(返回当前剪切区域的边界矩形。)
|
java.awt.Color |
getColor()
Gets this graphics context's current color.
(获取此图形上下文的当前颜色。)
|
java.awt.Composite |
getComposite()
Returns the current
Composite in the
Graphics2D context.
(返回 Graphics2D 上下文中的当前 Composite。)
|
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
Returns the device configuration associated with this
Graphics2D .
(返回与此 Graphics2D 关联的设备配置。)
|
java.awt.Font |
getFont()
Gets the current font.
(获取当前字体。)
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font.
(获取指定字体的字体规格。)
|
java.awt.font.FontRenderContext |
getFontRenderContext()
Get the rendering context of the
Font within this
Graphics2D context.
(在此 Graphics2D 上下文中获取字体的渲染上下文。)
|
java.awt.Paint |
getPaint()
Returns the current
Paint of the
Graphics2D context.
(返回 Graphics2D 上下文的当前 Paint。)
|
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key hintKey)
Returns the value of a single preference for the rendering algorithms.
(返回渲染算法的单个首选项的值。)
|
java.awt.RenderingHints |
getRenderingHints()
Gets the preferences for the rendering algorithms.
(获取渲染算法的首选项。)
|
GroupShape<?,?> |
getShapeGroup() |
java.awt.Stroke |
getStroke()
Returns the current
Stroke in the
Graphics2D context.
(返回 Graphics2D 上下文中的当前 Stroke。)
|
java.awt.geom.AffineTransform |
getTransform()
Returns a copy of the current
Transform in the
Graphics2D context.
(返回 Graphics2D 上下文中当前变换的副本。)
|
boolean |
hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)
Checks whether or not the specified
Shape intersects the specified
Rectangle , which is in device space.
(检查指定的 Shape 是否与设备空间中的指定 Rectangle 相交。)
|
void |
rotate(double theta)
Concatenates the current
Graphics2D
Transform with a rotation transform.
(将当前的 Graphics2D 变换与旋转变换连接起来。)
|
void |
rotate(double theta, double x, double y)
Concatenates the current
Graphics2D
Transform with a translated rotation transform.
(将当前的 Graphics2D 变换与平移的旋转变换连接起来。)
|
void |
scale(double sx, double sy)
Concatenates the current
Graphics2D
Transform with a scaling transformation Subsequent rendering is resized according to the specified scaling factors relative to the previous scaling.
(将当前 Graphics2D 变换与缩放变换连接起来 随后的渲染将根据相对于先前缩放的指定缩放因子调整大小。)
|
void |
setBackground(java.awt.Color color)
Sets the background color for the
Graphics2D context.
(设置 Graphics2D 上下文的背景颜色。)
|
void |
setClip(int x, int y, int width, int height)
Sets the current clip to the rectangle specified by the given coordinates.
(将当前剪辑设置为给定坐标指定的矩形。)
|
void |
setClip(java.awt.Shape clip)
Sets the current clipping area to an arbitrary clip shape.
(将当前剪辑区域设置为任意剪辑形状。)
|
void |
setColor(java.awt.Color c)
Sets this graphics context's current color to the specified color.
(将此图形上下文的当前颜色设置为指定颜色。)
|
void |
setComposite(java.awt.Composite comp)
Sets the
Composite for the
Graphics2D context.
(设置 Graphics2D 上下文的 Composite。)
|
void |
setFont(java.awt.Font font)
Sets this graphics context's font to the specified font.
(将此图形上下文的字体设置为指定的字体。)
|
void |
setPaint(java.awt.Paint paint)
Sets the
Paint attribute for the
Graphics2D context.
(设置 Graphics2D 上下文的 Paint 属性。)
|
void |
setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
(设置此图形上下文的绘制模式以使用此图形上下文的当前颜色覆盖目标。)
|
void |
setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
Sets the value of a single preference for the rendering algorithms.
(为渲染算法设置单个首选项的值。)
|
void |
setRenderingHints(java.util.Map<?,?> hints)
Replaces the values of all preferences for the rendering algorithms with the specified
hints .
(用指定的提示替换渲染算法的所有首选项的值。)
|
void |
setStroke(java.awt.Stroke s)
Sets the
Stroke for the
Graphics2D context.
(设置 Graphics2D 上下文的 Stroke。)
|
void |
setTransform(java.awt.geom.AffineTransform Tx)
Sets the
Transform in the
Graphics2D context.
(在 Graphics2D 上下文中设置变换。)
|
void |
setXORMode(java.awt.Color c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
(设置此图形上下文的绘制模式以在此图形上下文的当前颜色和新指定颜色之间交替。)
|
void |
shear(double shx, double shy)
Concatenates the current
Graphics2D
Transform with a shearing transform.
(将当前的 Graphics2D 变换与剪切变换连接起来。)
|
void |
transform(java.awt.geom.AffineTransform Tx)
Composes an
AffineTransform object with the
Transform in this
Graphics2D according to the rule last-specified-first-applied.
(根据 last-specified-first-applied 规则,在此 Graphics2D 中使用 Transform 组合一个 AffineTransform 对象。)
|
void |
translate(double tx, double ty)
Concatenates the current
Graphics2D
Transform with a translation transform.
(将当前的 Graphics2D 变换与平移变换连接起来。)
|
void |
translate(int x, int y)
Translates the origin of the graphics context to the point (
x,
y) in the current coordinate system.
(将图形上下文的原点平移到当前坐标系中的点 (x, y)。)
|
public SLGraphics(GroupShape<?,?> group)
group
- The shape group to write the graphics calls into.
(group - 将图形调用写入的形状组。)
public GroupShape<?,?> getShapeGroup()
public java.awt.Font getFont()
getFont
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 getFont)
Font
,
Graphics.setFont(Font)
public void setFont(java.awt.Font font)
setFont
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setFont)
font
- the font.
(字体 - 字体。)
Graphics.getFont()
,
Graphics.drawString(java.lang.String, int, int)
,
Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public java.awt.Color getColor()
getColor
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 getColor)
Color
,
Graphics.setColor(java.awt.Color)
public void setColor(java.awt.Color c)
setColor
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setColor)
c
- the new rendering color.
(c - 新的渲染颜色。)
Color
,
Graphics.getColor()
public java.awt.Stroke getStroke()
Stroke
in the
Graphics2D
context.
(返回 Graphics2D 上下文中的当前 Stroke。)
getStroke
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getStroke)
Graphics2D
Stroke
, which defines the line style.
(当前的 Graphics2D Stroke,它定义了线条样式。)
setStroke(java.awt.Stroke)
public void setStroke(java.awt.Stroke s)
Stroke
for the
Graphics2D
context.
(设置 Graphics2D 上下文的 Stroke。)
setStroke
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setStroke)
s
- the
Stroke
object to be used to stroke a
Shape
during the rendering process
(s - 在渲染过程中用于描边 Shape 的 Stroke 对象)
public java.awt.Paint getPaint()
Paint
of the
Graphics2D
context.
(返回 Graphics2D 上下文的当前 Paint。)
getPaint
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getPaint)
Graphics2D
Paint
, which defines a color or pattern.
(当前的 Graphics2D Paint,它定义了一种颜色或图案。)
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
public void setPaint(java.awt.Paint paint)
Paint
attribute for the
Graphics2D
context. Calling this method with a
null
Paint
object does not have any effect on the current
Paint
attribute of this
Graphics2D
.
(设置 Graphics2D 上下文的 Paint 属性。使用 null Paint 对象调用此方法不会对此 Graphics2D 的当前 Paint 属性产生任何影响。)
setPaint
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setPaint)
paint
- the
Paint
object to be used to generate color during the rendering process, or
null
(paint - 在渲染过程中用于生成颜色的 Paint 对象,或 null)
Graphics.setColor(java.awt.Color)
public java.awt.geom.AffineTransform getTransform()
Transform
in the
Graphics2D
context.
(返回 Graphics2D 上下文中当前变换的副本。)
getTransform
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getTransform)
AffineTransform
in the
Graphics2D
context.
(Graphics2D 上下文中的当前 AffineTransform。)
_transform
,
setTransform(java.awt.geom.AffineTransform)
public void setTransform(java.awt.geom.AffineTransform Tx)
Transform
in the
Graphics2D
context.
(在 Graphics2D 上下文中设置变换。)
setTransform
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setTransform)
Tx
- the
AffineTransform
object to be used in the rendering process
(Tx - 要在渲染过程中使用的 AffineTransform 对象)
_transform
,
AffineTransform
public void draw(java.awt.Shape shape)
Shape
using the settings of the current
Graphics2D
context. The rendering attributes applied include the
Clip
,
Transform
,
Paint
,
Composite
and
Stroke
attributes.
(使用当前 Graphics2D 上下文的设置来描边 Shape 的轮廓。应用的渲染属性包括 Clip、Transform、Paint、Composite 和 Stroke 属性。)
draw
in class
java.awt.Graphics2D
(在类 java.awt.Graphics2D 中绘制)
shape
- the
Shape
to be rendered
(shape - 要渲染的形状)
setStroke(java.awt.Stroke)
,
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
,
setComposite(java.awt.Composite)
public void drawString(java.lang.String s, float x, float y)
String
, using the current text attribute state in the
Graphics2D
context. The baseline of the first character is at position (
x,
y) in the User Space. The rendering attributes applied include the
Clip
,
Transform
,
Paint
,
Font
and
Composite
attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.
(使用 Graphics2D 上下文中的当前文本属性状态呈现由指定字符串指定的文本。第一个字符的基线位于用户空间中的位置 (x, y)。应用的渲染属性包括 Clip、Transform、Paint、Font 和 Composite 属性。对于希伯来语和阿拉伯语等脚本系统中的字符,字形可以从右到左呈现,在这种情况下,提供的坐标是基线上最左侧字符的位置。)
drawString
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawString)
s
- the
String
to be rendered
(s - 要呈现的字符串)
x
- the x coordinate of the location where the
String
should be rendered
(x - 应呈现字符串的位置的 x 坐标)
y
- the y coordinate of the location where the
String
should be rendered
(y - 应呈现字符串的位置的 y 坐标)
java.lang.NullPointerException
- if
str
is
null
(java.lang.NullPointerException - 如果 str 为空)
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
Graphics.setFont(java.awt.Font)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
setClip(java.awt.Shape)
public void fill(java.awt.Shape shape)
Shape
using the settings of the
Graphics2D
context. The rendering attributes applied include the
Clip
,
Transform
,
Paint
, and
Composite
.
(使用 Graphics2D 上下文的设置填充 Shape 的内部。应用的渲染属性包括 Clip、Transform、Paint 和 Composite。)
fill
in class
java.awt.Graphics2D
(填写类 java.awt.Graphics2D)
shape
- the
Shape
to be filled
(shape - 要填充的形状)
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
public void translate(int x, int y)
translate
in class
java.awt.Graphics2D
(在类 java.awt.Graphics2D 中翻译)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
@NotImplemented public void clip(java.awt.Shape s)
Clip
with the interior of the specified
Shape
and sets the
Clip
to the resulting intersection. The specified
Shape
is transformed with the current
Graphics2D
Transform
before being intersected with the current
Clip
. This method is used to make the current
Clip
smaller. To make the
Clip
larger, use
setClip
. The
user clip modified by this method is independent of the clipping associated with device bounds and visibility. If no clip has previously been set, or if the clip has been cleared using
setClip
with a
null
argument, the specified
Shape
becomes the new user clip.
(将当前 Clip 与指定 Shape 的内部相交,并将 Clip 设置为生成的交点。指定的 Shape 在与当前 Clip 相交之前使用当前的 Graphics2D 变换进行变换。此方法用于使当前 Clip 更小。要使剪辑更大,请使用 setClip。通过此方法修改的用户剪辑独立于与设备边界和可见性相关的剪辑。如果之前没有设置任何剪辑,或者如果使用带有空参数的 setClip 清除了剪辑,则指定的 Shape 将成为新的用户剪辑。)
clip
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的剪辑)
s
- the
Shape
to be intersected with the current
Clip
. If
s
is
null
, this method clears the current
Clip
.
(s - 与当前剪辑相交的形状。如果 s 为 null,则此方法清除当前剪辑。)
@NotImplemented public java.awt.Shape getClip()
setClip(null)
, this method returns
null
.
(获取当前剪辑区域。此方法返回用户剪辑,该剪辑独立于与设备边界和窗口可见性关联的剪辑。如果之前没有设置剪辑,或者如果剪辑已使用 setClip(null) 清除,则此方法返回 null。)
getClip
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 getClip)
Shape
object representing the current clipping area, or
null
if no clip is set.
(表示当前剪辑区域的 Shape 对象,如果未设置剪辑,则为 null。)
Graphics.getClipBounds()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void scale(double sx, double sy)
Graphics2D
Transform
with a scaling transformation Subsequent rendering is resized according to the specified scaling factors relative to the previous scaling. This is equivalent to calling
transform(S)
, where S is an
AffineTransform
represented by the following matrix:
[ sx 0 0 ] [ 0 sy 0 ] [ 0 0 1 ](将当前 Graphics2D 变换与缩放变换连接起来 随后的渲染将根据相对于先前缩放的指定缩放因子调整大小。这等效于调用 transform(S),其中 S 是由以下矩阵表示的 AffineTransform: [ sx 0 0 ] [ 0 sy 0 ] [ 0 0 1 ])
scale
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的缩放)
sx
- the amount by which X coordinates in subsequent rendering operations are multiplied relative to previous rendering operations.
(sx - 后续渲染操作中 X 坐标相对于先前渲染操作的乘积量。)
sy
- the amount by which Y coordinates in subsequent rendering operations are multiplied relative to previous rendering operations.
(sy - 后续渲染操作中的 Y 坐标相对于先前渲染操作的乘积量。)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and
x + width
, respectively. The top and bottom edges of the rectangle are at
y
and
y + height
.
(使用此图形上下文的当前颜色绘制一个带轮廓的圆角矩形。矩形的左右边缘分别位于 x 和 x + 宽度处。矩形的顶部和底部边缘位于 y 和 y + 高度。)
drawRoundRect
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawRoundRect)
x
- the
x coordinate of the rectangle to be drawn.
(x - 要绘制的矩形的 x 坐标。)
y
- the
y coordinate of the rectangle to be drawn.
(y - 要绘制的矩形的 y 坐标。)
width
- the width of the rectangle to be drawn.
(width - 要绘制的矩形的宽度。)
height
- the height of the rectangle to be drawn.
(height - 要绘制的矩形的高度。)
arcWidth
- the horizontal diameter of the arc at the four corners.
(arcWidth - 四个角处圆弧的水平直径。)
arcHeight
- the vertical diameter of the arc at the four corners.
(arcHeight - 四个角处圆弧的垂直直径。)
Graphics.fillRoundRect(int, int, int, int, int, int)
public void drawString(java.lang.String str, int x, int y)
drawString
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawString)
str
- the string to be drawn.
(str - 要绘制的字符串。)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public void fillOval(int x, int y, int width, int height)
fillOval
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 fillOval)
x
- the
x coordinate of the upper left corner of the oval to be filled.
(x - 要填充的椭圆左上角的 x 坐标。)
y
- the
y coordinate of the upper left corner of the oval to be filled.
(y - 要填充的椭圆左上角的 y 坐标。)
width
- the width of the oval to be filled.
(width - 要填充的椭圆的宽度。)
height
- the height of the oval to be filled.
(height - 要填充的椭圆的高度。)
Graphics.drawOval(int, int, int, int)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and
x + width - 1
, respectively. The top and bottom edges of the rectangle are at
y
and
y + height - 1
.
(用当前颜色填充指定的圆角矩形。矩形的左右边缘分别位于 x 和 x + width - 1 处。矩形的顶部和底部边缘位于 y 和 y + height - 1 处。)
fillRoundRect
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 fillRoundRect)
x
- the
x coordinate of the rectangle to be filled.
(x - 要填充的矩形的 x 坐标。)
y
- the
y coordinate of the rectangle to be filled.
(y - 要填充的矩形的 y 坐标。)
width
- the width of the rectangle to be filled.
(width - 要填充的矩形的宽度。)
height
- the height of the rectangle to be filled.
(height - 要填充的矩形的高度。)
arcWidth
- the horizontal diameter of the arc at the four corners.
(arcWidth - 四个角处圆弧的水平直径。)
arcHeight
- the vertical diameter of the arc at the four corners.
(arcHeight - 四个角处圆弧的垂直直径。)
Graphics.drawRoundRect(int, int, int, int, int, int)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
The resulting arc begins at startAngle
and extends for arcAngle
degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width
and height
arguments.
The resulting arc covers an area width + 1
pixels wide by height + 1
pixels tall.
The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.
(填充覆盖指定矩形的圆弧或椭圆弧。生成的弧从 startAngle 开始并延伸 arcAngle 度数。角度被解释为 0 度位于 3 点钟位置。正值表示逆时针旋转,负值表示顺时针旋转。圆弧的中心是矩形的中心,其原点为 (x, y),其大小由宽度和高度参数指定。生成的弧覆盖区域宽度 + 1 像素宽 x 高度 + 1 像素高。角度是相对于边界矩形的非正方形范围指定的,因此 45 度始终落在从椭圆中心到边界矩形右上角的直线上。因此,如果边界矩形在一个轴上明显长于另一个轴,则与弧段起点和终点的角度将沿边界的较长轴倾斜得更远。)fillArc
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 fillArc)
x
- the
x coordinate of the upper-left corner of the arc to be filled.
(x - 要填充的圆弧左上角的 x 坐标。)
y
- the
y coordinate of the upper-left corner of the arc to be filled.
(y - 要填充的圆弧左上角的 y 坐标。)
width
- the width of the arc to be filled.
(width - 要填充的弧的宽度。)
height
- the height of the arc to be filled.
(height - 要填充的弧的高度。)
startAngle
- the beginning angle.
(startAngle - 开始角度。)
arcAngle
- the angular extent of the arc, relative to the start angle.
(arcAngle - 弧的角度范围,相对于起始角度。)
Graphics.drawArc(int, int, int, int, int, int)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
The resulting arc begins at startAngle
and extends for arcAngle
degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width
and height
arguments.
The resulting arc covers an area width + 1
pixels wide by height + 1
pixels tall.
The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.
(绘制覆盖指定矩形的圆弧或椭圆弧的轮廓。生成的弧从 startAngle 开始,并使用当前颜色延伸 arcAngle 度数。角度被解释为 0 度位于 3 点钟位置。正值表示逆时针旋转,负值表示顺时针旋转。圆弧的中心是矩形的中心,其原点为 (x, y),其大小由宽度和高度参数指定。生成的弧覆盖区域宽度 + 1 像素宽 x 高度 + 1 像素高。角度是相对于边界矩形的非正方形范围指定的,因此 45 度始终落在从椭圆中心到边界矩形右上角的直线上。因此,如果边界矩形在一个轴上明显长于另一个轴,则与弧段起点和终点的角度将沿边界的较长轴倾斜得更远。)drawArc
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawArc)
x
- the
x coordinate of the upper-left corner of the arc to be drawn.
(x - 要绘制的圆弧左上角的 x 坐标。)
y
- the
y coordinate of the upper-left corner of the arc to be drawn.
(y - 要绘制的圆弧左上角的 y 坐标。)
width
- the width of the arc to be drawn.
(width - 要绘制的弧的宽度。)
height
- the height of the arc to be drawn.
(height - 要绘制的弧的高度。)
startAngle
- the beginning angle.
(startAngle - 开始角度。)
arcAngle
- the angular extent of the arc, relative to the start angle.
(arcAngle - 弧的角度范围,相对于起始角度。)
Graphics.fillArc(int, int, int, int, int, int)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
drawPolyline
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawPolyline)
xPoints
- an array of
x points
(xPoints - x 点的数组)
yPoints
- an array of
y points
(yPoints - y 点数组)
nPoints
- the total number of points
(nPoints - 总点数)
Graphics.drawPolygon(int[], int[], int)
public void drawOval(int x, int y, int width, int height)
x
,
y
,
width
, and
height
arguments.
The oval covers an area that is width + 1
pixels wide and height + 1
pixels tall.
drawOval
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawOval)
x
- the
x coordinate of the upper left corner of the oval to be drawn.
(x - 要绘制的椭圆左上角的 x 坐标。)
y
- the
y coordinate of the upper left corner of the oval to be drawn.
(y - 要绘制的椭圆左上角的 y 坐标。)
width
- the width of the oval to be drawn.
(width - 要绘制的椭圆的宽度。)
height
- the height of the oval to be drawn.
(height - 要绘制的椭圆的高度。)
Graphics.fillOval(int, int, int, int)
@NotImplemented public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.
If the image has not yet been completely loaded, then drawImage
returns false
. As more of the image becomes available, the process that draws the image notifies the specified image observer.
drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn.
(img - 要绘制的指定图像。)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
bgcolor
- the background color to paint under the non-opaque portions of the image.
(bgcolor - 在图像的非透明部分下绘制的背景颜色。)
observer
- object to be notified as more of the image is converted.
(观察者 - 当更多图像被转换时要通知的对象。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
@NotImplemented public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the entire image has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage
returns false
. As more of the image becomes available, the process that draws the image notifies the specified image observer.
A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.
(绘制尽可能多的指定图像,该图像已缩放以适合指定矩形。图像绘制在此图形上下文坐标空间的指定矩形内,并在必要时进行缩放。透明像素以指定的背景颜色绘制。这个操作相当于用给定的颜色填充指定图像的宽度和高度的矩形,然后在其上绘制图像,但效率可能更高。此方法在所有情况下都会立即返回,即使尚未针对当前输出设备对整个图像进行缩放、抖动和转换也是如此。如果当前输出表示尚未完成,则 drawImage 返回 false。随着更多图像可用,绘制图像的过程会通知指定的图像观察者。图像的缩放版本不一定会立即可用,因为已经为此输出设备构建了图像的未缩放版本。图像的每个大小都可以单独缓存,并从单独的图像生成序列中的原始数据生成。)drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn.
(img - 要绘制的指定图像。)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
width
- the width of the rectangle.
(width - 矩形的宽度。)
height
- the height of the rectangle.
(height - 矩形的高度。)
bgcolor
- the background color to paint under the non-opaque portions of the image.
(bgcolor - 在图像的非透明部分下绘制的背景颜色。)
observer
- object to be notified as more of the image is converted.
(观察者 - 当更多图像被转换时要通知的对象。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
@NotImplemented public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
This method returns immediately in all cases, even if the image area to be drawn has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage
returns false
. As more of the image becomes available, the process that draws the image notifies the specified image observer.
This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
(绘制当前可用的指定图像的指定区域,动态缩放以适应目标可绘制表面的指定区域。透明像素不会影响已经存在的任何像素。此方法在所有情况下都会立即返回,即使要绘制的图像区域尚未针对当前输出设备进行缩放、抖动和转换。如果当前输出表示尚未完成,则 drawImage 返回 false。随着更多图像可用,绘制图像的过程会通知指定的图像观察者。此方法始终使用图像的未缩放版本来渲染缩放的矩形并即时执行所需的缩放。它不使用缓存的、缩放版本的图像进行此操作。执行从源到目标的图像缩放,使得源矩形的第一坐标映射到目标矩形的第一坐标,并且第二源坐标映射到第二目标坐标。根据需要对子图像进行缩放和翻转以保留这些映射。)drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn
(img - 要绘制的指定图像)
dx1
- the
x coordinate of the first corner of the destination rectangle.
(dx1 - 目标矩形第一个角的 x 坐标。)
dy1
- the
y coordinate of the first corner of the destination rectangle.
(dy1 - 目标矩形第一个角的 y 坐标。)
dx2
- the
x coordinate of the second corner of the destination rectangle.
(dx2 - 目标矩形第二个角的 x 坐标。)
dy2
- the
y coordinate of the second corner of the destination rectangle.
(dy2 - 目标矩形第二个角的 y 坐标。)
sx1
- the
x coordinate of the first corner of the source rectangle.
(sx1 - 源矩形第一个角的 x 坐标。)
sy1
- the
y coordinate of the first corner of the source rectangle.
(sy1 - 源矩形第一个角的 y 坐标。)
sx2
- the
x coordinate of the second corner of the source rectangle.
(sx2 - 源矩形第二个角的 x 坐标。)
sy2
- the
y coordinate of the second corner of the source rectangle.
(sy2 - 源矩形第二个角的 y 坐标。)
observer
- object to be notified as more of the image is scaled and converted.
(观察者 - 当更多图像被缩放和转换时要通知的对象。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
@NotImplemented public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it, but possibly more efficient.
This method returns immediately in all cases, even if the image area to be drawn has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete then drawImage
returns false
. As more of the image becomes available, the process that draws the image notifies the specified image observer.
This method always uses the unscaled version of the image to render the scaled rectangle and performs the required scaling on the fly. It does not use a cached, scaled version of the image for this operation. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
(绘制当前可用的指定图像的指定区域,动态缩放以适合目标可绘制表面的指定区域。透明像素以指定的背景颜色绘制。这个操作相当于用给定的颜色填充指定图像的宽度和高度的矩形,然后在其上绘制图像,但效率可能更高。此方法在所有情况下都会立即返回,即使要绘制的图像区域尚未针对当前输出设备进行缩放、抖动和转换。如果当前输出表示尚未完成,则 drawImage 返回 false。随着更多图像可用,绘制图像的过程会通知指定的图像观察者。此方法始终使用图像的未缩放版本来渲染缩放的矩形并即时执行所需的缩放。它不使用缓存的、缩放版本的图像进行此操作。执行从源到目标的图像缩放,使得源矩形的第一坐标映射到目标矩形的第一坐标,并且第二源坐标映射到第二目标坐标。根据需要对子图像进行缩放和翻转以保留这些映射。)drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn
(img - 要绘制的指定图像)
dx1
- the
x coordinate of the first corner of the destination rectangle.
(dx1 - 目标矩形第一个角的 x 坐标。)
dy1
- the
y coordinate of the first corner of the destination rectangle.
(dy1 - 目标矩形第一个角的 y 坐标。)
dx2
- the
x coordinate of the second corner of the destination rectangle.
(dx2 - 目标矩形第二个角的 x 坐标。)
dy2
- the
y coordinate of the second corner of the destination rectangle.
(dy2 - 目标矩形第二个角的 y 坐标。)
sx1
- the
x coordinate of the first corner of the source rectangle.
(sx1 - 源矩形第一个角的 x 坐标。)
sy1
- the
y coordinate of the first corner of the source rectangle.
(sy1 - 源矩形第一个角的 y 坐标。)
sx2
- the
x coordinate of the second corner of the source rectangle.
(sx2 - 源矩形第二个角的 x 坐标。)
sy2
- the
y coordinate of the second corner of the source rectangle.
(sy2 - 源矩形第二个角的 y 坐标。)
bgcolor
- the background color to paint under the non-opaque portions of the image.
(bgcolor - 在图像的非透明部分下绘制的背景颜色。)
observer
- object to be notified as more of the image is scaled and converted.
(观察者 - 当更多图像被缩放和转换时要通知的对象。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
@NotImplemented public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.
If the image has completely loaded and its pixels are no longer being changed, then drawImage
returns true
. Otherwise, drawImage
returns false
and as more of the image becomes available or it is time to draw another frame of animation, the process that loads the image notifies the specified image observer.
drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn. This method does nothing if
img
is null.
(img - 要绘制的指定图像。如果 img 为 null,则此方法不执行任何操作。)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
observer
- object to be notified as more of the image is converted.
(观察者 - 当更多图像被转换时要通知的对象。)
false
if the image pixels are still changing;
true
otherwise.
(如果图像像素仍在变化,则为 false;否则为真。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public void dispose()
Graphics
object cannot be used after
dispose
has been called.
When a Java program runs, a large number of Graphics
objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time.
Graphics objects which are provided as arguments to the paint
and update
methods of components are automatically released by the system when those methods return. For efficiency, programmers should call dispose
when finished using a Graphics
object only if it was created directly from a component or another Graphics
object.
dispose
in class
java.awt.Graphics
(在类 java.awt.Graphics 中处理)
Graphics.finalize()
,
Component.paint(java.awt.Graphics)
,
Component.update(java.awt.Graphics)
,
Component.getGraphics()
,
Graphics.create()
public void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
and
(x2, y2)
in this graphics context's coordinate system.
(使用当前颜色在此图形上下文坐标系中的点 (x1, y1) 和 (x2, y2) 之间绘制一条线。)
drawLine
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawLine)
x1
- the first point's
x coordinate.
(x1 - 第一个点的 x 坐标。)
y1
- the first point's
y coordinate.
(y1 - 第一个点的 y 坐标。)
x2
- the second point's
x coordinate.
(x2 - 第二个点的 x 坐标。)
y2
- the second point's
y coordinate.
(y2 - 第二个点的 y 坐标。)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line segments, where the first nPoint - 1
line segments are line segments from (xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for 1 ≤ i ≤ nPoints
. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.
The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule.
(填充由 x 和 y 坐标数组定义的封闭多边形。该方法绘制由 nPoint 线段定义的多边形,其中前 nPoint - 1 条线段是从 (xPoints[i - 1], yPoints[i - 1]) 到 (xPoints[i], yPoints[i]) 的线段, 对于 1 ≤ i ≤ nPoints。如果这些点不同,则通过绘制一条连接最后一个点和第一个点的线来自动关闭图形。多边形内的区域使用奇偶填充规则定义,也称为交替规则。)fillPolygon
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 fillPolygon)
xPoints
- a an array of
x
coordinates.
(xPoints - 一个 x 坐标数组。)
yPoints
- a an array of
y
coordinates.
(yPoints - 一个 y 坐标数组。)
nPoints
- a the total number of points.
(nPoints - 点的总数。)
Graphics.drawPolygon(int[], int[], int)
public void fillRect(int x, int y, int width, int height)
x
and
x + width - 1
. The top and bottom edges are at
y
and
y + height - 1
. The resulting rectangle covers an area
width
pixels wide by
height
pixels tall. The rectangle is filled using the graphics context's current color.
(填充指定的矩形。矩形的左右边缘位于 x 和 x + 宽度 - 1。顶部和底部边缘位于 y 和 y + 高度 - 1。生成的矩形覆盖区域宽度像素宽 x 高度像素高。使用图形上下文的当前颜色填充矩形。)
fillRect
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 fillRect)
x
- the
x coordinate of the rectangle to be filled.
(x - 要填充的矩形的 x 坐标。)
y
- the
y coordinate of the rectangle to be filled.
(y - 要填充的矩形的 y 坐标。)
width
- the width of the rectangle to be filled.
(width - 要填充的矩形的宽度。)
height
- the height of the rectangle to be filled.
(height - 要填充的矩形的高度。)
Graphics.clearRect(int, int, int, int)
,
Graphics.drawRect(int, int, int, int)
public void drawRect(int x, int y, int width, int height)
x
and
x + width
. The top and bottom edges are at
y
and
y + height
. The rectangle is drawn using the graphics context's current color.
(绘制指定矩形的轮廓。矩形的左右边缘位于 x 和 x + 宽度处。顶部和底部边缘位于 y 和 y + 高度。矩形是使用图形上下文的当前颜色绘制的。)
drawRect
in class
java.awt.Graphics
x
- the
x coordinate of the rectangle to be drawn.
(x - 要绘制的矩形的 x 坐标。)
y
- the
y coordinate of the rectangle to be drawn.
(y - 要绘制的矩形的 y 坐标。)
width
- the width of the rectangle to be drawn.
(width - 要绘制的矩形的宽度。)
height
- the height of the rectangle to be drawn.
(height - 要绘制的矩形的高度。)
Graphics.fillRect(int, int, int, int)
,
Graphics.clearRect(int, int, int, int)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line segments, where the first nPoint - 1
line segments are line segments from (xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for 1 ≤ i ≤ nPoints
. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.
drawPolygon
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawPolygon)
xPoints
- a an array of
x
coordinates.
(xPoints - 一个 x 坐标数组。)
yPoints
- a an array of
y
coordinates.
(yPoints - 一个 y 坐标数组。)
nPoints
- a the total number of points.
(nPoints - 点的总数。)
Graphics.fillPolygon(int[],int[],int)
,
Graphics.drawPolyline(int[], int[], int)
public void clipRect(int x, int y, int width, int height)
setClip(null)
, the specified rectangle becomes the new clip. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility. This method can only be used to make the current clip smaller. To set the current clip larger, use any of the setClip methods. Rendering operations have no effect outside of the clipping area.
(将当前剪辑与指定的矩形相交。生成的剪切区域是当前剪切区域和指定矩形的交集。如果没有当前剪辑区域,或者因为剪辑从未被设置,或者剪辑已使用 setClip(null) 清除,则指定的矩形成为新剪辑。此方法设置用户剪辑,该剪辑独立于与设备边界和窗口可见性相关的剪辑。此方法只能用于使当前剪辑更小。要将当前剪辑设置得更大,请使用任何 setClip 方法。渲染操作在剪切区域之外没有任何影响。)
clipRect
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 clipRect)
x
- the x coordinate of the rectangle to intersect the clip with
(x - 与剪辑相交的矩形的 x 坐标)
y
- the y coordinate of the rectangle to intersect the clip with
(y - 与剪辑相交的矩形的 y 坐标)
width
- the width of the rectangle to intersect the clip with
(width - 与剪辑相交的矩形的宽度)
height
- the height of the rectangle to intersect the clip with
(height - 与剪辑相交的矩形的高度)
setClip(int, int, int, int)
,
setClip(Shape)
@NotImplemented public void setClip(java.awt.Shape clip)
Shape
interface can be used to set the clip. The only
Shape
objects that are guaranteed to be supported are
Shape
objects that are obtained via the
getClip
method and via
Rectangle
objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.
(将当前剪辑区域设置为任意剪辑形状。并非所有实现 Shape 接口的对象都可以用于设置剪辑。唯一保证支持的 Shape 对象是通过 getClip 方法和 Rectangle 对象获得的 Shape 对象。此方法设置用户剪辑,该剪辑独立于与设备边界和窗口可见性相关的剪辑。)
setClip
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setClip)
clip
- the
Shape
to use to set the clip
(clip - 用于设置剪辑的形状)
Graphics.getClip()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
public java.awt.Rectangle getClipBounds()
setClip(null)
, this method returns
null
. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context.
(返回当前剪切区域的边界矩形。此方法引用用户剪辑,它独立于与设备边界和窗口可见性相关的剪辑。如果之前没有设置剪辑,或者如果剪辑已使用 setClip(null) 清除,则此方法返回 null。矩形中的坐标相对于该图形上下文的坐标系原点。)
getClipBounds
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 getClipBounds)
null
if no clip is set.
(当前剪辑区域的边界矩形,如果没有设置剪辑,则为 null。)
Graphics.getClip()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
drawString
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawString)
iterator
- the iterator whose text is to be drawn
(iterator - 要绘制其文本的迭代器)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public void clearRect(int x, int y, int width, int height)
Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use setColor
followed by fillRect
to ensure that an offscreen image is cleared to a specific color.
clearRect
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 clearRect)
x
- the
x coordinate of the rectangle to clear.
(x - 要清除的矩形的 x 坐标。)
y
- the
y coordinate of the rectangle to clear.
(y - 要清除的矩形的 y 坐标。)
width
- the width of the rectangle to clear.
(width - 要清除的矩形的宽度。)
height
- the height of the rectangle to clear.
(height - 要清除的矩形的高度。)
Graphics.fillRect(int, int, int, int)
,
Graphics.drawRect(int, int, int, int)
,
Graphics.setColor(java.awt.Color)
,
Graphics.setPaintMode()
,
Graphics.setXORMode(java.awt.Color)
public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 copyArea)
public void setClip(int x, int y, int width, int height)
setClip
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setClip)
x
- the
x coordinate of the new clip rectangle.
(x - 新剪辑矩形的 x 坐标。)
y
- the
y coordinate of the new clip rectangle.
(y - 新剪辑矩形的 y 坐标。)
width
- the width of the new clip rectangle.
(width - 新剪辑矩形的宽度。)
height
- the height of the new clip rectangle.
(height - 新剪辑矩形的高度。)
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(Shape)
public void rotate(double theta)
Graphics2D
Transform
with a rotation transform. Subsequent rendering is rotated by the specified radians relative to the previous origin. This is equivalent to calling
transform(R)
, where R is an
AffineTransform
represented by the following matrix:
[ cos(theta) -sin(theta) 0 ] [ sin(theta) cos(theta) 0 ] [ 0 0 1 ]Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis. (将当前的 Graphics2D 变换与旋转变换连接起来。后续渲染相对于前一个原点旋转指定的弧度。这等效于调用 transform(R),其中 R 是由以下矩阵表示的 AffineTransform: [ cos(theta) -sin(theta) 0 ] [ sin(theta) cos(theta) 0 ] [ 0 0 1 ] Rotating以正角 theta 将正 x 轴上的点向正 y 轴旋转。)
rotate
in class
java.awt.Graphics2D
(在类 java.awt.Graphics2D 中旋转)
theta
- the angle of rotation in radians
(theta - 以弧度为单位的旋转角度)
public void rotate(double theta, double x, double y)
Graphics2D
Transform
with a translated rotation transform. Subsequent rendering is transformed by a transform which is constructed by translating to the specified location, rotating by the specified radians, and translating back by the same amount as the original translation. This is equivalent to the following sequence of calls:
translate(x, y); rotate(theta); translate(-x, -y);Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis. (将当前的 Graphics2D 变换与平移的旋转变换连接起来。随后的渲染通过一个变换进行变换,该变换是通过平移到指定的位置、旋转指定的弧度并向后平移与原始平移相同的量来构建的。这等效于以下调用序列: translate(x, y);旋转(θ);翻译(-x,-y);以正角 theta 旋转会将正 x 轴上的点向正 y 轴旋转。)
rotate
in class
java.awt.Graphics2D
(在类 java.awt.Graphics2D 中旋转)
theta
- the angle of rotation in radians
(theta - 以弧度为单位的旋转角度)
x
- x coordinate of the origin of the rotation
(x - 旋转原点的 x 坐标)
y
- y coordinate of the origin of the rotation
(y - 旋转原点的 y 坐标)
public void shear(double shx, double shy)
Graphics2D
Transform
with a shearing transform. Subsequent renderings are sheared by the specified multiplier relative to the previous position. This is equivalent to calling
transform(SH)
, where SH is an
AffineTransform
represented by the following matrix:
[ 1 shx 0 ] [ shy 1 0 ] [ 0 0 1 ](将当前的 Graphics2D 变换与剪切变换连接起来。随后的渲染被相对于先前位置的指定乘数剪切。这等效于调用 transform(SH),其中 SH 是由以下矩阵表示的 AffineTransform: [ 1 shx 0 ] [ shy 1 0 ] [ 0 0 1 ])
shear
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的剪切)
shx
- the multiplier by which coordinates are shifted in the positive X axis direction as a function of their Y coordinate
(shx - 坐标在 X 轴正方向上作为 Y 坐标函数的移动乘数)
shy
- the multiplier by which coordinates are shifted in the positive Y axis direction as a function of their X coordinate
(shy - 坐标在 Y 轴正方向上移动的乘数,作为 X 坐标的函数)
public java.awt.font.FontRenderContext getFontRenderContext()
Font
within this
Graphics2D
context. The
FontRenderContext
encapsulates application hints such as anti-aliasing and fractional metrics, as well as target device specific information such as dots-per-inch. This information should be provided by the application when using objects that perform typographical formatting, such as
Font
and
TextLayout
. This information should also be provided by applications that perform their own layout and need accurate measurements of various characteristics of glyphs such as advance and line height when various rendering hints have been applied to the text rendering.
(在此 Graphics2D 上下文中获取字体的渲染上下文。 FontRenderContext 封装了应用程序提示,例如抗锯齿和分数指标,以及目标设备特定信息,例如每英寸点数。当使用执行印刷格式的对象(如 Font 和 TextLayout)时,应用程序应提供此信息。当各种渲染提示已应用于文本渲染时,执行自己的布局并需要准确测量字形的各种特征(例如前进和行高)的应用程序也应提供此信息。)
getFontRenderContext
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getFontRenderContext)
FontRenderContext
,
Font.createGlyphVector(FontRenderContext,char[])
,
TextLayout
public void transform(java.awt.geom.AffineTransform Tx)
AffineTransform
object with the
Transform
in this
Graphics2D
according to the rule last-specified-first-applied. If the current
Transform
is Cx, the result of composition with Tx is a new
Transform
Cx'. Cx' becomes the current
Transform
for this
Graphics2D
. Transforming a point p by the updated
Transform
Cx' is equivalent to first transforming p by Tx and then transforming the result by the original
Transform
Cx. In other words, Cx'(p) = Cx(Tx(p)). A copy of the Tx is made, if necessary, so further modifications to Tx do not affect rendering.
(根据 last-specified-first-applied 规则,在此 Graphics2D 中使用 Transform 组合一个 AffineTransform 对象。如果当前Transform是Cx,则与Tx合成的结果是一个新的Transform Cx'。 Cx' 成为此 Graphics2D 的当前变换。通过更新的 Transform Cx' 对点 p 进行变换,相当于先通过 Tx 对 p 进行变换,然后通过原始的 Transform Cx 对结果进行变换。换句话说,Cx'(p) = Cx(Tx(p))。如有必要,会制作 Tx 的副本,因此对 Tx 的进一步修改不会影响渲染。)
transform
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的变换)
Tx
- the
AffineTransform
object to be composed with the current
Transform
(Tx - 要与当前 Transform 组合的 AffineTransform 对象)
setTransform(java.awt.geom.AffineTransform)
,
AffineTransform
public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)
BufferedImage
that is filtered with a
BufferedImageOp
. The rendering attributes applied include the
Clip
,
Transform
and
Composite
attributes. This is equivalent to:
img1 = op.filter(img, null); drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);(渲染使用 BufferedImageOp 过滤的 BufferedImage。应用的渲染属性包括 Clip、Transform 和 Composite 属性。这相当于: img1 = op.filter(img, null); drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);)
drawImage
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawImage)
img
- the
BufferedImage
to be rendered
(img - 要渲染的 BufferedImage)
op
- the filter to be applied to the image before rendering
(op - 渲染前应用于图像的过滤器)
x
- the x coordinate in user space where the image is rendered
(x - 渲染图像的用户空间中的 x 坐标)
y
- the y coordinate in user space where the image is rendered
(y - 渲染图像的用户空间中的 y 坐标)
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(Shape)
public void setBackground(java.awt.Color color)
Graphics2D
context. The background color is used for clearing a region. When a
Graphics2D
is constructed for a
Component
, the background color is inherited from the
Component
. Setting the background color in the
Graphics2D
context only affects the subsequent
clearRect
calls and not the background color of the
Component
. To change the background of the
Component
, use appropriate methods of the
Component
.
(设置 Graphics2D 上下文的背景颜色。背景颜色用于清除区域。为 Component 构造 Graphics2D 时,从 Component 继承背景颜色。在 Graphics2D 上下文中设置背景颜色只会影响后续的 clearRect 调用,不会影响组件的背景颜色。要更改组件的背景,请使用组件的适当方法。)
setBackground
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setBackground)
color
- the background color that isused in subsequent calls to
clearRect
(color - 在对 clearRect 的后续调用中使用的背景颜色)
getBackground()
,
Graphics.clearRect(int, int, int, int)
public java.awt.Color getBackground()
getBackground
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getBackground)
Graphics2D
Color
, which defines the background color.
(当前的 Graphics2D 颜色,它定义了背景颜色。)
setBackground(java.awt.Color)
@NotImplemented public void setComposite(java.awt.Composite comp)
Composite
for the
Graphics2D
context. The
Composite
is used in all drawing methods such as
drawImage
,
drawString
,
draw
, and
fill
. It specifies how new pixels are to be combined with the existing pixels on the graphics device during the rendering process.
If this Graphics2D
context is drawing to a Component
on the display screen and the Composite
is a custom object rather than an instance of the AlphaComposite
class, and if there is a security manager, its checkPermission
method is called with an AWTPermission("readDisplayPixels")
permission.
setComposite
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setComposite)
comp
- the
Composite
object to be used for rendering
(comp - 用于渲染的 Composite 对象)
java.lang.SecurityException
- if a custom
Composite
object is being used to render to the screen and a security manager is set and its
checkPermission
method does not allow the operation.
(java.lang.SecurityException - 如果自定义 Composite 对象被用于呈现到屏幕并且设置了安全管理器并且其 checkPermission 方法不允许该操作。)
Graphics.setXORMode(java.awt.Color)
,
Graphics.setPaintMode()
,
AlphaComposite
@NotImplemented public java.awt.Composite getComposite()
Composite
in the
Graphics2D
context.
(返回 Graphics2D 上下文中的当前 Composite。)
getComposite
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getComposite)
Graphics2D
Composite
, which defines a compositing style.
(当前的 Graphics2D Composite,它定义了一种合成风格。)
setComposite(java.awt.Composite)
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
RenderingHints
class for definitions of some common keys and values.
(返回渲染算法的单个首选项的值。提示类别包括渲染质量控制和渲染过程中的整体时间/质量权衡。有关一些常用键和值的定义,请参阅 RenderingHints 类。)
getRenderingHint
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getRenderingHint)
hintKey
- the key corresponding to the hint to get.
(hintKey - 要获取的提示对应的键。)
RenderingHints
class.
(表示指定提示键值的对象。一些键及其关联值在 RenderingHints 类中定义。)
RenderingHints
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
RenderingHints
class for definitions of some common keys and values.
(为渲染算法设置单个首选项的值。提示类别包括渲染质量控制和渲染过程中的整体时间/质量权衡。有关一些常用键和值的定义,请参阅 RenderingHints 类。)
setRenderingHint
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setRenderingHint)
hintKey
- the key of the hint to be set.
(hintKey - 要设置的提示的键。)
hintValue
- the value indicating preferences for the specified hint category.
(hintValue - 指示指定提示类别的首选项的值。)
RenderingHints
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
GlyphVector
using the
Graphics2D
context's rendering attributes. The rendering attributes applied include the
Clip
,
Transform
,
Paint
, and
Composite
attributes. The
GlyphVector
specifies individual glyphs from a
Font
. The
GlyphVector
can also contain the glyph positions. This is the fastest way to render a set of characters to the screen.
(使用 Graphics2D 上下文的呈现属性呈现指定 GlyphVector 的文本。应用的渲染属性包括 Clip、Transform、Paint 和 Composite 属性。 GlyphVector 指定字体中的各个字形。 GlyphVector 也可以包含字形位置。这是将一组字符呈现到屏幕上的最快方式。)
drawGlyphVector
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawGlyphVector)
g
- the
GlyphVector
to be rendered
(g - 要渲染的 GlyphVector)
x
- the x position in user space where the glyphs should be rendered
(x - 用户空间中应呈现字形的 x 位置)
y
- the y position in user space where the glyphs should be rendered
(y - 应该呈现字形的用户空间中的 y 位置)
Font.createGlyphVector(FontRenderContext, char[])
,
GlyphVector
,
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
setClip(Shape)
public java.awt.GraphicsConfiguration getDeviceConfiguration()
Graphics2D
.
(返回与此 Graphics2D 关联的设备配置。)
getDeviceConfiguration
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getDeviceConfiguration)
public void addRenderingHints(java.util.Map<?,?> hints)
Map
object are modified. All other preferences not present in the specified object are left unmodified. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the
RenderingHints
class for definitions of some common keys and values.
(为渲染算法设置任意数量的首选项的值。仅修改指定 Map 对象中存在的呈现提示的值。指定对象中不存在的所有其他首选项保持不变。提示类别包括渲染质量控制和渲染过程中的整体时间/质量权衡。有关一些常用键和值的定义,请参阅 RenderingHints 类。)
addRenderingHints
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 addRenderingHints)
hints
- the rendering hints to be set
(提示 - 要设置的渲染提示)
RenderingHints
public void translate(double tx, double ty)
Graphics2D
Transform
with a translation transform. Subsequent rendering is translated by the specified distance relative to the previous position. This is equivalent to calling transform(T), where T is an
AffineTransform
represented by the following matrix:
[ 1 0 tx ] [ 0 1 ty ] [ 0 0 1 ](将当前的 Graphics2D 变换与平移变换连接起来。随后的渲染相对于前一个位置平移了指定的距离。这等效于调用 transform(T),其中 T 是由以下矩阵表示的 AffineTransform: [ 1 0 tx ] [ 0 1 ty ] [ 0 0 1 ])
translate
in class
java.awt.Graphics2D
(在类 java.awt.Graphics2D 中翻译)
tx
- the distance to translate along the x-axis
(tx - 沿 x 轴平移的距离)
ty
- the distance to translate along the y-axis
(ty - 沿 y 轴平移的距离)
@NotImplemented public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)
Graphics2D
context's current
Paint
. The iterator must specify a font for each character. The baseline of the first character is at position (
x,
y) in the User Space. The rendering attributes applied include the
Clip
,
Transform
,
Paint
, and
Composite
attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.
(使用 Graphics2D 上下文的当前 Paint 呈现指定迭代器的文本。迭代器必须为每个字符指定一种字体。第一个字符的基线位于用户空间中的位置 (x, y)。应用的渲染属性包括 Clip、Transform、Paint 和 Composite 属性。对于希伯来语和阿拉伯语等脚本系统中的字符,字形可以从右到左呈现,在这种情况下,提供的坐标是基线上最左侧字符的位置。)
drawString
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawString)
iterator
- the iterator whose text is to be rendered
(iterator - 要呈现其文本的迭代器)
x
- the x coordinate where the iterator's text is to be rendered
(x - 要呈现迭代器文本的 x 坐标)
y
- the y coordinate where the iterator's text is to be rendered
(y - 要呈现迭代器文本的 y 坐标)
setPaint(java.awt.Paint)
,
Graphics.setColor(java.awt.Color)
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
setClip(java.awt.Shape)
public boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)
Shape
intersects the specified
Rectangle
, which is in device space. If
onStroke
is false, this method checks whether or not the interior of the specified
Shape
intersects the specified
Rectangle
. If
onStroke
is
true
, this method checks whether or not the
Stroke
of the specified
Shape
outline intersects the specified
Rectangle
. The rendering attributes taken into account include the
Clip
,
Transform
, and
Stroke
attributes.
(检查指定的 Shape 是否与设备空间中的指定 Rectangle 相交。如果 onStroke 为 false,则此方法检查指定 Shape 的内部是否与指定的 Rectangle 相交。如果 onStroke 为真,则此方法检查指定 Shape 轮廓的 Stroke 是否与指定 Rectangle 相交。考虑的渲染属性包括 Clip、Transform 和 Stroke 属性。)
hit
in class
java.awt.Graphics2D
(命中类 java.awt.Graphics2D)
rect
- the area in device space to check for a hit
(rect - 设备空间中用于检查命中的区域)
s
- the
Shape
to check for a hit
(s - 检查命中的形状)
onStroke
- flag used to choose between testing the stroked or the filled shape. If the flag is
true
, the
Stroke
oultine is tested. If the flag is
false
, the filled
Shape
is tested.
(onStroke - 用于在测试描边或填充形状之间进行选择的标志。如果标志为真,则测试 Stroke oultine。如果标志为假,则测试填充的形状。)
true
if there is a hit;
false
otherwise.
(如果有命中则为真;否则为假。)
setStroke(java.awt.Stroke)
,
fill(Shape)
,
draw(Shape)
,
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
clip(java.awt.Shape)
,
setClip(Shape)
public java.awt.RenderingHints getRenderingHints()
RenderingHints
class for definitions of some common keys and values.
(获取渲染算法的首选项。提示类别包括渲染质量控制和渲染过程中的整体时间/质量权衡。返回曾经在一个操作中指定的所有提示键/值对。有关一些常用键和值的定义,请参阅 RenderingHints 类。)
getRenderingHints
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 getRenderingHints)
RenderingHints
that contains the current preferences.
(对包含当前首选项的 RenderingHints 实例的引用。)
RenderingHints
public void setRenderingHints(java.util.Map<?,?> hints)
hints
. The existing values for all rendering hints are discarded and the new set of known hints and values are initialized from the specified
Map
object. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process. Refer to the
RenderingHints
class for definitions of some common keys and values.
(用指定的提示替换渲染算法的所有首选项的值。所有渲染提示的现有值都被丢弃,新的已知提示和值集从指定的 Map 对象初始化。提示类别包括渲染质量控制和渲染过程中的整体时间/质量权衡。有关一些常用键和值的定义,请参阅 RenderingHints 类。)
setRenderingHints
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 setRenderingHints)
hints
- the rendering hints to be set
(提示 - 要设置的渲染提示)
RenderingHints
@NotImplemented public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)
Transform
in the
Graphics2D
. The specified transformation is applied to the image before the transform attribute in the
Graphics2D
context is applied. The rendering attributes applied include the
Clip
,
Transform
, and
Composite
attributes. Note that no rendering is done if the specified transform is noninvertible.
(渲染图像,在绘制之前应用从图像空间到用户空间的变换。从用户空间到设备空间的转换是通过 Graphics2D 中的当前转换完成的。在应用 Graphics2D 上下文中的 transform 属性之前,将指定的变换应用于图像。应用的渲染属性包括 Clip、Transform 和 Composite 属性。请注意,如果指定的变换是不可逆的,则不会进行渲染。)
drawImage
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawImage)
img
- the
Image
to be rendered
(img - 要渲染的图像)
xform
- the transformation from image space into user space
(xform - 从图像空间到用户空间的转换)
obs
- the
ImageObserver
to be notified as more of the
Image
is converted
(obs - 当更多图像被转换时要通知的 ImageObserver)
true
if the
Image
is fully loaded and completely rendered;
false
if the
Image
is still being loaded.
(如果图像已完全加载并完全渲染,则为 true;如果图像仍在加载中,则返回 false。)
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(Shape)
@NotImplemented public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there.
This method returns immediately in all cases, even if the entire image has not yet been scaled, dithered, and converted for the current output device. If the current output representation is not yet complete, then drawImage
returns false
. As more of the image becomes available, the process that loads the image notifies the image observer by calling its imageUpdate
method.
A scaled version of an image will not necessarily be available immediately just because an unscaled version of the image has been constructed for this output device. Each size of the image may be cached separately and generated from the original data in a separate image production sequence.
(绘制尽可能多的指定图像,该图像已缩放以适合指定矩形。图像绘制在此图形上下文坐标空间的指定矩形内,并在必要时进行缩放。透明像素不会影响已经存在的任何像素。此方法在所有情况下都会立即返回,即使尚未针对当前输出设备对整个图像进行缩放、抖动和转换也是如此。如果当前输出表示尚未完成,则 drawImage 返回 false。随着更多图像可用,加载图像的进程通过调用其 imageUpdate 方法通知图像观察者。图像的缩放版本不一定会立即可用,因为已经为此输出设备构建了图像的未缩放版本。图像的每个大小都可以单独缓存,并从单独的图像生成序列中的原始数据生成。)drawImage
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 drawImage)
img
- the specified image to be drawn. This method does nothing if
img
is null.
(img - 要绘制的指定图像。如果 img 为 null,则此方法不执行任何操作。)
x
- the
x coordinate.
(x - x 坐标。)
y
- the
y coordinate.
(y - y 坐标。)
width
- the width of the rectangle.
(width - 矩形的宽度。)
height
- the height of the rectangle.
(height - 矩形的高度。)
observer
- object to be notified as more of the image is converted.
(观察者 - 当更多图像被转换时要通知的对象。)
false
if the image pixels are still changing;
true
otherwise.
(如果图像像素仍在变化,则为 false;否则为真。)
Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public java.awt.Graphics create()
Graphics
object that is a copy of this
Graphics
object.
(创建一个新的 Graphics 对象,该对象是此 Graphics 对象的副本。)
create
in class
java.awt.Graphics
(在类 java.awt.Graphics 中创建)
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
getFontMetrics
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 getFontMetrics)
f
- the specified font
(f - 指定的字体)
Graphics.getFont()
,
FontMetrics
,
Graphics.getFontMetrics()
@NotImplemented public void setXORMode(java.awt.Color c1)
When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.
Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.
(设置此图形上下文的绘制模式以在此图形上下文的当前颜色和新指定颜色之间交替。这指定在 XOR 模式下执行逻辑像素操作,该模式在当前颜色和指定的 XOR 颜色之间交替像素。当执行绘图操作时,当前颜色的像素被更改为指定的颜色,反之亦然。具有这两种颜色以外颜色的像素以不可预测但可逆的方式发生变化;如果相同的图形被绘制两次,那么所有的像素都会恢复到它们的原始值。)setXORMode
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setXORMode)
c1
- the XOR alternation color
(c1 - XOR 交替颜色)
@NotImplemented public void setPaintMode()
setPaintMode
in class
java.awt.Graphics
(类 java.awt.Graphics 中的 setPaintMode)
@NotImplemented public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
RenderableImage
, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current
Transform
in the
Graphics2D
. The specified transformation is applied to the image before the transform attribute in the
Graphics2D
context is applied. The rendering attributes applied include the
Clip
,
Transform
, and
Composite
attributes. Note that no rendering is done if the specified transform is noninvertible.
Rendering hints set on the Graphics2D
object might be used in rendering the RenderableImage
. If explicit control is required over specific hints recognized by a specific RenderableImage
, or if knowledge of which hints are used is required, then a RenderedImage
should be obtained directly from the RenderableImage
and rendered using drawRenderedImage
.
drawRenderedImage
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawRenderedImage)
img
- the image to be rendered. This method does nothing if
img
is null.
(img - 要渲染的图像。如果 img 为 null,则此方法不执行任何操作。)
xform
- the transformation from image space into user space
(xform - 从图像空间到用户空间的转换)
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
,
drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)
@NotImplemented public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
RenderedImage
, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current
Transform
in the
Graphics2D
. The specified transformation is applied to the image before the transform attribute in the
Graphics2D
context is applied. The rendering attributes applied include the
Clip
,
Transform
, and
Composite
attributes. Note that no rendering is done if the specified transform is noninvertible.
(渲染一个 RenderedImage,在绘制之前应用从图像空间到用户空间的变换。从用户空间到设备空间的转换是通过 Graphics2D 中的当前转换完成的。在应用 Graphics2D 上下文中的 transform 属性之前,将指定的变换应用于图像。应用的渲染属性包括 Clip、Transform 和 Composite 属性。请注意,如果指定的变换是不可逆的,则不会进行渲染。)
drawRenderableImage
in class
java.awt.Graphics2D
(类 java.awt.Graphics2D 中的 drawRenderableImage)
img
- the image to be rendered. This method does nothing if
img
is null.
(img - 要渲染的图像。如果 img 为 null,则此方法不执行任何操作。)
xform
- the transformation from image space into user space
(xform - 从图像空间到用户空间的转换)
_transform
,
setTransform(java.awt.geom.AffineTransform)
,
setComposite(java.awt.Composite)
,
clip(java.awt.Shape)
,
setClip(java.awt.Shape)
protected void applyStroke(SimpleShape<?,?> shape)
protected void applyPaint(SimpleShape<?,?> shape)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.