JAL-1807 test
[jalviewjs.git] / bin / javajs / img / ImageEncoder.js
1 Clazz.declarePackage ("javajs.img");
2 Clazz.load (["javajs.api.GenericImageEncoder"], "javajs.img.ImageEncoder", ["java.lang.Boolean"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.out = null;
5 this.width = -1;
6 this.height = -1;
7 this.quality = -1;
8 this.date = null;
9 this.logging = false;
10 this.doClose = true;
11 this.pixels = null;
12 Clazz.instantialize (this, arguments);
13 }, javajs.img, "ImageEncoder", null, javajs.api.GenericImageEncoder);
14 Clazz.overrideMethod (c$, "createImage", 
15 function (type, out, params) {
16 this.out = out;
17 this.logging = (Boolean.TRUE === params.get ("logging"));
18 this.width = (params.get ("imageWidth")).intValue ();
19 this.height = (params.get ("imageHeight")).intValue ();
20 this.pixels = params.get ("imagePixels");
21 this.date = params.get ("date");
22 var q = params.get ("quality");
23 this.quality = (q == null ? -1 : q.intValue ());
24 this.setParams (params);
25 this.generate ();
26 this.close ();
27 return this.doClose;
28 }, "~S,javajs.util.OC,java.util.Map");
29 Clazz.defineMethod (c$, "putString", 
30 function (s) {
31 var b = s.getBytes ();
32 this.out.write (b, 0, b.length);
33 }, "~S");
34 Clazz.defineMethod (c$, "putByte", 
35 function (b) {
36 this.out.writeByteAsInt (b);
37 }, "~N");
38 Clazz.defineMethod (c$, "close", 
39 function () {
40 });
41 });