2 // Copyright (C) 1998, James R. Weeks and BioElectroMech.
\r
3 // Visit BioElectroMech at www.obrador.com. Email James@obrador.com.
\r
5 // See license.txt for details about the allowed used of this software.
\r
6 // This software is based in part on the work of the Independent JPEG Group.
\r
7 // See IJGreadme.txt for details about the Independent JPEG Group's license.
\r
9 // This encoder is inspired by the Java Jpeg encoder by Florian Raemy,
\r
10 // studwww.eurecom.fr/~raemy.
\r
11 // It borrows a great deal of code and structure from the Independent
\r
12 // Jpeg Group's Jpeg 6a library, Copyright Thomas G. Lane.
\r
13 // See license.txt for details
\r
16 * JpegEncoder and its associated classes are Copyright (c) 1998, James R. Weeks and BioElectroMech
\r
17 * see(Jmol/src/com/obrador/license.txt)
\r
19 * javajs.img.JpegEncoder.java was adapted by Bob Hanson
\r
20 * for Jmol in the following ways:
\r
22 * 1) minor coding efficiencies were made in some for() loops.
\r
23 * 2) methods not used by Jmol were commented out
\r
24 * 3) method and variable signatures were modified to provide
\r
25 * more appropriate method privacy.
\r
26 * 4) additions for Java2Script compatibility
\r
28 * Original files are maintained in the Jmol.src.com.obrador package, but
\r
29 * these original files are not distributed with Jmol.
\r
35 import java.io.IOException;
\r
36 import java.util.Map;
\r
38 import javajs.util.Base64;
\r
39 import javajs.util.OC;
\r
42 public class Jpg64Encoder extends JpgEncoder {
\r
47 protected void setParams(Map<String, Object> params) {
\r
48 defaultQuality = 75;
\r
49 outTemp = (OC) params.remove("outputChannelTemp");
\r
50 super.setParams(params);
\r
54 protected void generate() throws IOException {
\r
58 byte[] bytes = Base64.getBytes64(out.toByteArray());
\r
61 out.write(bytes, 0, bytes.length);
\r