• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *     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 package javax.imageio.plugins.bmp;
19 
20 import javax.imageio.ImageWriteParam;
21 import java.util.Locale;
22 
23 /**
24  * The BMPImageWriteParam class allows encoding an image in BMP format.
25  *
26  * @since Android 1.0
27  */
28 public class BMPImageWriteParam extends ImageWriteParam {
29 
30     /**
31      * The top down.
32      */
33     private boolean topDown; // Default is bottom-up
34 
35     /**
36      * Instantiates a new BMPImageWriteParam with default values of all
37      * parameters.
38      */
BMPImageWriteParam()39     public BMPImageWriteParam() {
40         this(null);
41     }
42 
43     /**
44      * Instantiates a new BMPImageWriteParam with the specified Locale.
45      *
46      * @param locale
47      *            the specified Locale.
48      */
BMPImageWriteParam(Locale locale)49     public BMPImageWriteParam(Locale locale) {
50         super(locale);
51 
52         // Set the compression
53         canWriteCompressed = true;
54         compressionTypes = new String[] {
55                 "BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS"
56         };
57         compressionType = compressionTypes[0];
58     }
59 
60     /**
61      * Sets true if the data will be written in a top-down order, false
62      * otherwise.
63      *
64      * @param topDown
65      *            the new top-down value.
66      */
setTopDown(boolean topDown)67     public void setTopDown(boolean topDown) {
68         this.topDown = topDown;
69     }
70 
71     /**
72      * Returns true if the data is written in top-down order, false otherwise.
73      *
74      * @return true if the data is written in top-down order, false otherwise.
75      */
isTopDown()76     public boolean isTopDown() {
77         return topDown;
78     }
79 }
80