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