b6fc19ee210b87d119fb0e4d2d94953c2de39a5f
[jalviewjs.git] / site / j2s / jssun / java2d / SunCompositeContext.js
1 Clazz.declarePackage ("jssun.java2d");
2 Clazz.load (["java.awt.CompositeContext"], "jssun.java2d.SunCompositeContext", ["java.lang.NullPointerException", "java.awt.image.BufferedImage", "$.WritableRaster", "jssun.java2d.loops.CompositeType"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.srcCM = null;
5 this.dstCM = null;
6 this.composite = null;
7 this.comptype = null;
8 Clazz.instantialize (this, arguments);
9 }, jssun.java2d, "SunCompositeContext", null, java.awt.CompositeContext);
10 Clazz.makeConstructor (c$, 
11 function (ac, s, d) {
12 if (s == null) {
13 throw  new NullPointerException ("Source color model cannot be null");
14 }if (d == null) {
15 throw  new NullPointerException ("Destination color model cannot be null");
16 }this.srcCM = s;
17 this.dstCM = d;
18 this.composite = ac;
19 this.comptype = jssun.java2d.loops.CompositeType.forAlphaComposite (ac);
20 }, "java.awt.AlphaComposite,java.awt.image.ColorModel,java.awt.image.ColorModel");
21 Clazz.overrideMethod (c$, "dispose", 
22 function () {
23 });
24 Clazz.overrideMethod (c$, "compose", 
25 function (srcArg, dstIn, dstOut) {
26 var src;
27 var w;
28 var h;
29 if (dstIn !== dstOut) {
30 dstOut.setDataElementsRaster (0, 0, dstIn);
31 }if (Clazz.instanceOf (srcArg, java.awt.image.WritableRaster)) {
32 src = srcArg;
33 } else {
34 src = srcArg.createCompatibleWritableRaster ();
35 src.setDataElements (0, 0, srcArg);
36 }w = Math.min (src.getWidth (), dstIn.getWidth ());
37 h = Math.min (src.getHeight (), dstIn.getHeight ());
38 var srcImg =  new java.awt.image.BufferedImage (this.srcCM, src, this.srcCM.isAlphaPremultiplied (), null);
39 var dstImg =  new java.awt.image.BufferedImage (this.dstCM, dstOut, this.dstCM.isAlphaPremultiplied (), null);
40 }, "java.awt.image.Raster,java.awt.image.Raster,java.awt.image.WritableRaster");
41 });