![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e580. Stroking or Filling with a TextureThe buffered image used to create theTexturePaint object is
scaled down/up to width w and height h. Conceptually, the scaled
down/up buffered image is first painted at (x, y) in user space, and
then replicated around it.
// See e575 The Quintessential Drawing Program public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; int x = 10; int y = 10; int width = 50; int height = 25; TexturePaint texture = new TexturePaint(bufferedImage, new Rectangle(x, y, width, height)); g2d.setPaint(texture); // Draw shapes...; see e586 Drawing Simple Shapes }
e576. Drawing with Alpha e577. Enabling Antialiasing e578. Setting the Clipping Area with a Shape e579. Changing the Thickness of the Stroking Pen e581. Animating an Array of Images in an Application
© 2002 Addison-Wesley. |