summaryrefslogtreecommitdiff
path: root/java/awt
diff options
context:
space:
mode:
authorFrancis Kung <fkung@redhat.com>2006-11-27 21:54:41 +0000
committerFrancis Kung <fkung@redhat.com>2006-11-27 21:54:41 +0000
commite0ae80efe95751e7f4b551c0d88d289eab9e4c27 (patch)
treed5eb13d7acbd088c0c84a5f3f17cb68a9549411d /java/awt
parent343f74f6df7afa49b220294174b0248a1c10ede5 (diff)
downloadclasspath-e0ae80efe95751e7f4b551c0d88d289eab9e4c27.tar.gz
2006-11-27 Francis Kung <fkung@redhat.com>
* java/awt/image/WritableRaster.java (createChild): Implemented.
Diffstat (limited to 'java/awt')
-rw-r--r--java/awt/image/WritableRaster.java19
1 files changed, 19 insertions, 0 deletions
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)
{