< prev index next >

src/java.desktop/share/classes/java/awt/TexturePaint.java

Print this page

        

*** 29,50 **** import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; /** ! * The <code>TexturePaint</code> class provides a way to fill a * {@link Shape} with a texture that is specified as ! * a {@link BufferedImage}. The size of the <code>BufferedImage</code> ! * object should be small because the <code>BufferedImage</code> data ! * is copied by the <code>TexturePaint</code> object. * At construction time, the texture is anchored to the upper * left corner of a {@link Rectangle2D} that is * specified in user space. Texture is computed for * locations in the device space by conceptually replicating the ! * specified <code>Rectangle2D</code> infinitely in all directions ! * in user space and mapping the <code>BufferedImage</code> to each ! * replicated <code>Rectangle2D</code>. * @see Paint * @see Graphics2D#setPaint * @version 1.48, 06/05/07 */ --- 29,50 ---- import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; /** ! * The {@code TexturePaint} class provides a way to fill a * {@link Shape} with a texture that is specified as ! * a {@link BufferedImage}. The size of the {@code BufferedImage} ! * object should be small because the {@code BufferedImage} data ! * is copied by the {@code TexturePaint} object. * At construction time, the texture is anchored to the upper * left corner of a {@link Rectangle2D} that is * specified in user space. Texture is computed for * locations in the device space by conceptually replicating the ! * specified {@code Rectangle2D} infinitely in all directions ! * in user space and mapping the {@code BufferedImage} to each ! * replicated {@code Rectangle2D}. * @see Paint * @see Graphics2D#setPaint * @version 1.48, 06/05/07 */
*** 55,68 **** double ty; double sx; double sy; /** ! * Constructs a <code>TexturePaint</code> object. ! * @param txtr the <code>BufferedImage</code> object with the texture * used for painting ! * @param anchor the <code>Rectangle2D</code> in user space used to * anchor and replicate the texture */ public TexturePaint(BufferedImage txtr, Rectangle2D anchor) { this.bufImg = txtr; --- 55,68 ---- double ty; double sx; double sy; /** ! * Constructs a {@code TexturePaint} object. ! * @param txtr the {@code BufferedImage} object with the texture * used for painting ! * @param anchor the {@code Rectangle2D} in user space used to * anchor and replicate the texture */ public TexturePaint(BufferedImage txtr, Rectangle2D anchor) { this.bufImg = txtr;
*** 71,93 **** this.sx = anchor.getWidth() / bufImg.getWidth(); this.sy = anchor.getHeight() / bufImg.getHeight(); } /** ! * Returns the <code>BufferedImage</code> texture used to * fill the shapes. ! * @return a <code>BufferedImage</code>. */ public BufferedImage getImage() { return bufImg; } /** * Returns a copy of the anchor rectangle which positions and * sizes the textured image. ! * @return the <code>Rectangle2D</code> used to anchor and ! * size this <code>TexturePaint</code>. */ public Rectangle2D getAnchorRect() { return new Rectangle2D.Double(tx, ty, sx * bufImg.getWidth(), sy * bufImg.getHeight()); --- 71,93 ---- this.sx = anchor.getWidth() / bufImg.getWidth(); this.sy = anchor.getHeight() / bufImg.getHeight(); } /** ! * Returns the {@code BufferedImage} texture used to * fill the shapes. ! * @return a {@code BufferedImage}. */ public BufferedImage getImage() { return bufImg; } /** * Returns a copy of the anchor rectangle which positions and * sizes the textured image. ! * @return the {@code Rectangle2D} used to anchor and ! * size this {@code TexturePaint}. */ public Rectangle2D getAnchorRect() { return new Rectangle2D.Double(tx, ty, sx * bufImg.getWidth(), sy * bufImg.getHeight());
*** 137,148 **** return TexturePaintContext.getContext(bufImg, xform, hints, deviceBounds); } /** ! * Returns the transparency mode for this <code>TexturePaint</code>. ! * @return the transparency mode for this <code>TexturePaint</code> * as an integer value. * @see Transparency */ public int getTransparency() { return (bufImg.getColorModel()).getTransparency(); --- 137,148 ---- return TexturePaintContext.getContext(bufImg, xform, hints, deviceBounds); } /** ! * Returns the transparency mode for this {@code TexturePaint}. ! * @return the transparency mode for this {@code TexturePaint} * as an integer value. * @see Transparency */ public int getTransparency() { return (bufImg.getColorModel()).getTransparency();
< prev index next >