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