001: /**
002: * Copyright (c) 2003-2005, www.pdfbox.org
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions are met:
007: *
008: * 1. Redistributions of source code must retain the above copyright notice,
009: * this list of conditions and the following disclaimer.
010: * 2. Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: * 3. Neither the name of pdfbox; nor the names of its
014: * contributors may be used to endorse or promote products derived from this
015: * software without specific prior written permission.
016: *
017: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
018: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020: * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
021: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027: *
028: * http://www.pdfbox.org
029: *
030: */package org.pdfbox.pdmodel.interactive.annotation;
031:
032: import org.pdfbox.cos.COSBase;
033: import org.pdfbox.cos.COSDictionary;
034:
035: import org.pdfbox.pdmodel.common.COSObjectable;
036:
037: /**
038: * This class represents a PDF /BE entry the border effect dictionary.
039: *
040: * @author Paul King
041: * @version $Revision: 1.1 $
042: */
043: public class PDBorderEffectDictionary implements COSObjectable {
044:
045: /*
046: * The various values of the effect applied to the border as defined in the
047: * PDF 1.6 reference Table 8.14
048: */
049:
050: /**
051: * Constant for the name for no effect.
052: */
053: public static final String STYLE_SOLID = "S";
054:
055: /**
056: * Constant for the name of a cloudy effect.
057: */
058: public static final String STYLE_CLOUDY = "C";
059:
060: private COSDictionary dictionary;
061:
062: /**
063: * Constructor.
064: */
065: public PDBorderEffectDictionary() {
066: dictionary = new COSDictionary();
067: }
068:
069: /**
070: * Constructor.
071: *
072: * @param dict
073: * a border style dictionary.
074: */
075: public PDBorderEffectDictionary(COSDictionary dict) {
076: dictionary = dict;
077: }
078:
079: /**
080: * returns the dictionary.
081: *
082: * @return the dictionary
083: */
084: public COSDictionary getDictionary() {
085: return dictionary;
086: }
087:
088: /**
089: * returns the dictionary.
090: *
091: * @return the dictionary
092: */
093: public COSBase getCOSObject() {
094: return dictionary;
095: }
096:
097: /**
098: * This will set the intensity of the applied effect.
099: *
100: * @param i
101: * the intensity of the effect values 0 to 2
102: */
103: public void setIntensity(float i) {
104: getDictionary().setFloat("I", i);
105: }
106:
107: /**
108: * This will retrieve the intensity of the applied effect.
109: *
110: * @return the intensity value 0 to 2
111: */
112: public float getIntensity() {
113: return getDictionary().getFloat("I", 0);
114: }
115:
116: /**
117: * This will set the border effect, see the STYLE_* constants for valid values.
118: *
119: * @param s
120: * the border effect to use
121: */
122: public void setStyle(String s) {
123: getDictionary().setName("S", s);
124: }
125:
126: /**
127: * This will retrieve the border effect, see the STYLE_* constants for valid
128: * values.
129: *
130: * @return the effect of the border
131: */
132: public String getStyle() {
133: return getDictionary().getNameAsString("S", STYLE_SOLID);
134: }
135:
136: }
|