diff options
author | Roman Kennke <roman@kennke.org> | 2006-06-30 23:19:28 +0000 |
---|---|---|
committer | Roman Kennke <roman@kennke.org> | 2006-06-30 23:19:28 +0000 |
commit | d4ee4396943a6512a9a22a29298cec1c92d0bfed (patch) | |
tree | cdf4e0d2471fe4596fc4768025e2f8c66cc13f2d /gnu/java/awt/java2d/AbstractGraphics2D.java | |
parent | 859a1b21d21c49320f3b78db9129ab5b980f0a14 (diff) | |
download | classpath-d4ee4396943a6512a9a22a29298cec1c92d0bfed.tar.gz |
2006-07-01 Roman Kennke <kennke@aicas.com>
* gnu/java/awt/java2d/AbstractGraphics2D.java
(transform): Make field protected.
(getDestinationRaster): Provide default implementation for
previously abstract method.
Diffstat (limited to 'gnu/java/awt/java2d/AbstractGraphics2D.java')
-rw-r--r-- | gnu/java/awt/java2d/AbstractGraphics2D.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/gnu/java/awt/java2d/AbstractGraphics2D.java b/gnu/java/awt/java2d/AbstractGraphics2D.java index 04bb0330b..9d017240d 100644 --- a/gnu/java/awt/java2d/AbstractGraphics2D.java +++ b/gnu/java/awt/java2d/AbstractGraphics2D.java @@ -73,6 +73,7 @@ import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ColorModel; +import java.awt.image.DataBuffer; import java.awt.image.ImageObserver; import java.awt.image.Raster; import java.awt.image.RenderedImage; @@ -145,7 +146,7 @@ public abstract class AbstractGraphics2D /** * The transformation for this Graphics2D instance */ - private AffineTransform transform; + protected AffineTransform transform; /** * The foreground. @@ -2064,7 +2065,34 @@ public abstract class AbstractGraphics2D * * @return the destination raster */ - protected abstract WritableRaster getDestinationRaster(); + protected WritableRaster getDestinationRaster() + { + // TODO: Ideally we would fetch the xdrawable's surface pixels for + // initialization of the raster. + Rectangle db = getDeviceBounds(); + if (destinationRaster == null) + { + int[] bandMasks = new int[]{ 0xFF0000, 0xFF00, 0xFF }; + destinationRaster = Raster.createPackedRaster(DataBuffer.TYPE_INT, + db.width, db.height, + bandMasks, null); + // Initialize raster with white. + int x0 = destinationRaster.getMinX(); + int x1 = destinationRaster.getWidth() + x0; + int y0 = destinationRaster.getMinY(); + int y1 = destinationRaster.getHeight() + y0; + int numBands = destinationRaster.getNumBands(); + for (int y = y0; y < y1; y++) + { + for (int x = x0; x < x1; x++) + { + for (int b = 0; b < numBands; b++) + destinationRaster.setSample(x, y, b, 255); + } + } + } + return destinationRaster; + } /** * Notifies the backend that the raster has changed in the specified |