]> _ Git - cubeextranet.git/blob
56b82ac3bfe1f5a55a7fc1096b06f241db3e46e9
[cubeextranet.git] /
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.pdfbox.pdmodel.interactive.annotation;
18
19 import org.apache.pdfbox.cos.COSBase;
20 import org.apache.pdfbox.cos.COSDictionary;
21
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
23
24 /**
25  * This class represents a PDF /BE entry the border effect dictionary.
26  *
27  * @author Paul King
28  * @version $Revision: 1.1 $
29  */
30 public class PDBorderEffectDictionary implements COSObjectable
31 {
32
33     /*
34      * The various values of the effect applied to the border as defined in the
35      * PDF 1.6 reference Table 8.14
36      */
37
38     /**
39      * Constant for the name for no effect.
40      */
41     public static final String STYLE_SOLID = "S";
42
43     /**
44      * Constant for the name of a cloudy effect.
45      */
46     public static final String STYLE_CLOUDY = "C";
47
48     private COSDictionary dictionary;
49
50     /**
51      * Constructor.
52      */
53     public PDBorderEffectDictionary()
54     {
55         dictionary = new COSDictionary();
56     }
57
58     /**
59      * Constructor.
60      *
61      * @param dict
62      *            a border style dictionary.
63      */
64     public PDBorderEffectDictionary( COSDictionary dict )
65     {
66         dictionary = dict;
67     }
68
69     /**
70      * returns the dictionary.
71      *
72      * @return the dictionary
73      */
74     public COSDictionary getDictionary()
75     {
76         return dictionary;
77     }
78
79     /**
80      * returns the dictionary.
81      *
82      * @return the dictionary
83      */
84     public COSBase getCOSObject()
85     {
86         return dictionary;
87     }
88
89     /**
90      * This will set the intensity of the applied effect.
91      *
92      * @param i
93      *            the intensity of the effect values 0 to 2
94      */
95     public void setIntensity( float i )
96     {
97         getDictionary().setFloat( "I", i );
98     }
99
100     /**
101      * This will retrieve the intensity of the applied effect.
102      *
103      * @return the intensity value 0 to 2
104      */
105     public float getIntensity()
106     {
107         return getDictionary().getFloat( "I", 0 );
108     }
109
110     /**
111      * This will set the border effect, see the STYLE_* constants for valid values.
112      *
113      * @param s
114      *            the border effect to use
115      */
116     public void setStyle( String s )
117     {
118         getDictionary().setName( "S", s );
119     }
120
121     /**
122      * This will retrieve the border effect, see the STYLE_* constants for valid
123      * values.
124      *
125      * @return the effect of the border
126      */
127     public String getStyle()
128     {
129         return getDictionary().getNameAsString( "S", STYLE_SOLID );
130     }
131
132 }