1157 lines · 52.0 KB · Java
RawDownload
    }     /**     * 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.     * <p>     * 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     * 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.     * @param       dy2 the <i>y</i> coordinate of the second corner of the     *                    destination rectangle.     * @param       sx1 the <i>x</i> coordinate of the first corner of the     *                    source rectangle.     * @param       sy1 the <i>y</i> coordinate of the first corner of the     *                    source rectangle.     * @param       sx2 the <i>x</i> coordinate of the second corner of the     *                    source rectangle.     * @param       sy2 the <i>y</i> coordinate of the second corner of the     *                    source 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     *                    scaled and 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.1     */    public boolean drawImage(Image img,                                      int dx1, int dy1, int dx2, int dy2,                                      int sx1, int sy1, int sx2, int sy2,                                      Color bgcolor,                                      ImageObserver observer) {         return g.drawImage(img, dx1, dy1, dx2, dy2,                                  sx1, sy1, sx2, sy2,                                  bgcolor,                                  observer);    }     /**     * Disposes of this graphics context and releases     * any system resources that it is using.     * A <code>Graphics</code> object cannot be used after     * <code>dispose</code>has been called.     * <p>     * When a Java program runs, a large number of <code>Graphics</code>     * objects can be created within a short time frame.     * Although the finalization process of the garbage collector     * also disposes of the same system resources, it is preferable     * to manually free the associated resources by calling this     * method rather than to rely on a finalization process which     * may not run to completion for a long period of time.     * <p>     * Graphics objects which are provided as arguments to the     * <code>paint</code> and <code>update</code> methods     * of components are automatically released by the system when     * those methods return. For efficiency, programmers should     * call <code>dispose</code> when finished using     * a <code>Graphics</code> object only if it was created     * directly from a component or another <code>Graphics</code> object.     * @see         java.awt.Graphics#finalize     * @see         java.awt.Component#paint     * @see         java.awt.Component#update     * @see         java.awt.Component#getGraphics     * @see         java.awt.Graphics#create     */    public void dispose() {        g.dispose();    }     /**     * Empty finalizer as no clean up needed here.     */    public void finalize() {    }     /**     * Returns a <code>String</code> object representing this     *                        <code>Graphics</code> object's value.     * @return       a string representation of this graphics context.     */    public String toString() {        return getClass().getName() + "[font=" + getFont() + ",color=" + getColor() + "]";    }     /**     * @deprecated As of JDK version 1.1,     * replaced by <code>getClipBounds()</code>.     */    @Deprecated    public Rectangle getClipRect() {        return g.getClipRect();    }     /**     * Returns true if the specified rectangular area intersects     * the bounding rectangle of the current clipping area.     * The coordinates in the rectangle are relative to the coordinate     * system origin of this graphics context.     *     * @param x the x coordinate of the rectangle to test against the clip     * @param y the y coordinate of the rectangle to test against the clip     * @param width the width of the rectangle to test against the clip     * @param height the height of the rectangle to test against the clip     */    public boolean hitClip(int x, int y, int width, int height) {        return g.hitClip(x, y, width, height);    }     /**     * Returns the bounding rectangle of the current clipping area.     * The coordinates in the rectangle are relative to the coordinate     * system origin of this graphics context.  This method differs     * from {@link #getClipBounds() getClipBounds} in that an existing     * rectangle is used instead of allocating a new one.     * 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 the     * specified <code>Rectangle</code>.     * @param  r    the rectangle where the current clipping area is     *              copied to.  Any current values in this rectangle are     *              overwritten.     * @return      the bounding rectangle of the current clipping area.     */    public Rectangle getClipBounds(Rectangle r) {        return g.getClipBounds(r);    }}

Lines 1001–1157 of 1157. Previous lines