📄 graphics.html
字号:
<HR>
<A NAME="getRedComponent()"><!-- --></A><H3>
getRedComponent</H3>
<PRE>
public int <B>getRedComponent</B>()</PRE>
<DL>
<DD>Gets the red component of the current color.<DD><DL>
<DT><B>Returns:</B><DD>integer value in range <code>0-255</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#setColor(int, int, int)"><CODE>setColor(int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getGreenComponent()"><!-- --></A><H3>
getGreenComponent</H3>
<PRE>
public int <B>getGreenComponent</B>()</PRE>
<DL>
<DD>Gets the green component of the current color.<DD><DL>
<DT><B>Returns:</B><DD>integer value in range <code>0-255</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#setColor(int, int, int)"><CODE>setColor(int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getBlueComponent()"><!-- --></A><H3>
getBlueComponent</H3>
<PRE>
public int <B>getBlueComponent</B>()</PRE>
<DL>
<DD>Gets the blue component of the current color.<DD><DL>
<DT><B>Returns:</B><DD>integer value in range <code>0-255</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#setColor(int, int, int)"><CODE>setColor(int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getGrayScale()"><!-- --></A><H3>
getGrayScale</H3>
<PRE>
public int <B>getGrayScale</B>()</PRE>
<DL>
<DD>Gets the current grayscale value of the color being used for rendering operations. If the color was set by <code>setGrayScale()</code>, that value is simply returned. If the color was set by one of the methods that allows setting of the red, green, and blue components, the value returned is computed from the RGB color components (possibly in a device-specific fashion) that best approximates the brightness of that color.<DD><DL>
<DT><B>Returns:</B><DD>integer value in range <code>0-255</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#setGrayScale(int)"><CODE>setGrayScale(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setColor(int, int, int)"><!-- --></A><H3>
setColor</H3>
<PRE>
public void <B>setColor</B>(int red, int green, int blue)</PRE>
<DL>
<DD>Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>red</CODE> - the red component of the color being set in range <code>0-255</code><DD><CODE>green</CODE> - the green component of the color being set in range <code>0-255</code><DD><CODE>blue</CODE> - the blue component of the color being set in range <code>0-255</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if any of the color components are outside of range <code>0-255</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#getColor()"><CODE>getColor()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setColor(int)"><!-- --></A><H3>
setColor</H3>
<PRE>
public void <B>setColor</B>(int RGB)</PRE>
<DL>
<DD>Sets the current color to the specified RGB values. All subsequent rendering operations will use this specified color. The RGB value passed in is interpreted with the least significant eight bits giving the blue component, the next eight more significant bits giving the green component, and the next eight more significant bits giving the red component. That is to say, the color component is specified in the form of <code>0x00RRGGBB</code>. The high order byte of this value is ignored.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>RGB</CODE> - the color being set<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#getColor()"><CODE>getColor()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setGrayScale(int)"><!-- --></A><H3>
setGrayScale</H3>
<PRE>
public void <B>setGrayScale</B>(int value)</PRE>
<DL>
<DD>Sets the current grayscale to be used for all subsequent rendering operations. For monochrome displays, the behavior is clear. For color displays, this sets the color for all subsequent drawing operations to be a gray color equivalent to the value passed in. The value must be in the range <code>0-255</code>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the desired grayscale value<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the gray value is out of range<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#getGrayScale()"><CODE>getGrayScale()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getFont()"><!-- --></A><H3>
getFont</H3>
<PRE>
public <A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> <B>getFont</B>()</PRE>
<DL>
<DD>Gets the current font.<DD><DL>
<DT><B>Returns:</B><DD>current font<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html"><CODE>Font</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#setFont(javax.microedition.lcdui.Font)"><CODE>setFont(javax.microedition.lcdui.Font)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setStrokeStyle(int)"><!-- --></A><H3>
setStrokeStyle</H3>
<PRE>
public void <B>setStrokeStyle</B>(int style)</PRE>
<DL>
<DD>Sets the stroke style used for drawing lines, arcs, rectangles, and rounded rectangles. This does not affect fill, text, and image operations.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>style</CODE> - can be <code>SOLID</code> or <code>DOTTED</code><DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the <code>style</code> is illegal<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#getStrokeStyle()"><CODE>getStrokeStyle()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getStrokeStyle()"><!-- --></A><H3>
getStrokeStyle</H3>
<PRE>
public int <B>getStrokeStyle</B>()</PRE>
<DL>
<DD>Gets the stroke style used for drawing operations.<DD><DL>
<DT><B>Returns:</B><DD>stroke style, <code>SOLID</code> or <code>DOTTED</code><DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#setStrokeStyle(int)"><CODE>setStrokeStyle(int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setFont(javax.microedition.lcdui.Font)"><!-- --></A><H3>
setFont</H3>
<PRE>
public void <B>setFont</B>(<A HREF="../../../javax/microedition/lcdui/Font.html">Font</A> font)</PRE>
<DL>
<DD>Sets the font for all subsequent text rendering operations. If font is <code>null</code>, it is equivalent to <code>setFont(Font.getDefaultFont())</code>.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>font</CODE> - the specified font<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Font.html"><CODE>Font</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#getFont()"><CODE>getFont()</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#drawString(java.lang.String, int, int, int)"><CODE>drawString(java.lang.String, int, int, int)</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#drawChars(char[], int, int, int, int, int)"><CODE>drawChars(char[], int, int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getClipX()"><!-- --></A><H3>
getClipX</H3>
<PRE>
public int <B>getClipX</B>()</PRE>
<DL>
<DD>Gets the X offset of the current clipping area, relative to the coordinate system origin of this graphics context. Separating the <code>getClip</code> operation into two methods returning integers is more performance and memory efficient than one <code>getClip()</code> call returning an object.<DD><DL>
<DT><B>Returns:</B><DD>X offset of the current clipping area<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getClipY()"><!-- --></A><H3>
getClipY</H3>
<PRE>
public int <B>getClipY</B>()</PRE>
<DL>
<DD>Gets the Y offset of the current clipping area, relative to the coordinate system origin of this graphics context. Separating the <code>getClip</code> operation into two methods returning integers is more performance and memory efficient than one <code>getClip()</code> call returning an object.<DD><DL>
<DT><B>Returns:</B><DD>Y offset of the current clipping area<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getClipWidth()"><!-- --></A><H3>
getClipWidth</H3>
<PRE>
public int <B>getClipWidth</B>()</PRE>
<DL>
<DD>Gets the width of the current clipping area.<DD><DL>
<DT><B>Returns:</B><DD>width of the current clipping area.<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getClipHeight()"><!-- --></A><H3>
getClipHeight</H3>
<PRE>
public int <B>getClipHeight</B>()</PRE>
<DL>
<DD>Gets the height of the current clipping area.<DD><DL>
<DT><B>Returns:</B><DD>height of the current clipping area.<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A>,
<A HREF="../../../javax/microedition/lcdui/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="clipRect(int, int, int, int)"><!-- --></A><H3>
clipRect</H3>
<PRE>
public void <B>clipRect</B>(int x, int y, int width, int 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. This method can only be used to make the current clip smaller. To set the current clip larger, use the <code>setClip</code> method. 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="../../../javax/microedition/lcdui/Graphics.html#setClip(int, int, int, int)"><CODE>setClip(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setClip(int, int, int, int)"><!-- --></A><H3>
setClip</H3>
<PRE>
public void <B>setClip</B>(int x, int y, int width, int height)</PRE>
<DL>
<DD>Sets the current clip to the rectangle specified by the given coordinates. 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 new clip rectangle<DD><CODE>y</CODE> - the y 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>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#clipRect(int, int, int, int)"><CODE>clipRect(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="drawLine(int, int, int, int)"><!-- --></A><H3>
drawLine</H3>
<PRE>
public void <B>drawLine</B>(int x1, int y1, int x2, int y2)</PRE>
<DL>
<DD>Draws a line between the coordinates <code>(x1,y1)</code> and <code>(x2,y2)</code> using the current color and stroke style.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x1</CODE> - the x coordinate of the start of the line<DD><CODE>y1</CODE> - the y coordinate of the start of the line<DD><CODE>x2</CODE> - the x coordinate of the end of the line<DD><CODE>y2</CODE> - the y coordinate of the end of the line</DL>
</DD>
</DL>
<HR>
<A NAME="fillRect(int, int, int, int)"><!-- --></A><H3>
fillRect</H3>
<PRE>
public void <B>fillRect</B>(int x, int y, int width, int height)</PRE>
<DL>
<DD>Fills the specified rectangle with the current color. If either width or height is zero or less, nothing is drawn.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>x</CODE> - the x coordinate of the rectangle to be filled<DD><CODE>y</CODE> - the y coordinate 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<DT><B>See Also: </B><DD><A HREF="../../../javax/microedition/lcdui/Graphics.html#drawRect(int, int, int, int)"><CODE>drawRect(int, int, int, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="drawRect(int, int, int, int)"><!-- --></A><H3>
drawRect</H3>
<PRE>
public void <B>drawRect</B>(int x, int y, int width, int height)</PRE>
<DL>
<DD>Draws the outline of the specified rectangle using the current color and stroke style. The resulting rectangle will cover an area <code>(width + 1)</code> pixels wide by <code>(height + 1)</code> pixels tall.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -