01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id: ImageWriterParams.java 496556 2007-01-16 00:59:48Z cam $ */
19:
20: package org.apache.xmlgraphics.image.writer;
21:
22: /**
23: * Parameters for the encoder which is accessed through the
24: * ImageWriter interface.
25: *
26: * @version $Id: ImageWriterParams.java 496556 2007-01-16 00:59:48Z cam $
27: */
28: public class ImageWriterParams {
29:
30: private Integer resolution;
31: private Float jpegQuality;
32: private Boolean jpegForceBaseline;
33: private String compressionMethod;
34:
35: /**
36: * Default constructor.
37: */
38: public ImageWriterParams() {
39: //nop
40: }
41:
42: /**
43: * @return the image resolution in dpi, or null if undefined
44: */
45: public Integer getResolution() {
46: return this .resolution;
47: }
48:
49: /**
50: * @return the quality value for encoding a JPEG image
51: * (0.0-1.0), or null if undefined
52: */
53: public Float getJPEGQuality() {
54: return this .jpegQuality;
55: }
56:
57: /**
58: * @return true if the baseline quantization table is forced,
59: * or null if undefined.
60: */
61: public Boolean getJPEGForceBaseline() {
62: return this .jpegForceBaseline;
63: }
64:
65: /** @return the compression method for encoding the image */
66: public String getCompressionMethod() {
67: return this .compressionMethod;
68: }
69:
70: /**
71: * Sets the target resolution of the bitmap image to be written.
72: * @param dpi the resolution in dpi
73: */
74: public void setResolution(int dpi) {
75: this .resolution = new Integer(dpi);
76: }
77:
78: /**
79: * Sets the quality setting for encoding JPEG images.
80: * @param quality the quality setting (0.0-1.0)
81: * @param forceBaseline force baseline quantization table
82: */
83: public void setJPEGQuality(float quality, boolean forceBaseline) {
84: this .jpegQuality = new Float(quality);
85: this .jpegForceBaseline = forceBaseline ? Boolean.TRUE
86: : Boolean.FALSE;
87: }
88:
89: /**
90: * Set the compression method that shall be used to encode the image.
91: * @param method the compression method
92: */
93: public void setCompressionMethod(String method) {
94: this.compressionMethod = method;
95: }
96: }
|