]> _ Git - cubeextranet.git/blob
4f51baace2be0acdb4b4c07b6f0fcdfef414697b
[cubeextranet.git] /
1 /*\r
2  * Licensed to the Apache Software Foundation (ASF) under one or more\r
3  * contributor license agreements.  See the NOTICE file distributed with\r
4  * this work for additional information regarding copyright ownership.\r
5  * The ASF licenses this file to You under the Apache License, Version 2.0\r
6  * (the "License"); you may not use this file except in compliance with\r
7  * the License.  You may obtain a copy of the License at\r
8  *\r
9  *      http://www.apache.org/licenses/LICENSE-2.0\r
10  *\r
11  * Unless required by applicable law or agreed to in writing, software\r
12  * distributed under the License is distributed on an "AS IS" BASIS,\r
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14  * See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  */\r
17 package org.apache.pdfbox.pdmodel.interactive.annotation;\r
18 \r
19 import org.apache.pdfbox.cos.COSBase;\r
20 import org.apache.pdfbox.cos.COSDictionary;\r
21 \r
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;\r
23 \r
24 /**\r
25  * This class represents a PDF /BE entry the border effect dictionary.\r
26  *\r
27  * @author Paul King\r
28  * @version $Revision: 1.1 $\r
29  */\r
30 public class PDBorderEffectDictionary implements COSObjectable\r
31 {\r
32 \r
33     /*\r
34      * The various values of the effect applied to the border as defined in the\r
35      * PDF 1.6 reference Table 8.14\r
36      */\r
37 \r
38     /**\r
39      * Constant for the name for no effect.\r
40      */\r
41     public static final String STYLE_SOLID = "S";\r
42 \r
43     /**\r
44      * Constant for the name of a cloudy effect.\r
45      */\r
46     public static final String STYLE_CLOUDY = "C";\r
47 \r
48     private COSDictionary dictionary;\r
49 \r
50     /**\r
51      * Constructor.\r
52      */\r
53     public PDBorderEffectDictionary()\r
54     {\r
55         dictionary = new COSDictionary();\r
56     }\r
57 \r
58     /**\r
59      * Constructor.\r
60      *\r
61      * @param dict\r
62      *            a border style dictionary.\r
63      */\r
64     public PDBorderEffectDictionary( COSDictionary dict )\r
65     {\r
66         dictionary = dict;\r
67     }\r
68 \r
69     /**\r
70      * returns the dictionary.\r
71      *\r
72      * @return the dictionary\r
73      */\r
74     public COSDictionary getDictionary()\r
75     {\r
76         return dictionary;\r
77     }\r
78 \r
79     /**\r
80      * returns the dictionary.\r
81      *\r
82      * @return the dictionary\r
83      */\r
84     public COSBase getCOSObject()\r
85     {\r
86         return dictionary;\r
87     }\r
88 \r
89     /**\r
90      * This will set the intensity of the applied effect.\r
91      *\r
92      * @param i\r
93      *            the intensity of the effect values 0 to 2\r
94      */\r
95     public void setIntensity( float i )\r
96     {\r
97         getDictionary().setFloat( "I", i );\r
98     }\r
99 \r
100     /**\r
101      * This will retrieve the intensity of the applied effect.\r
102      *\r
103      * @return the intensity value 0 to 2\r
104      */\r
105     public float getIntensity()\r
106     {\r
107         return getDictionary().getFloat( "I", 0 );\r
108     }\r
109 \r
110     /**\r
111      * This will set the border effect, see the STYLE_* constants for valid values.\r
112      *\r
113      * @param s\r
114      *            the border effect to use\r
115      */\r
116     public void setStyle( String s )\r
117     {\r
118         getDictionary().setName( "S", s );\r
119     }\r
120 \r
121     /**\r
122      * This will retrieve the border effect, see the STYLE_* constants for valid\r
123      * values.\r
124      *\r
125      * @return the effect of the border\r
126      */\r
127     public String getStyle()\r
128     {\r
129         return getDictionary().getNameAsString( "S", STYLE_SOLID );\r
130     }\r
131 \r
132 }\r