graphics.html

来自「API資料大全」· HTML 代码 · 共 1,336 行 · 第 1/5 页

HTML
1,336
字号
 <code>Graphics</code> object, but with a new translation and clip area. The new <code>Graphics</code> object has its origin  translated to the specified point (<i>x</i>,&nbsp;<i>y</i>).  Its clip area is determined by the intersection of the original clip area with the specified rectangle.  The arguments are all interpreted in the coordinate system of the original  <code>Graphics</code> object. The new graphics context is  identical to the original, except in two respects:  <p> <ul> <li> The new graphics context is translated by (<i>x</i>,&nbsp;<i>y</i>).   That is to say, the point (<code>0</code>,&nbsp;<code>0</code>) in the  new graphics context is the same as (<i>x</i>,&nbsp;<i>y</i>) in  the original graphics context.  <li> The new graphics context has an additional clipping rectangle, in  addition to whatever (translated) clipping rectangle it inherited  from the original graphics context. The origin of the new clipping  rectangle is at (<code>0</code>,&nbsp;<code>0</code>), and its size   is specified by the <code>width</code> and <code>height</code> arguments. </ul> <p><DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the <i>x</i> coordinate.<DD><CODE>y</CODE> - the <i>y</i> coordinate.<DD><CODE>width</CODE> - the width of the clipping rectangle.<DD><CODE>height</CODE> - the height of the clipping rectangle.<DT><B>Returns:</B><DD>a new graphics context.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#translate(int, int)"><CODE>translate(int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A></DL></DD></DL><HR><A NAME="translate(int, int)"><!-- --></A><H3>translate</H3><PRE>public abstract void <B>translate</B>(int&nbsp;x,                               int&nbsp;y)</PRE><DL><DD>Translates the origin of the graphics context to the point (<i>x</i>,&nbsp;<i>y</i>) in the current coordinate system.  Modifies this graphics context so that its new origin corresponds  to the point (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's  original coordinate system.  All coordinates used in subsequent  rendering operations on this graphics context will be relative  to this new origin.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the <i>x</i> coordinate.<DD><CODE>y</CODE> - the <i>y</i> coordinate.</DL></DD></DL><HR><A NAME="getColor()"><!-- --></A><H3>getColor</H3><PRE>public abstract <A HREF="../../java/awt/Color.html">Color</A> <B>getColor</B>()</PRE><DL><DD>Gets this graphics context's current color.<DD><DL><DT><B>Returns:</B><DD>this graphics context's current color.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Color.html"><CODE>Color</CODE></A>, <A HREF="../../java/awt/Graphics.html#setColor(java.awt.Color)"><CODE>setColor(java.awt.Color)</CODE></A></DL></DD></DL><HR><A NAME="setColor(java.awt.Color)"><!-- --></A><H3>setColor</H3><PRE>public abstract void <B>setColor</B>(<A HREF="../../java/awt/Color.html">Color</A>&nbsp;c)</PRE><DL><DD>Sets this graphics context's current color to the specified  color. All subsequent graphics operations using this graphics  context use this specified color.<DD><DL><DT><B>Parameters:</B><DD><CODE>c</CODE> - the new rendering color.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Color.html"><CODE>Color</CODE></A>, <A HREF="../../java/awt/Graphics.html#getColor()"><CODE>getColor()</CODE></A></DL></DD></DL><HR><A NAME="setPaintMode()"><!-- --></A><H3>setPaintMode</H3><PRE>public abstract void <B>setPaintMode</B>()</PRE><DL><DD>Sets the paint mode of this graphics context to overwrite the  destination with this graphics context's current color.  This sets the logical pixel operation function to the paint or overwrite mode.  All subsequent rendering operations will overwrite the destination with the current color.</DL><HR><A NAME="setXORMode(java.awt.Color)"><!-- --></A><H3>setXORMode</H3><PRE>public abstract void <B>setXORMode</B>(<A HREF="../../java/awt/Color.html">Color</A>&nbsp;c1)</PRE><DL><DD>Sets the paint mode of this graphics context to alternate between  this graphics context's current color and the new specified color.  This specifies that logical pixel operations are performed in the  XOR mode, which alternates pixels between the current color and  a specified XOR color.  <p> When drawing operations are performed, pixels which are the  current color are changed to the specified color, and vice versa.  <p> 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.<DD><DL><DT><B>Parameters:</B><DD><CODE>c1</CODE> - the XOR alternation color</DL></DD></DL><HR><A NAME="getFont()"><!-- --></A><H3>getFont</H3><PRE>public abstract <A HREF="../../java/awt/Font.html">Font</A> <B>getFont</B>()</PRE><DL><DD>Gets the current font.<DD><DL><DT><B>Returns:</B><DD>this graphics context's current font.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Font.html"><CODE>Font</CODE></A>, <A HREF="../../java/awt/Graphics.html#setFont(java.awt.Font)"><CODE>setFont(java.awt.Font)</CODE></A></DL></DD></DL><HR><A NAME="setFont(java.awt.Font)"><!-- --></A><H3>setFont</H3><PRE>public abstract void <B>setFont</B>(<A HREF="../../java/awt/Font.html">Font</A>&nbsp;font)</PRE><DL><DD>Sets this graphics context's font to the specified font.  All subsequent text operations using this graphics context  use this font.<DD><DL><DT><B>Parameters:</B><DD><CODE>font</CODE> - the font.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#getFont()"><CODE>getFont()</CODE></A>, <A HREF="../../java/awt/Graphics.html#drawString(java.lang.String, int, int)"><CODE>drawString(java.lang.String, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#drawBytes(byte[], int, int, int, int)"><CODE>drawBytes(byte[], int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#drawChars(char[], int, int, int, int)"><CODE>drawChars(char[], int, int, int, int)</CODE></A></DL></DD></DL><HR><A NAME="getFontMetrics()"><!-- --></A><H3>getFontMetrics</H3><PRE>public <A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> <B>getFontMetrics</B>()</PRE><DL><DD>Gets the font metrics of the current font.<DD><DL><DT><B>Returns:</B><DD>the font metrics of this graphics                     context's current font.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#getFont()"><CODE>getFont()</CODE></A>, <A HREF="../../java/awt/FontMetrics.html"><CODE>FontMetrics</CODE></A>, <A HREF="../../java/awt/Graphics.html#getFontMetrics(java.awt.Font)"><CODE>getFontMetrics(Font)</CODE></A></DL></DD></DL><HR><A NAME="getFontMetrics(java.awt.Font)"><!-- --></A><H3>getFontMetrics</H3><PRE>public abstract <A HREF="../../java/awt/FontMetrics.html">FontMetrics</A> <B>getFontMetrics</B>(<A HREF="../../java/awt/Font.html">Font</A>&nbsp;f)</PRE><DL><DD>Gets the font metrics for the specified font.<DD><DL><DT><B>Parameters:</B><DD><CODE>f</CODE> - the specified font<DT><B>Returns:</B><DD>the font metrics for the specified font.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#getFont()"><CODE>getFont()</CODE></A>, <A HREF="../../java/awt/FontMetrics.html"><CODE>FontMetrics</CODE></A>, <A HREF="../../java/awt/Graphics.html#getFontMetrics()"><CODE>getFontMetrics()</CODE></A></DL></DD></DL><HR><A NAME="getClipBounds()"><!-- --></A><H3>getClipBounds</H3><PRE>public abstract <A HREF="../../java/awt/Rectangle.html">Rectangle</A> <B>getClipBounds</B>()</PRE><DL><DD>Returns the bounding rectangle of the current clipping area. This method refers to the user clip, which is independent of the clipping associated with device bounds and window visibility.   If no clip has previously been set, or if the clip has been  cleared using <code>setClip(null)</code>, this method returns <code>null</code>. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context.<DD><DL><DT><B>Returns:</B><DD>the bounding rectangle of the current clipping area,              or <code>null</code> if no clip is set.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#getClip()"><CODE>getClip()</CODE></A>, <A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(java.awt.Shape)"><CODE>setClip(Shape)</CODE></A></DL></DD></DL><HR><A NAME="clipRect(int, int, int, int)"><!-- --></A><H3>clipRect</H3><PRE>public abstract void <B>clipRect</B>(int&nbsp;x,                              int&nbsp;y,                              int&nbsp;width,                              int&nbsp;height)</PRE><DL><DD>Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle.  If there is no  current clipping area, either because the clip has never been  set, or the clip has been cleared using <code>setClip(null)</code>,  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.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the x coordinate of the rectangle to intersect the clip with<DD><CODE>y</CODE> - the y coordinate of the rectangle to intersect the clip with<DD><CODE>width</CODE> - the width of the rectangle to intersect the clip with<DD><CODE>height</CODE> - the height of the rectangle to intersect the clip with<DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(java.awt.Shape)"><CODE>setClip(Shape)</CODE></A></DL></DD></DL><HR><A NAME="setClip(int, int, int, int)"><!-- --></A><H3>setClip</H3><PRE>public abstract void <B>setClip</B>(int&nbsp;x,                             int&nbsp;y,                             int&nbsp;width,                             int&nbsp;height)</PRE><DL><DD>Sets the current clip to the rectangle specified by the given coordinates.  This method sets the user clip, which is  independent of the clipping associated with device bounds and window visibility.   Rendering operations have no effect outside of the clipping area.<DD><DL><DT><B>Parameters:</B><DD><CODE>x</CODE> - the <i>x</i> coordinate of the new clip rectangle.<DD><CODE>y</CODE> - the <i>y</i> coordinate of the new clip rectangle.<DD><CODE>width</CODE> - the width of the new clip rectangle.<DD><CODE>height</CODE> - the height of the new clip rectangle.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(java.awt.Shape)"><CODE>setClip(Shape)</CODE></A></DL></DD></DL><HR><A NAME="getClip()"><!-- --></A><H3>getClip</H3><PRE>public abstract <A HREF="../../java/awt/Shape.html">Shape</A> <B>getClip</B>()</PRE><DL><DD>Gets the current clipping area. This method returns the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been  cleared using <code>setClip(null)</code>, this method returns  <code>null</code>.<DD><DL><DT><B>Returns:</B><DD>a <code>Shape</code> object representing the               current clipping area, or <code>null</code> if              no clip is set.<DT><B>Since: </B><DD>JDK1.1</DD><DT><B>See Also: </B><DD><A HREF="../../java/awt/Graphics.html#getClipBounds()"><CODE>getClipBounds()</CODE></A>, <A HREF="../../java/awt/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A>, <A HREF="../../java/awt/Graphics.html#setClip(java.awt.Shape)"><CODE>setClip(Shape)</CODE></A></DL></DD></DL><HR><A NAME="setClip(java.awt.Shape)"><!-- --></A><H3>setClip</H3><PRE>public abstract void <B>setClip</B>(<A HREF="../../java/awt/Shape.html">Shape</A>&nbsp;clip)</PRE><DL><DD>Sets the current clipping area to an arbitrary clip shape. Not all objects that implement the <code>Shape</code>  interface can be used to set the clip.  The only  <code>Shape</code> objects that are guaranteed to be  supported are <code>Shape</code> objects that are obtained via the <code>getClip</code> method and via  <code>Rectangle</code> objects.  This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.<DD><DL><DT><B>Parameters:</B><DD><CODE>clip</CODE> - the <code>Shape</code> to use to set the clip<DT><B>Since: </B><DD>JDK1.1</DD>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?