1 Clazz.declarePackage ("java.awt.image");
2 Clazz.load (["java.awt.image.BufferedImageOp", "$.RasterOp"], "java.awt.image.ConvolveOp", ["java.lang.IllegalArgumentException", "$.NullPointerException", "java.awt.geom.Point2D", "java.awt.image.BufferedImage", "$.ImagingOpException", "jssun.awt.image.ImagingLib"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.swingJStype = 'C';
8 Clazz.instantialize (this, arguments);
9 }, java.awt.image, "ConvolveOp", null, [java.awt.image.BufferedImageOp, java.awt.image.RasterOp]);
10 Clazz.makeConstructor (c$,
11 function (kernel, edgeCondition, hints) {
13 this.edgeHint = edgeCondition;
15 }, "java.awt.image.Kernel,~N,java.awt.RenderingHints");
16 Clazz.makeConstructor (c$,
20 }, "java.awt.image.Kernel");
21 Clazz.defineMethod (c$, "getEdgeCondition",
25 Clazz.defineMethod (c$, "getKernel",
27 return this.kernel.clone ();
29 Clazz.defineMethod (c$, "filter",
32 throw new NullPointerException ("src image is null");
34 throw new IllegalArgumentException ("src image cannot be the same as the dst image");
35 }var needToConvert = false;
36 var srcCM = src.getColorModel ();
40 dst = this.createCompatibleDestImage (src, null);
44 dstCM = dst.getColorModel ();
45 if (srcCM.getColorSpace ().getType () != dstCM.getColorSpace ().getType ()) {
46 throw new java.awt.image.ImagingOpException ("SwingJS: Differing color spaces not allowed");
47 }}if (jssun.awt.image.ImagingLib.filter (this, src, dst) == null) {
48 throw new java.awt.image.ImagingOpException ("Unable to convolve src image");
49 }if (origDst !== dst) {
50 var g = origDst.createGraphics ();
52 g.drawImage (dst, 0, 0, null);
57 }, "java.awt.image.BufferedImage,java.awt.image.BufferedImage");
58 Clazz.defineMethod (c$, "filter",
61 dst = this.createCompatibleDestRaster (src);
62 } else if (src === dst) {
63 throw new IllegalArgumentException ("src image cannot be the same as the dst image");
64 } else if (src.getNumBands () != dst.getNumBands ()) {
65 throw new java.awt.image.ImagingOpException ("Different number of bands in src and dst Rasters");
66 }if (jssun.awt.image.ImagingLib.filter (this, src, dst) == null) {
67 throw new java.awt.image.ImagingOpException ("Unable to convolve src image");
69 }, "java.awt.image.Raster,java.awt.image.WritableRaster");
70 Clazz.overrideMethod (c$, "createCompatibleDestImage",
71 function (src, destCM) {
73 var w = src.getWidth ();
74 var h = src.getHeight ();
77 destCM = src.getColorModel ();
79 wr = src.getData ().createCompatibleWritableRaster (w, h);
81 wr = destCM.createCompatibleWritableRaster (w, h);
82 }image = new java.awt.image.BufferedImage (destCM, wr, destCM.isAlphaPremultiplied (), null);
84 }, "java.awt.image.BufferedImage,java.awt.image.ColorModel");
85 Clazz.overrideMethod (c$, "createCompatibleDestRaster",
87 return src.createCompatibleWritableRaster ();
88 }, "java.awt.image.Raster");
89 Clazz.defineMethod (c$, "getBounds2D",
91 return this.getBounds2D (src.getRaster ());
92 }, "java.awt.image.BufferedImage");
93 Clazz.defineMethod (c$, "getBounds2D",
95 return src.getBounds ();
96 }, "java.awt.image.Raster");
97 Clazz.overrideMethod (c$, "getPoint2D",
98 function (srcPt, dstPt) {
100 dstPt = new java.awt.geom.Point2D.Float ();
101 }dstPt.setLocation (srcPt.getX (), srcPt.getY ());
103 }, "java.awt.geom.Point2D,java.awt.geom.Point2D");
104 Clazz.overrideMethod (c$, "getRenderingHints",
108 Clazz.defineStatics (c$,