bugfixproxygraphics2d.java
来自「swing编写的库存管理程序。毕业设计类」· Java 代码 · 共 1,607 行 · 第 1/5 页
JAVA
1,607 行
* 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.
* @return <code>true</code> if the current output representation
* is complete; <code>false</code> otherwise.
* @see Image
* @see ImageObserver
* @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
*/
public boolean drawImage(final Image img, final int x, final int y,
final int width, final int height,
final ImageObserver observer)
{
return parent.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>, <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.
* @return <code>true</code> if the image is completely loaded;
* <code>false</code> otherwise.
* @see Image
* @see ImageObserver
* @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
*/
public boolean drawImage(final Image img, final int x, final int y,
final Color bgcolor,
final ImageObserver observer)
{
return parent.drawImage(img, x, y, bgcolor, 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 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.
* @return <code>true</code> if the current output representation
* is complete; <code>false</code> otherwise.
* @see Image
* @see ImageObserver
* @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
*/
public boolean drawImage(final Image img, final int x, final int y,
final int width, final int height,
final Color bgcolor,
final ImageObserver observer)
{
return parent.drawImage(img, x ,y ,width, height, bgcolor, observer);
}
/**
* 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.
* @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 observer object to be notified as more of the image is
* scaled and converted.
* @return <code>true</code> if the current output representation
* is complete; <code>false</code> otherwise.
* @see Image
* @see ImageObserver
* @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
* @since JDK1.1
*/
public boolean drawImage(final Image img,
final int dx1, final int dy1, final int dx2, final int dy2,
final int sx1, final int sy1, final int sx2, final int sy2,
final ImageObserver observer)
{
return parent.drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
/**
* 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.
* @return <code>true</code> if the current output representation
* is complete; <code>false</code> otherwise.
* @see Image
* @see ImageObserver
* @see ImageObserver#imageUpdate(Image, int, int, int, int, int)
* @since JDK1.1
*/
public boolean drawImage(final Image img,
final int dx1, final int dy1, final int dx2, final int dy2,
final int sx1, final int sy1, final int sx2, final int sy2,
final Color bgcolor,
final ImageObserver observer)
{
return parent.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 Graphics#finalize
* @see java.awt.Component#paint
* @see java.awt.Component#update
* @see java.awt.Component#getGraphics
* @see Graphics#create
*/
public void dispose()
{
parent.dispose();
}
/**
* Draws the outline of the specified rectangle.
* The left and right edges of the rectangle are at
* <code>x</code> and <code>x + width</code>.
* The top and bottom edges are at
* <code>y</code> and <code>y + height</code>.
* The rectangle is drawn using the graphics context's current color.
* @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.
* @see Graphics#fillRect
* @see Graphics#clearRect
*/
public void drawRect(final int x, final int y, final int width, final int height)
{
final Rectangle rect = new Rectangle(x, y, width, height);
if (parent.getClip().intersects(rect))
{
parent.draw(rect);
}
}
/**
* Draws the outline of a polygon defined by the specified
* <code>Polygon</code> object.
* @param p the polygon to draw.
* @see Graphics#fillPolygon
* @see Graphics#drawPolyline
*/
public void drawPolygon(final Polygon p)
{
parent.draw(p);
}
/**
* Fills the polygon defined by the specified Polygon object with
* the graphics context's current color.
* <p>
* The area inside the polygon is defined using an
* even-odd fill rule, also known as the alternating rule.
* @param p the polygon to fill.
* @see Graphics#drawPolygon(int[], int[], int)
*/
public void fillPolygon(final Polygon p)
{
parent.fill(p);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?