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 package org.apache.commons.imaging.formats.tiff.constants; 18 19 /** 20 * Defines options for the organization of data in a TIFF file. 21 */ 22 public enum TiffPlanarConfiguration { 23 24 /** 25 * Indicates that data is stored in an interleaved format, so that component values for each pixel are contiguous in the file. 26 */ 27 CHUNKY(TiffTagConstants.PLANAR_CONFIGURATION_VALUE_CHUNKY), 28 /** 29 * Indicates that data is stored in a non-interleaved format, component values for each pixel are separated into distinct planes. 30 */ 31 PLANAR(TiffTagConstants.PLANAR_CONFIGURATION_VALUE_PLANAR); 32 33 /** 34 * Interprets an integer code value to determine the enumerated value. Implements lenient rules for handling non-compliant values. 35 * 36 * @param codeValue an integer code corresponding to the TIFF specification. 37 * @return a valid enumeration. 38 */ 39 public static TiffPlanarConfiguration lenientValueOf(final int codeValue) { 40 switch (codeValue) { 41 case TiffTagConstants.PLANAR_CONFIGURATION_VALUE_CHUNKY: 42 return CHUNKY; 43 case TiffTagConstants.PLANAR_CONFIGURATION_VALUE_PLANAR: 44 return PLANAR; 45 default: 46 return CHUNKY; 47 } 48 } 49 50 /** 51 * The integer code values used for indicating the planar configuration in a TIFF file. 52 */ 53 public final int codeValue; 54 55 /** 56 * 57 * @param codeValue format-indicator value for use in file. 58 */ 59 TiffPlanarConfiguration(final int codeValue) { 60 this.codeValue = codeValue; 61 } 62 }