graphics2d.html
来自「API資料大全」· HTML 代码 · 共 1,145 行 · 第 1/5 页
HTML
1,145 行
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="draw3DRect(int, int, int, int, boolean)"><!-- --></A><H3>draw3DRect</H3><PRE>public void <B>draw3DRect</B>(int x, int y, int width, int height, boolean raised)</PRE><DL><DD>Draws a 3-D highlighted outline of the specified rectangle. The edges of the rectangle are highlighted so that they appear to be beveled and lit from the upper left corner. <p> The colors used for the highlighting effect are determined based on the current color. The resulting rectangle covers an area that is <code>width + 1</code> pixels wide by <code>height + 1</code> pixels tall. This method uses the current <code>Color</code> exclusively and ignores the current <code>Paint</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Graphics.html#draw3DRect(int, int, int, int, boolean)">draw3DRect</A></CODE> in class <CODE><A HREF="../../java/awt/Graphics.html">Graphics</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the coordinates of the rectangle to be drawn.<DD><CODE>width</CODE> - the width of the rectangle to be drawn.<DD><CODE>height</CODE> - the height of the rectangle to be drawn.<DD><CODE>raised</CODE> - a boolean that determines whether the rectangle appears to be raised above the surface or sunk into the surface.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#fill3DRect(int, int, int, int, boolean)"><CODE>Graphics.fill3DRect(int, int, int, int, boolean)</CODE></A></DL></DD></DL><HR><A NAME="fill3DRect(int, int, int, int, boolean)"><!-- --></A><H3>fill3DRect</H3><PRE>public void <B>fill3DRect</B>(int x, int y, int width, int height, boolean raised)</PRE><DL><DD>Paints a 3-D highlighted rectangle filled with the current color. The edges of the rectangle are highlighted so that it appears as if the edges were beveled and lit from the upper left corner. The colors used for the highlighting effect and for filling are determined from the current <code>Color</code>. This method uses the current <code>Color</code> exclusively and ignores the current <code>Paint</code>.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Graphics.html#fill3DRect(int, int, int, int, boolean)">fill3DRect</A></CODE> in class <CODE><A HREF="../../java/awt/Graphics.html">Graphics</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>x, y</CODE> - the coordinates of the rectangle to be filled.<DD><CODE>width</CODE> - the width of the rectangle to be filled.<DD><CODE>height</CODE> - the height of the rectangle to be filled.<DD><CODE>raised</CODE> - a boolean value that determines whether the rectangle appears to be raised above the surface or etched into the surface.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#draw3DRect(int, int, int, int, boolean)"><CODE>Graphics.draw3DRect(int, int, int, int, boolean)</CODE></A></DL></DD></DL><HR><A NAME="draw(java.awt.Shape)"><!-- --></A><H3>draw</H3><PRE>public abstract void <B>draw</B>(<A HREF="../../java/awt/Shape.html">Shape</A> s)</PRE><DL><DD>Strokes the outline of a <code>Shape</code> using the settings of the current <code>Graphics2D</code> context. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, <code>Paint</code>, <code>Composite</code> and <code>Stroke</code> attributes.<DD><DL><DT><B>Parameters:</B><DD><CODE>s</CODE> - the <code>Shape</code> to be rendered<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics2D.html#setStroke(java.awt.Stroke)"><CODE>setStroke(java.awt.Stroke)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setPaint(java.awt.Paint)"><CODE>setPaint(java.awt.Paint)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setColor(java.awt.Color)"><CODE>Graphics.setColor(java.awt.Color)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)"><CODE>transform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)"><CODE>setTransform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#clip(java.awt.Shape)"><CODE>clip(java.awt.Shape)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>Graphics.setClip(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setComposite(java.awt.Composite)"><CODE>setComposite(java.awt.Composite)</CODE></A></DL></DD></DL><HR><A NAME="drawImage(java.awt.Image, java.awt.geom.AffineTransform, java.awt.image.ImageObserver)"><!-- --></A><H3>drawImage</H3><PRE>public abstract boolean <B>drawImage</B>(<A HREF="../../java/awt/Image.html">Image</A> img, <A HREF="../../java/awt/geom/AffineTransform.html">AffineTransform</A> xform, <A HREF="../../java/awt/image/ImageObserver.html">ImageObserver</A> obs)</PRE><DL><DD>Renders an image, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current <code>Transform</code> in the <code>Graphics2D</code>. The specified transformation is applied to the image before the transform attribute in the <code>Graphics2D</code> context is applied. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, and <code>Composite</code> attributes. Note that no rendering is done if the specified transform is noninvertible.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the <code>Image</code> to be rendered<DD><CODE>xform</CODE> - the transformation from image space into user space<DD><CODE>obs</CODE> - the <A HREF="../../java/awt/image/ImageObserver.html"><CODE>ImageObserver</CODE></A> to be notified as more of the <code>Image</code> is converted<DT><B>Returns:</B><DD><code>true</code> if the <code>Image</code> is fully loaded and completely rendered; <code>false</code> if the <code>Image</code> is still being loaded.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)"><CODE>transform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)"><CODE>setTransform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setComposite(java.awt.Composite)"><CODE>setComposite(java.awt.Composite)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#clip(java.awt.Shape)"><CODE>clip(java.awt.Shape)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>Graphics.setClip(int, int, int, int)</CODE></A></DL></DD></DL><HR><A NAME="drawImage(java.awt.image.BufferedImage, java.awt.image.BufferedImageOp, int, int)"><!-- --></A><H3>drawImage</H3><PRE>public abstract void <B>drawImage</B>(<A HREF="../../java/awt/image/BufferedImage.html">BufferedImage</A> img, <A HREF="../../java/awt/image/BufferedImageOp.html">BufferedImageOp</A> op, int x, int y)</PRE><DL><DD>Renders a <code>BufferedImage</code> that is filtered with a <A HREF="../../java/awt/image/BufferedImageOp.html"><CODE>BufferedImageOp</CODE></A>. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code> and <code>Composite</code> attributes. This is equivalent to: <pre> img1 = op.filter(img, null); drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null); </pre><DD><DL><DT><B>Parameters:</B><DD><CODE>op</CODE> - the filter to be applied to the image before rendering<DD><CODE>img</CODE> - the <code>BufferedImage</code> to be rendered<DD><CODE>x, y</CODE> - the location in user space where the upper left corner of the image is rendered<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)"><CODE>transform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)"><CODE>setTransform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setComposite(java.awt.Composite)"><CODE>setComposite(java.awt.Composite)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#clip(java.awt.Shape)"><CODE>clip(java.awt.Shape)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>Graphics.setClip(int, int, int, int)</CODE></A></DL></DD></DL><HR><A NAME="drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)"><!-- --></A><H3>drawRenderedImage</H3><PRE>public abstract void <B>drawRenderedImage</B>(<A HREF="../../java/awt/image/RenderedImage.html">RenderedImage</A> img, <A HREF="../../java/awt/geom/AffineTransform.html">AffineTransform</A> xform)</PRE><DL><DD>Renders a <A HREF="../../java/awt/image/RenderedImage.html"><CODE>RenderedImage</CODE></A>, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current <code>Transform</code> in the <code>Graphics2D</code>. The specified transformation is applied to the image before the transform attribute in the <code>Graphics2D</code> context is applied. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, and <code>Composite</code> attributes. Note that no rendering is done if the specified transform is noninvertible.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the image to be rendered<DD><CODE>xform</CODE> - the transformation from image space into user space<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)"><CODE>transform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)"><CODE>setTransform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setComposite(java.awt.Composite)"><CODE>setComposite(java.awt.Composite)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#clip(java.awt.Shape)"><CODE>clip(java.awt.Shape)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>Graphics.setClip(int, int, int, int)</CODE></A></DL></DD></DL><HR><A NAME="drawRenderableImage(java.awt.image.renderable.RenderableImage, java.awt.geom.AffineTransform)"><!-- --></A><H3>drawRenderableImage</H3><PRE>public abstract void <B>drawRenderableImage</B>(<A HREF="../../java/awt/image/renderable/RenderableImage.html">RenderableImage</A> img, <A HREF="../../java/awt/geom/AffineTransform.html">AffineTransform</A> xform)</PRE><DL><DD>Renders a <A HREF="../../java/awt/image/renderable/RenderableImage.html"><CODE>RenderableImage</CODE></A>, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current <code>Transform</code> in the <code>Graphics2D</code>. The specified transformation is applied to the image before the transform attribute in the <code>Graphics2D</code> context is applied. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, and <code>Composite</code> attributes. Note that no rendering is done if the specified transform is noninvertible.<p> Rendering hints set on the <code>Graphics2D</code> object might be used in rendering the <code>RenderableImage</code>. If explicit control is required over specific hints recognized by a specific <code>RenderableImage</code>, or if knowledge of which hints are used is required, then a <code>RenderedImage</code> should be obtained directly from the <code>RenderableImage</code> and rendered using <A HREF="../../java/awt/Graphics2D.html#drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)"><CODE>drawRenderedImage</CODE></A>.<DD><DL><DT><B>Parameters:</B><DD><CODE>img</CODE> - the image to be rendered<DD><CODE>xform</CODE> - the transformation from image space into user space<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics2D.html#transform(java.awt.geom.AffineTransform)"><CODE>transform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setTransform(java.awt.geom.AffineTransform)"><CODE>setTransform(java.awt.geom.AffineTransform)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#setComposite(java.awt.Composite)"><CODE>setComposite(java.awt.Composite)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#clip(java.awt.Shape)"><CODE>clip(java.awt.Shape)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>Graphics.setClip(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics2D.html#drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)"><CODE>drawRenderedImage(java.awt.image.RenderedImage, java.awt.geom.AffineTransform)</CODE></A></DL></DD></DL><HR><A NAME="drawString(java.lang.String, int, int)"><!-- --></A><H3>drawString</H3><PRE>public abstract void <B>drawString</B>(<A HREF="../../java/lang/String.html">String</A> str, int x, int y)</PRE><DL><DD>Renders the text of the specified <code>String</code>, using the current <code>Font</code> and <code>Paint</code> attributes in the <code>Graphics2D</code> context. The baseline of the first character is at position (<i>x</i>, <i>y</i>) in the User Space. The rendering attributes applied include the <code>Clip</code>, <code>Transform</code>, <code>Paint</code>, <code>Font</code> and <code>Composite</code> 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.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/awt/Graphics.html#drawString(java.lang.String, int, int)">drawString</A></CODE> in class <CODE><A HREF="../../java/awt/Graphics.html">Graphics</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>str</CODE> - the string to be rendered<DD><CODE>x,&
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?