1 Clazz.declarePackage ("java.awt.image");
\r
2 Clazz.load (["java.awt.image.Raster"], "java.awt.image.WritableRaster", ["java.lang.ArrayIndexOutOfBoundsException", "java.awt.Point", "$.Rectangle", "java.awt.image.RasterFormatException"], function () {
\r
3 c$ = Clazz.declareType (java.awt.image, "WritableRaster", java.awt.image.Raster);
\r
4 Clazz.defineMethod (c$, "setParams",
\r
5 function (model, dataBuffer, origin) {
\r
6 }, "java.awt.image.SampleModel,java.awt.image.DataBuffer,java.awt.Point");
\r
7 Clazz.makeConstructor (c$,
\r
9 Clazz.superConstructor (this, java.awt.image.WritableRaster, []);
\r
11 Clazz.makeConstructor (c$,
\r
12 function (sampleModel, origin) {
\r
13 Clazz.superConstructor (this, java.awt.image.WritableRaster, []);
\r
14 this.setRaster (sampleModel, sampleModel.createDataBuffer (), new java.awt.Rectangle (origin.x, origin.y, sampleModel.getWidth (), sampleModel.getHeight ()), origin, null);
\r
15 }, "java.awt.image.SampleModel,java.awt.Point");
\r
16 Clazz.makeConstructor (c$,
\r
17 function (sampleModel, dataBuffer, origin) {
\r
18 Clazz.superConstructor (this, java.awt.image.WritableRaster, []);
\r
19 this.setRaster (sampleModel, dataBuffer, new java.awt.Rectangle (origin.x, origin.y, sampleModel.getWidth (), sampleModel.getHeight ()), origin, null);
\r
20 }, "java.awt.image.SampleModel,java.awt.image.DataBuffer,java.awt.Point");
\r
21 Clazz.makeConstructor (c$,
\r
22 function (sampleModel, dataBuffer, aRegion, sampleModelTranslate, parent) {
\r
23 Clazz.superConstructor (this, java.awt.image.WritableRaster, []);
\r
24 this.setRaster (sampleModel, dataBuffer, aRegion, sampleModelTranslate, parent);
\r
25 }, "java.awt.image.SampleModel,java.awt.image.DataBuffer,java.awt.Rectangle,java.awt.Point,java.awt.image.Raster");
\r
26 Clazz.defineMethod (c$, "getWritableParent",
\r
30 Clazz.defineMethod (c$, "createWritableTranslatedChild",
\r
31 function (childMinX, childMinY) {
\r
32 return this.createWritableChild (this.minX, this.minY, this.width, this.height, childMinX, childMinY, null);
\r
34 Clazz.defineMethod (c$, "createWritableChild",
\r
35 function (parentX, parentY, w, h, childMinX, childMinY, bandList) {
\r
36 if (parentX < this.minX) {
\r
37 throw new java.awt.image.RasterFormatException ("parentX lies outside raster");
\r
38 }if (parentY < this.minY) {
\r
39 throw new java.awt.image.RasterFormatException ("parentY lies outside raster");
\r
40 }if ((parentX + w < parentX) || (parentX + w > this.width + this.minX)) {
\r
41 throw new java.awt.image.RasterFormatException ("(parentX + width) is outside raster");
\r
42 }if ((parentY + h < parentY) || (parentY + h > this.height + this.minY)) {
\r
43 throw new java.awt.image.RasterFormatException ("(parentY + height) is outside raster");
\r
45 if (bandList != null) {
\r
46 sm = this.sampleModel.createSubsetSampleModel (bandList);
\r
48 sm = this.sampleModel;
\r
49 }var deltaX = childMinX - parentX;
\r
50 var deltaY = childMinY - parentY;
\r
51 return new java.awt.image.WritableRaster (sm, this.getDataBuffer (), new java.awt.Rectangle (childMinX, childMinY, w, h), new java.awt.Point (this.sampleModelTranslateX + deltaX, this.sampleModelTranslateY + deltaY), this);
\r
52 }, "~N,~N,~N,~N,~N,~N,~A");
\r
53 Clazz.defineMethod (c$, "setDataElements",
\r
54 function (x, y, inData) {
\r
55 if (Clazz.instanceOf (inData, java.awt.image.Raster)) {
\r
56 this.setDataElementsRaster (x, y, inData);
\r
58 this.sampleModel.setDataElements (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, inData, this.dataBuffer);
\r
60 Clazz.defineMethod (c$, "setDataElementsRaster",
\r
61 function (x, y, inRaster) {
\r
62 var dstOffX = x + inRaster.getMinX ();
\r
63 var dstOffY = y + inRaster.getMinY ();
\r
64 var width = inRaster.getWidth ();
\r
65 var height = inRaster.getHeight ();
\r
66 if ((dstOffX < this.minX) || (dstOffY < this.minY) || (dstOffX + width > this.minX + this.width) || (dstOffY + height > this.minY + this.height)) {
\r
67 throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!");
\r
68 }var srcOffX = inRaster.getMinX ();
\r
69 var srcOffY = inRaster.getMinY ();
\r
71 for (var startY = 0; startY < height; startY++) {
\r
72 tdata = inRaster.getDataElements (srcOffX, srcOffY + startY, width, 1, tdata);
\r
73 this.setDataElements (dstOffX, dstOffY + startY, width, 1, tdata);
\r
75 }, "~N,~N,java.awt.image.Raster");
\r
76 Clazz.defineMethod (c$, "setDataElements",
\r
77 function (x, y, w, h, inData) {
\r
78 this.sampleModel.setDataElements (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, inData, this.dataBuffer);
\r
79 }, "~N,~N,~N,~N,~O");
\r
80 Clazz.defineMethod (c$, "setRect",
\r
81 function (srcRaster) {
\r
82 this.setRect (0, 0, srcRaster);
\r
83 }, "java.awt.image.Raster");
\r
84 Clazz.defineMethod (c$, "setRect",
\r
85 function (dx, dy, srcRaster) {
\r
86 var width = srcRaster.getWidth ();
\r
87 var height = srcRaster.getHeight ();
\r
88 var srcOffX = srcRaster.getMinX ();
\r
89 var srcOffY = srcRaster.getMinY ();
\r
90 var dstOffX = dx + srcOffX;
\r
91 var dstOffY = dy + srcOffY;
\r
92 if (dstOffX < this.minX) {
\r
93 var skipX = this.minX - dstOffX;
\r
96 dstOffX = this.minX;
\r
97 }if (dstOffY < this.minY) {
\r
98 var skipY = this.minY - dstOffY;
\r
101 dstOffY = this.minY;
\r
102 }if (dstOffX + width > this.minX + this.width) {
\r
103 width = this.minX + this.width - dstOffX;
\r
104 }if (dstOffY + height > this.minY + this.height) {
\r
105 height = this.minY + this.height - dstOffY;
\r
106 }if (width <= 0 || height <= 0) {
\r
108 }switch (srcRaster.getSampleModel ().getDataType ()) {
\r
112 for (var startY = 0; startY < height; startY++) {
\r
113 iData = srcRaster.getPixels (srcOffX, srcOffY + startY, width, 1, iData);
\r
114 this.setPixels (dstOffX, dstOffY + startY, width, 1, iData);
\r
118 }, "~N,~N,java.awt.image.Raster");
\r
119 Clazz.defineMethod (c$, "setPixel",
\r
120 function (x, y, iArray) {
\r
121 this.sampleModel.setPixel (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, iArray, this.dataBuffer);
\r
123 Clazz.defineMethod (c$, "setPixel",
\r
124 function (x, y, fArray) {
\r
125 this.sampleModel.setPixel (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, fArray, this.dataBuffer);
\r
127 Clazz.defineMethod (c$, "setPixel",
\r
128 function (x, y, dArray) {
\r
129 this.sampleModel.setPixel (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, dArray, this.dataBuffer);
\r
131 Clazz.defineMethod (c$, "setPixels",
\r
132 function (x, y, w, h, iArray) {
\r
133 this.sampleModel.setPixels (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, iArray, this.dataBuffer);
\r
134 }, "~N,~N,~N,~N,~A");
\r
135 Clazz.defineMethod (c$, "setPixels",
\r
136 function (x, y, w, h, fArray) {
\r
137 this.sampleModel.setPixels (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, fArray, this.dataBuffer);
\r
138 }, "~N,~N,~N,~N,~A");
\r
139 Clazz.defineMethod (c$, "setPixels",
\r
140 function (x, y, w, h, dArray) {
\r
141 this.sampleModel.setPixels (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, dArray, this.dataBuffer);
\r
142 }, "~N,~N,~N,~N,~A");
\r
143 Clazz.defineMethod (c$, "setSample",
\r
144 function (x, y, b, s) {
\r
145 this.sampleModel.setSample (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, b, s, this.dataBuffer);
\r
147 Clazz.defineMethod (c$, "setSample",
\r
148 function (x, y, b, s) {
\r
149 this.sampleModel.setSample (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, b, s, this.dataBuffer);
\r
151 Clazz.defineMethod (c$, "setSample",
\r
152 function (x, y, b, s) {
\r
153 this.sampleModel.setSample (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, b, s, this.dataBuffer);
\r
155 Clazz.defineMethod (c$, "setSamples",
\r
156 function (x, y, w, h, b, iArray) {
\r
157 this.sampleModel.setSamples (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, b, iArray, this.dataBuffer);
\r
158 }, "~N,~N,~N,~N,~N,~A");
\r
159 Clazz.defineMethod (c$, "setSamples",
\r
160 function (x, y, w, h, b, fArray) {
\r
161 this.sampleModel.setSamples (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, b, fArray, this.dataBuffer);
\r
162 }, "~N,~N,~N,~N,~N,~A");
\r
163 Clazz.defineMethod (c$, "setSamples",
\r
164 function (x, y, w, h, b, dArray) {
\r
165 this.sampleModel.setSamples (x - this.sampleModelTranslateX, y - this.sampleModelTranslateY, w, h, b, dArray, this.dataBuffer);
\r
166 }, "~N,~N,~N,~N,~N,~A");
\r