Hi,
This patch implements the above-mentioned method, which is functionally
identical to the Raster.createChild (which it overrides), except that it
returns a WritableRaster. The spec does not require this, but a mauve
test confirms the behaviour, and some applications seem to rely on it.
Cheers,
Francis
2006-11-27 Francis Kung <[EMAIL PROTECTED]>
* java/awt/image/WritableRaster.java
(createChild): Implemented.
Index: java/awt/image/WritableRaster.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/image/WritableRaster.java,v
retrieving revision 1.9
diff -u -r1.9 WritableRaster.java
--- java/awt/image/WritableRaster.java 17 Oct 2006 14:53:36 -0000 1.9
+++ java/awt/image/WritableRaster.java 27 Nov 2006 21:49:56 -0000
@@ -150,6 +150,25 @@
sampleModelTranslateY + childMinY - parentY),
this);
}
+
+ public Raster createChild(int parentX, int parentY, int width,
+ int height, int childMinX, int childMinY,
+ int[] bandList)
+ {
+ if (parentX < minX || parentX + width > minX + this.width
+ || parentY < minY || parentY + height > minY + this.height)
+ throw new RasterFormatException("Child raster extends beyond parent");
+
+ SampleModel sm = (bandList == null) ?
+ sampleModel :
+ sampleModel.createSubsetSampleModel(bandList);
+
+ return new WritableRaster(sm, dataBuffer,
+ new Rectangle(childMinX, childMinY, width, height),
+ new Point(sampleModelTranslateX + childMinX - parentX,
+ sampleModelTranslateY + childMinY - parentY),
+ this);
+ }
public void setDataElements(int x, int y, Object inData)
{