41468963dbc7cbbbaf62507c690a172868622f70
[jalviewjs.git] / site / j2s / jssun / awt / image / OffScreenImageSource.js
1 Clazz.declarePackage ("jssun.awt.image");
2 Clazz.load (["java.awt.image.ImageProducer"], "jssun.awt.image.OffScreenImageSource", ["java.util.Hashtable"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.image = null;
5 this.width = 0;
6 this.height = 0;
7 this.properties = null;
8 this.theConsumer = null;
9 Clazz.instantialize (this, arguments);
10 }, jssun.awt.image, "OffScreenImageSource", null, java.awt.image.ImageProducer);
11 Clazz.makeConstructor (c$, 
12 function (image, properties) {
13 this.image = image;
14 if (properties != null) {
15 this.properties = properties;
16 } else {
17 this.properties =  new java.util.Hashtable ();
18 }this.width = image.getWidth ();
19 this.height = image.getHeight ();
20 }, "java.awt.image.BufferedImage,java.util.Hashtable");
21 Clazz.makeConstructor (c$, 
22 function (image) {
23 this.construct (image, null);
24 }, "java.awt.image.BufferedImage");
25 Clazz.overrideMethod (c$, "addConsumer", 
26 function (ic) {
27 this.theConsumer = ic;
28 this.produce ();
29 }, "java.awt.image.ImageConsumer");
30 Clazz.overrideMethod (c$, "isConsumer", 
31 function (ic) {
32 return (ic === this.theConsumer);
33 }, "java.awt.image.ImageConsumer");
34 Clazz.overrideMethod (c$, "removeConsumer", 
35 function (ic) {
36 if (this.theConsumer === ic) {
37 this.theConsumer = null;
38 }}, "java.awt.image.ImageConsumer");
39 Clazz.overrideMethod (c$, "startProduction", 
40 function (ic) {
41 this.addConsumer (ic);
42 }, "java.awt.image.ImageConsumer");
43 Clazz.overrideMethod (c$, "requestTopDownLeftRightResend", 
44 function (ic) {
45 }, "java.awt.image.ImageConsumer");
46 Clazz.defineMethod (c$, "sendPixels", 
47  function () {
48 var cm = this.image.getColorModel ();
49 });
50 Clazz.defineMethod (c$, "produce", 
51  function () {
52 try {
53 this.theConsumer.setDimensions (this.image.getWidth (), this.image.getHeight ());
54 this.theConsumer.setProperties (this.properties);
55 this.sendPixels ();
56 this.theConsumer.imageComplete (2);
57 } catch (e) {
58 if (Clazz.exceptionOf (e, NullPointerException)) {
59 if (this.theConsumer != null) {
60 this.theConsumer.imageComplete (1);
61 }} else {
62 throw e;
63 }
64 }
65 });
66 });