summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--java/awt/image/WritableRaster.java19
2 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a64c562b7..8e610a5de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-11-27 Francis Kung <fkung@redhat.com>
+
+ * java/awt/image/WritableRaster.java
+ (createChild): Implemented.
+
2006-11-27 Roman Kennke <kennke@aicas.com>
* java/awt/font/TextLayout.java
diff --git a/java/awt/image/WritableRaster.java b/java/awt/image/WritableRaster.java
index d2ea4a8aa..bf8db140c 100644
--- a/java/awt/image/WritableRaster.java
+++ b/java/awt/image/WritableRaster.java
@@ -150,6 +150,25 @@ public class WritableRaster extends Raster
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)
{