b9b62d829099307cc3986a59dd95c8b9b1cb4fe9
[jalviewjs.git] / site / j2s / jssun / awt / image / ImageDecoder.js
1 Clazz.declarePackage ("jssun.awt.image");
2 Clazz.load (null, "jssun.awt.image.ImageDecoder", ["java.lang.Thread", "jssun.awt.image.ImageConsumerQueue"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.source = null;
5 this.input = null;
6 this.feeder = null;
7 this.aborted = false;
8 this.finished = false;
9 this.queue = null;
10 this.next = null;
11 Clazz.instantialize (this, arguments);
12 }, jssun.awt.image, "ImageDecoder");
13 Clazz.makeConstructor (c$, 
14 function (src, is) {
15 this.source = src;
16 this.input = is;
17 this.feeder = Thread.currentThread ();
18 }, "jssun.awt.image.InputStreamImageSource,java.io.InputStream");
19 Clazz.defineMethod (c$, "isConsumer", 
20 function (ic) {
21 return jssun.awt.image.ImageConsumerQueue.isConsumer (this.queue, ic);
22 }, "java.awt.image.ImageConsumer");
23 Clazz.defineMethod (c$, "removeConsumer", 
24 function (ic) {
25 this.queue = jssun.awt.image.ImageConsumerQueue.removeConsumer (this.queue, ic, false);
26 if (!this.finished && this.queue == null) {
27 this.abort ();
28 }}, "java.awt.image.ImageConsumer");
29 Clazz.defineMethod (c$, "nextConsumer", 
30 function (cq) {
31 {
32 if (this.aborted) {
33 return null;
34 }cq = ((cq == null) ? this.queue : cq.next);
35 while (cq != null) {
36 if (cq.interested) {
37 return cq;
38 }cq = cq.next;
39 }
40 }return null;
41 }, "jssun.awt.image.ImageConsumerQueue");
42 Clazz.defineMethod (c$, "setDimensions", 
43 function (w, h) {
44 var cq = null;
45 var count = 0;
46 while ((cq = this.nextConsumer (cq)) != null) {
47 cq.consumer.setDimensions (w, h);
48 count++;
49 }
50 return count;
51 }, "~N,~N");
52 Clazz.defineMethod (c$, "setProperties", 
53 function (props) {
54 var cq = null;
55 var count = 0;
56 while ((cq = this.nextConsumer (cq)) != null) {
57 cq.consumer.setProperties (props);
58 count++;
59 }
60 return count;
61 }, "java.util.Hashtable");
62 Clazz.defineMethod (c$, "setColorModel", 
63 function (model) {
64 var cq = null;
65 var count = 0;
66 while ((cq = this.nextConsumer (cq)) != null) {
67 cq.consumer.setColorModel (model);
68 count++;
69 }
70 return count;
71 }, "java.awt.image.ColorModel");
72 Clazz.defineMethod (c$, "setHints", 
73 function (hints) {
74 var cq = null;
75 var count = 0;
76 while ((cq = this.nextConsumer (cq)) != null) {
77 cq.consumer.setHints (hints);
78 count++;
79 }
80 return count;
81 }, "~N");
82 Clazz.defineMethod (c$, "headerComplete", 
83 function () {
84 this.feeder.setPriority (3);
85 });
86 Clazz.defineMethod (c$, "setPixels", 
87 function (x, y, w, h, model, pix, off, scansize) {
88 this.source.latchConsumers (this);
89 var cq = null;
90 var count = 0;
91 while ((cq = this.nextConsumer (cq)) != null) {
92 cq.consumer.setPixels (x, y, w, h, model, pix, off, scansize);
93 count++;
94 }
95 return count;
96 }, "~N,~N,~N,~N,java.awt.image.ColorModel,~A,~N,~N");
97 Clazz.defineMethod (c$, "setPixels", 
98 function (x, y, w, h, model, pix, off, scansize) {
99 this.source.latchConsumers (this);
100 var cq = null;
101 var count = 0;
102 while ((cq = this.nextConsumer (cq)) != null) {
103 cq.consumer.setPixels (x, y, w, h, model, pix, off, scansize);
104 count++;
105 }
106 return count;
107 }, "~N,~N,~N,~N,java.awt.image.ColorModel,~A,~N,~N");
108 Clazz.defineMethod (c$, "imageComplete", 
109 function (status, done) {
110 this.source.latchConsumers (this);
111 if (done) {
112 this.finished = true;
113 this.source.doneDecoding (this);
114 }var cq = null;
115 var count = 0;
116 while ((cq = this.nextConsumer (cq)) != null) {
117 cq.consumer.imageComplete (status);
118 count++;
119 }
120 return count;
121 }, "~N,~B");
122 Clazz.defineMethod (c$, "abort", 
123 function () {
124 this.aborted = true;
125 this.source.doneDecoding (this);
126 this.close ();
127 this.feeder.interrupt ();
128 });
129 Clazz.defineMethod (c$, "close", 
130 function () {
131 if (this.input != null) {
132 try {
133 this.input.close ();
134 } catch (e) {
135 if (Clazz.exceptionOf (e, java.io.IOException)) {
136 } else {
137 throw e;
138 }
139 }
140 }});
141 });