⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphics.java

📁 用于移动设备上的java虚拟机源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * @param y1 the y coordinate of the start of the line     * @param x2 the x coordinate of the end of the line     * @param y2 the y coordinate of the end of the line     */    public native void drawLine(int x1, int y1, int x2, int y2);    /**     * Fills the specified rectangle with the current color.     * If either width or height is zero or less,     * nothing is drawn.     * @param x the x coordinate of the rectangle to be filled     * @param y the y coordinate of the rectangle to be filled     * @param width the width of the rectangle to be filled     * @param height the height of the rectangle to be filled     * @see #drawRect(int, int, int, int)     */    public native void fillRect(int x, int y, int width, int height);     /**     * 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.     * If either width or height is less than     * zero, nothing is drawn.     * @param x the x coordinate of the rectangle to be drawn     * @param y the y coordinate of the rectangle to be drawn     * @param width the width of the rectangle to be drawn     * @param height the height of the rectangle to be drawn     * @see #fillRect(int, int, int, int)     */    public native void drawRect(int x, int y, int width, int height);    /**     * Draws the outline of the specified rounded corner 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.     * If either <code>width</code> or <code>height</code> is less than     * zero, nothing is drawn.     * @param x the x coordinate of the rectangle to be drawn     * @param y the y coordinate of the rectangle to be drawn     * @param width the width of the rectangle to be drawn     * @param height the height of the rectangle to be drawn     * @param arcWidth the horizontal diameter of the arc at the four corners     * @param arcHeight the vertical diameter of the arc at the four corners     * @see #fillRoundRect(int, int, int, int, int, int)     */    public native void drawRoundRect(int x, int y, int width, int height,                                     int arcWidth, int arcHeight);     /**     * Fills the specified rounded corner rectangle with the current color.     * If either <code>width</code> or <code>height</code> is zero or less,     * nothing is drawn.     * @param x the x coordinate of the rectangle to be filled     * @param y the y coordinate of the rectangle to be filled     * @param width the width of the rectangle to be filled     * @param height the height of the rectangle to be filled     * @param arcWidth the horizontal diameter of the arc at the four     * corners     * @param arcHeight the vertical diameter of the arc at the four corners     * @see #drawRoundRect(int, int, int, int, int, int)     */    public native void fillRoundRect(int x, int y, int width, int height,                                     int arcWidth, int arcHeight);                              /**     * Fills a circular or elliptical arc covering the specified rectangle.     * <p>     * The resulting arc begins at <code>startAngle</code> and extends     * for <code>arcAngle</code> degrees.     * Angles are interpreted such that <code>0</code> degrees     * is at the <code>3</code> o'clock position.     * A positive value indicates a counter-clockwise rotation     * while a negative value indicates a clockwise rotation.     * <p>     * The center of the arc is the center of the rectangle whose origin     * is (<em>x</em>,&nbsp;<em>y</em>) and whose size is specified by the     * <code>width</code> and <code>height</code> arguments.     * <p>     * If either <code>width</code> or <code>height</code> is zero or less,     * nothing is drawn.     *     * <p> The filled region consists of the &quot;pie wedge&quot;     * region bounded     * by the arc     * segment as if drawn by <code>drawArc()</code>, the radius extending from     * the center to     * this arc at <code>startAngle</code> degrees, and radius extending     * from the     * center to this arc at <code>startAngle + arcAngle</code> degrees. </p>     *     * <p> The angles are specified relative to the non-square extents of     * the bounding rectangle such that <code>45</code> 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. </p>     *     * @param x the <em>x</em> coordinate of the upper-left corner of     * the arc to be filled.     * @param y the <em>y</em> coordinate of the upper-left corner of the     * arc to be filled.     * @param width the width of the arc to be filled     * @param height the height of the arc to be filled     * @param startAngle the beginning angle.     * @param arcAngle the angular extent of the arc,     * relative to the start angle.     * @see #drawArc(int, int, int, int, int, int)     */    public native void fillArc(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,     * using the current color and stroke style.     * <p>     * The resulting arc begins at <code>startAngle</code> and extends     * for <code>arcAngle</code> degrees, using the current color.     * Angles are interpreted such that <code>0</code>&nbsp;degrees     * is at the <code>3</code>&nbsp;o'clock position.     * A positive value indicates a counter-clockwise rotation     * while a negative value indicates a clockwise rotation.     * <p>     * The center of the arc is the center of the rectangle whose origin     * is (<em>x</em>,&nbsp;<em>y</em>) and whose size is specified by the     * <code>width</code> and <code>height</code> arguments.     * <p>     * The resulting arc covers an area     * <code>width&nbsp;+&nbsp;1</code> pixels wide     * by <code>height&nbsp;+&nbsp;1</code> pixels tall.     * If either <code>width</code> or <code>height</code> is less than zero,     * nothing is drawn.     *     * <p> The angles are specified relative to the non-square extents of     * the bounding rectangle such that <code>45</code> 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. </p>     *     * @param x the <em>x</em> coordinate of the upper-left corner     * of the arc to be drawn     * @param y the <em>y</em> coordinate of the upper-left corner     * of the arc to be drawn     * @param width the width of the arc to be drawn     * @param height the height of the arc to be drawn     * @param startAngle the beginning angle     * @param arcAngle the angular extent of the arc, relative to     * the start angle     * @see #fillArc(int, int, int, int, int, int)     */    public native void drawArc(int x, int y, int width, int height,                               int startAngle, int arcAngle);    /**     * Draws the specified <code>String</code> using the current font and color.     * The <code>x,y</code> position is the position of the anchor point.     * See <a href="#anchor">anchor points</a>.     * @param str the <code>String</code> to be drawn     * @param x the x coordinate of the anchor point     * @param y the y coordinate of the anchor point     * @param anchor the anchor point for positioning the text     * @throws NullPointerException if <code>str</code> is <code>null</code>     * @throws IllegalArgumentException if anchor is not a legal value     * @see #drawChars(char[], int, int, int, int, int)     */    public native void drawString(java.lang.String str,                                  int x, int y, int anchor);    /**     * Draws the specified <code>String</code> using the current font and color.     * The <code>x,y</code> position is the position of the anchor point.     * See <a href="#anchor">anchor points</a>.     *     * <p>The <code>offset</code> and <code>len</code> parameters must     * specify a valid range of characters within     * the string <code>str</code>.     * The <code>offset</code> parameter must be within the     * range <code>[0..(str.length())]</code>, inclusive.     * The <code>len</code> parameter     * must be a non-negative integer such that     * <code>(offset + len) &lt;= str.length()</code>.</p>     *     * @param str the <code>String</code> to be drawn     * @param offset zero-based index of first character in the substring     * @param len length of the substring     * @param x the x coordinate of the anchor point     * @param y the y coordinate of the anchor point     * @param anchor the anchor point for positioning the text     * @see #drawString(String, int, int, int).     * @throws StringIndexOutOfBoundsException if <code>offset</code>     * and <code>length</code> do not specify     * a valid range within the <code>String</code> <code>str</code>     * @throws IllegalArgumentException if <code>anchor</code>     * is not a legal value     * @throws NullPointerException if <code>str</code> is <code>null</code>     */    public native void drawSubstring(String str, int offset, int len,                                     int x, int y, int anchor);    /**     * Draws the specified character using the current font and color.     * @param character the character to be drawn     * @param x the x coordinate of the anchor point     * @param y the y coordinate of the anchor point     * @param anchor the anchor point for positioning the text; see     * <a href="#anchor">anchor points</a>     *     * @throws IllegalArgumentException if <code>anchor</code>     * is not a legal value     *     * @see #drawString(java.lang.String, int, int, int)     * @see #drawChars(char[], int, int, int, int, int)     */    public native void drawChar(char character, int x, int y, int anchor);    /**     * Draws the specified characters using the current font and color.     *     * <p>The <code>offset</code> and <code>length</code> parameters must     * specify a valid range of characters within     * the character array <code>data</code>.     * The <code>offset</code> parameter must be within the     * range <code>[0..(data.length)]</code>, inclusive.     * The <code>length</code> parameter     * must be a non-negative integer such that     * <code>(offset + length) &lt;= data.length</code>.</p>     *     * @param data the array of characters to be drawn     * @param offset the start offset in the data     * @param length the number of characters to be drawn     * @param x the x coordinate of the anchor point     * @param y the y coordinate of the anchor point     * @param anchor the anchor point for positioning the text; see     * <a href="#anchor">anchor points</a>     *     * @throws ArrayIndexOutOfBoundsException if <code>offset</code>     * and <code>length</code>     * do not specify a valid range within the data array     * @throws IllegalArgumentException if anchor is not a legal value     * @throws NullPointerException if <code>data</code> is <code>null</code>     *     * @see #drawString(java.lang.String, int, int, int)     */    public native void drawChars(char[] data, int offset, int length,                                 int x, int y, int anchor);     /**     * Draws the specified image by using the anchor point.     * The image can be drawn in different positions relative to     * the anchor point by passing the appropriate position constants.     * See <a href="#anchor">anchor points</a>.     *     * <p>If the source image contains transparent pixels, the corresponding     * pixels in the destination image must be left untouched.  If the source     * image contains partially transparent pixels, a compositing operation      * must be performed with the destination pixels, leaving all pixels of      * the destination image fully opaque.</p>     *     * <p>If <code>img</code> is the same as the destination of this Graphics     * object, the result is undefined.  For copying areas within an     * <code>Image</code>, {@link #copyArea copyArea} should be used instead.     * </p>     *     * @param img the specified image to be drawn     * @param x the x coordinate of the anchor point     * @param y the y coordinate of the anchor point     * @param anchor the anchor point for positioning the image     * @throws IllegalArgumentException if <code>anchor</code>     * is not a legal value     * @throws NullPointerException if <code>img</code> is <code>null</code>     * @see Image     */    public native void drawImage(Image img, int x, int y, int anchor);    /**     * Copies a region of the specified source image to a location within     * the destination, possibly transforming (rotating and reflecting)     * the image data using the chosen transform function.     *     * <p>The destination, if it is an image, must not be the same image as     * the source image.  If it is, an exception is thrown.  This restriction     * is present in order to avoid ill-defined behaviors that might occur if     * overlapped, transformed copies were permitted.</p>     *     * <p>The transform function used must be one of the following, as defined     * in the {@link javax.microedition.lcdui.game.Sprite Sprite} class:<br>     *     * <code>Sprite.TRANS_NONE</code> - causes the specified image     * region to be copied unchanged<br>     * <code>Sprite.TRANS_ROT90</code> - causes the specified image     * region to be rotated clockwise by 90 degrees.<br>     * <code>Sprite.TRANS_ROT180</code> - causes the specified image     * region to be rotated clockwise by 180 degrees.<br>     * <code>Sprite.TRANS_ROT270</code> - causes the specified image     * region to be rotated clockwise by 270 degrees.<br>     * <code>Sprite.TRANS_MIRROR</code> - causes the specified image     * region to be reflected about its vertical center.<br>     * <code>Sprite.TRANS_MIRROR_ROT90</code> - causes the specified image     * region to be reflected about its vertical center and then rotated     * clockwise by 90 degrees.<br>     * <code>Sprite.TRANS_MIRROR_ROT180</code> - causes the specified image     * region to be reflected about its vertical center and then rotated     * clockwise by 180 degrees.<br>     * <code>Sprite.TRANS_MIRROR_ROT270</code> - causes the specified image     * region to be reflected about its vertical center and then rotated     * clockwise by 270 degrees.<br></p>     *     * <p>If the source region contains transparent pixels, the corresponding     * pixels in the destination region must be left untouched.  If the source     * region contains partially transparent pixels, a compositing operation     * must be performed with the destination pixels, leaving all pixels of     * the destination region fully opaque.</p>     *     * <p> The <code>(x_src, y_src)</code> coordinates are relative to     * the upper left     * corner of the source image.  The <code>x_src</code>,     * <code>y_src</code>, <code>width</code>, and <code>height</code>

⌨️ 快捷键说明

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