1622 lines · 63.6 KB · Java
RawDownload
     /**     * Draws an outlined round-cornered rectangle using this graphics     * context's current color. The left and right edges of the rectangle     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,     * respectively. The top and bottom edges of the rectangle are at     * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.     * @param      x the <i>x</i> coordinate of the rectangle to be drawn.     * @param      y the <i>y</i> 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        java.awt.Graphics#fillRoundRect     * @since      JDK1.0     */    public void drawRoundRect(int x, int y, int width, int height,                              int arcWidth, int arcHeight) {        mGraphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);    }     /**     * Fills the specified rounded corner rectangle with the current color.     * The left and right edges of the rectangle     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>,     * respectively. The top and bottom edges of the rectangle are at     * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.     * @param       x the <i>x</i> coordinate of the rectangle to be filled.     * @param       y the <i>y</i> 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         java.awt.Graphics#drawRoundRect     * @since       JDK1.0     */    public void fillRoundRect(int x, int y, int width, int height,                                       int arcWidth, int arcHeight) {        mGraphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);    }     /**     * Draws the outline of an oval.     * The result is a circle or ellipse that fits within the     * rectangle specified by the <code>x</code>, <code>y</code>,     * <code>width</code>, and <code>height</code> arguments.     * <p>     * The oval covers an area that is     * <code>width&nbsp;+&nbsp;1</code> pixels wide     * and <code>height&nbsp;+&nbsp;1</code> pixels tall.     * @param       x the <i>x</i> coordinate of the upper left     *                     corner of the oval to be drawn.     * @param       y the <i>y</i> coordinate of the upper left     *                     corner of the oval to be drawn.     * @param       width the width of the oval to be drawn.     * @param       height the height of the oval to be drawn.     * @see         java.awt.Graphics#fillOval     * @since       JDK1.0     */    public void drawOval(int x, int y, int width, int height) {        mGraphics.drawOval(x, y, width, height);    }     /**     * Fills an oval bounded by the specified rectangle with the     * current color.     * @param       x the <i>x</i> coordinate of the upper left corner     *                     of the oval to be filled.     * @param       y the <i>y</i> coordinate of the upper left corner     *                     of the oval to be filled.     * @param       width the width of the oval to be filled.     * @param       height the height of the oval to be filled.     * @see         java.awt.Graphics#drawOval     * @since       JDK1.0     */    public void fillOval(int x, int y, int width, int height) {        mGraphics.fillOval(x, y, width, height);    }     /**     * Draws the outline of 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, using the current color.     * Angles are interpreted such that 0&nbsp;degrees     * is at the 3&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 (<i>x</i>,&nbsp;<i>y</i>) 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.     * @param        x the <i>x</i> coordinate of the     *                    upper-left corner of the arc to be drawn.     * @param        y the <i>y</i>  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         java.awt.Graphics#fillArc     * @since       JDK1.0     */    public void drawArc(int x, int y, int width, int height,                                 int startAngle, int arcAngle) {        mGraphics.drawArc(x, y, width, height, startAngle, arcAngle);    }     /**     * 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 0&nbsp;degrees     * is at the 3&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 (<i>x</i>,&nbsp;<i>y</i>) 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.     * @param        x the <i>x</i> coordinate of the     *                    upper-left corner of the arc to be filled.     * @param        y the <i>y</i>  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         java.awt.Graphics#drawArc     * @since       JDK1.0     */    public void fillArc(int x, int y, int width, int height,                        int startAngle, int arcAngle) {        mGraphics.fillArc(x, y, width, height, startAngle, arcAngle);    }     /**     * Draws a sequence of connected lines defined by     * arrays of <i>x</i> and <i>y</i> coordinates.     * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.     * The figure is not closed if the first point     * differs from the last point.     * @param       xPoints an array of <i>x</i> points     * @param       yPoints an array of <i>y</i> points     * @param       nPoints the total number of points     * @see         java.awt.Graphics#drawPolygon(int[], int[], int)     * @since       JDK1.1     */    public void drawPolyline(int xPoints[], int yPoints[],                             int nPoints) {        mGraphics.drawPolyline(xPoints, yPoints, nPoints);    }     /**     * Draws a closed polygon defined by     * arrays of <i>x</i> and <i>y</i> coordinates.     * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.     * <p>     * This method draws the polygon defined by <code>nPoint</code> line     * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>     * line segments are line segments from     * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>     * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for     * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.     * The figure is automatically closed by drawing a line connecting     * the final point to the first point, if those points are different.     * @param        xPoints   a an array of <code>x</code> coordinates.     * @param        yPoints   a an array of <code>y</code> coordinates.     * @param        nPoints   a the total number of points.     * @see          java.awt.Graphics#fillPolygon     * @see          java.awt.Graphics#drawPolyline     * @since        JDK1.0     */    public void drawPolygon(int xPoints[], int yPoints[],                            int nPoints) {        mGraphics.drawPolygon(xPoints, yPoints, nPoints);    }     /**     * Fills a closed polygon defined by     * arrays of <i>x</i> and <i>y</i> coordinates.     * <p>     * This method draws the polygon defined by <code>nPoint</code> line     * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>     * line segments are line segments from     * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>     * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for     * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.     * The figure is automatically closed by drawing a line connecting     * the final point to the first point, if those points are different.     * <p>     * The area inside the polygon is defined using an     * even-odd fill rule, also known as the alternating rule.     * @param        xPoints   a an array of <code>x</code> coordinates.     * @param        yPoints   a an array of <code>y</code> coordinates.     * @param        nPoints   a the total number of points.     * @see          java.awt.Graphics#drawPolygon(int[], int[], int)     * @since        JDK1.0     */    public void fillPolygon(int xPoints[], int yPoints[],                            int nPoints) {        mGraphics.fillPolygon(xPoints, yPoints, nPoints);    }     /**     * Draws the text given by the specified string, using this     * graphics context's current font and color. The baseline of the     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this     * graphics context's coordinate system.     * @param       str      the string to be drawn.     * @param       x        the <i>x</i> coordinate.     * @param       y        the <i>y</i> coordinate.     * @see         java.awt.Graphics#drawBytes     * @see         java.awt.Graphics#drawChars     * @since       JDK1.0     */    public void drawString(String str, int x, int y) {        mGraphics.drawString(str, x, y);    }     /**     * Draws the text given by the specified iterator, using this     * graphics context's current color. The iterator has to specify a font     * for each character. The baseline of the     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this     * graphics context's coordinate system.     * The rendering attributes applied include the clip, transform,     * paint or color, and composite attributes.     * For characters in script systems such as Hebrew and Arabic,     * the glyphs may be draw from right to left, in which case the     * coordinate supplied is the the location of the leftmost character     * on the baseline.     * @param iterator the iterator whose text is to be drawn     * @param x,y the coordinates where the iterator's text should be drawn.     * @see #setPaint     * @see java.awt.Graphics#setColor     * @see #setTransform     * @see #setComposite     * @see #setClip     */    public void drawString(AttributedCharacterIterator iterator,                                    int x, int y) {        mGraphics.drawString(iterator, x, y);    }     /**     * Draws the text given by the specified iterator, using this     * graphics context's current color. The iterator has to specify a font     * for each character. The baseline of the     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this     * graphics context's coordinate system.     * The rendering attributes applied include the clip, transform,     * paint or color, and composite attributes.     * For characters in script systems such as Hebrew and Arabic,     * the glyphs may be draw from right to left, in which case the     * coordinate supplied is the the location of the leftmost character     * on the baseline.     * @param iterator the iterator whose text is to be drawn     * @param x,y the coordinates where the iterator's text should be drawn.     * @see #setPaint     * @see java.awt.Graphics#setColor     * @see #setTransform     * @see #setComposite     * @see #setClip     */    public void drawString(AttributedCharacterIterator iterator,                                    float x, float y) {        mGraphics.drawString(iterator, x, y);    }     /**     * Draws as much of the specified image as is currently available.     * The image is drawn with its top-left corner at     * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate     * space. Transparent pixels in the image do not affect whatever     * pixels are already there.     * <p>     * 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.     * <p>     * If the image has not yet been completely loaded, then     * <code>drawImage</code> returns <code>false</code>. As more of     * the image becomes available, the process that draws the image notifies     * the specified image observer.     * @param    img the specified image to be drawn.     * @param    x   the <i>x</i> coordinate.     * @param    y   the <i>y</i> coordinate.     * @param    observer    object to be notified as more of     *                          the image is converted.     * @see      java.awt.Image     * @see      java.awt.image.ImageObserver     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)     * @since    JDK1.0     */    public boolean drawImage(Image img, int x, int y,                             ImageObserver observer) {         return mGraphics.drawImage(img, x, y, observer);    }     /**     * Draws as much of the specified image as has already been scaled     * to fit inside the specified rectangle.     * <p>     * 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.     * <p>     * 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     * <code>drawImage</code> returns <code>false</code>. As more of     * the image becomes available, the process that draws the image notifies     * the image observer by calling its <code>imageUpdate</code> method.     * <p>     * 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.     * @param    img    the specified image to be drawn.     * @param    x      the <i>x</i> coordinate.     * @param    y      the <i>y</i> coordinate.     * @param    width  the width of the rectangle.     * @param    height the height of the rectangle.     * @param    observer    object to be notified as more of     *                          the image is converted.     * @see      java.awt.Image     * @see      java.awt.image.ImageObserver     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)     * @since    JDK1.0     */    public boolean drawImage(Image img, int x, int y,                             int width, int height,                             ImageObserver observer) {         return mGraphics.drawImage(img, x, y, width, height, observer);    }     /**     * Draws as much of the specified image as is currently available.     * The image is drawn with its top-left corner at     * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate     * space.  Transparent pixels are drawn in the specified     * background color.     * <p>     * 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.     * <p>     * 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.     * <p>     * If the image has not yet been completely loaded, then     * <code>drawImage</code> returns <code>false</code>. As more of     * the image becomes available, the process that draws the image notifies     * the specified image observer.     * @param    img    the specified image to be drawn.     * @param    x      the <i>x</i> coordinate.     * @param    y      the <i>y</i> coordinate.     * @param    bgcolor the background color to paint under the     *                         non-opaque portions of the image.     * @param    observer    object to be notified as more of     *                          the image is converted.     * @see      java.awt.Image     * @see      java.awt.image.ImageObserver     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)     * @since    JDK1.0     */    public boolean drawImage(Image img, int x, int y,                             Color bgcolor,                             ImageObserver observer) {         if (img == null) {            return true;        }         boolean result;         if (needToCopyBgColorImage(img)) {            BufferedImage imageCopy = getBufferedImageCopy(img, bgcolor);            result = mGraphics.drawImage(imageCopy, x, y, null);        } else {            result = mGraphics.drawImage(img, x, y, bgcolor, observer);        }         return result;    }     /**     * Draws as much of the specified image as has already been scaled     * to fit inside the specified rectangle.     * <p>     * 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.     * <p>     * 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     * <code>drawImage</code> returns <code>false</code>. As more of     * the image becomes available, the process that draws the image notifies     * the specified image observer.     * <p>     * 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.     * @param    img       the specified image to be drawn.     * @param    x         the <i>x</i> coordinate.     * @param    y         the <i>y</i> coordinate.     * @param    width     the width of the rectangle.     * @param    height    the height of the rectangle.     * @param    bgcolor   the background color to paint under the     *                         non-opaque portions of the image.     * @param    observer    object to be notified as more of     *                          the image is converted.     * @see      java.awt.Image     * @see      java.awt.image.ImageObserver     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)     * @since    JDK1.0     */    public boolean drawImage(Image img, int x, int y,                             int width, int height,                             Color bgcolor,                             ImageObserver observer) {         if (img == null) {            return true;        }         boolean result;         if (needToCopyBgColorImage(img)) {            BufferedImage imageCopy = getBufferedImageCopy(img, bgcolor);            result = mGraphics.drawImage(imageCopy, x, y, width, height, null);        } else {            result = mGraphics.drawImage(img, x, y, width, height,                                         bgcolor, observer);        }         return result;    }     /**     * 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. Transparent pixels     * do not affect whatever pixels are already there.     * <p>     * 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     * <code>drawImage</code> returns <code>false</code>. As more of     * the image becomes available, the process that draws the image notifies     * the specified image observer.     * <p>     * 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.     * @param       img the specified image to be drawn     * @param       dx1 the <i>x</i> coordinate of the first corner of the     *                    destination rectangle.     * @param       dy1 the <i>y</i> coordinate of the first corner of the     *                    destination rectangle.     * @param       dx2 the <i>x</i> coordinate of the second corner of the     *                    destination rectangle.

Lines 501–1000 of 1622. Previous lines