KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > SVGHintsDescriptor


1 /*
2
3    Copyright 2001,2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    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 org.apache.batik.svggen;
19
20 import java.util.HashMap JavaDoc;
21 import java.util.LinkedList JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24
25 /**
26  * Describes a set of SVG hints
27  *
28  * @author <a HREF="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
29  * @version $Id: SVGHintsDescriptor.java,v 1.7 2004/08/18 07:15:07 vhardy Exp $
30  * @see org.apache.batik.svggen.SVGRenderingHints
31  */

32 public class SVGHintsDescriptor implements SVGDescriptor, SVGSyntax {
33     private String JavaDoc colorInterpolation;
34     private String JavaDoc colorRendering;
35     private String JavaDoc textRendering;
36     private String JavaDoc shapeRendering;
37     private String JavaDoc imageRendering;
38
39     /**
40      * Constructor
41      */

42     public SVGHintsDescriptor(String JavaDoc colorInterpolation,
43                               String JavaDoc colorRendering,
44                               String JavaDoc textRendering,
45                               String JavaDoc shapeRendering,
46                               String JavaDoc imageRendering){
47         if(colorInterpolation == null ||
48            colorRendering == null ||
49            textRendering == null ||
50            shapeRendering == null ||
51            imageRendering == null)
52             throw new SVGGraphics2DRuntimeException(ErrorConstants.ERR_HINT_NULL);
53
54         this.colorInterpolation = colorInterpolation;
55         this.colorRendering = colorRendering;
56         this.textRendering = textRendering;
57         this.shapeRendering = shapeRendering;
58         this.imageRendering = imageRendering;
59     }
60
61     public Map JavaDoc getAttributeMap(Map JavaDoc attrMap) {
62         if (attrMap == null)
63             attrMap = new HashMap JavaDoc();
64
65         attrMap.put(SVG_COLOR_INTERPOLATION_ATTRIBUTE, colorInterpolation);
66         attrMap.put(SVG_COLOR_RENDERING_ATTRIBUTE, colorRendering);
67         attrMap.put(SVG_TEXT_RENDERING_ATTRIBUTE, textRendering);
68         attrMap.put(SVG_SHAPE_RENDERING_ATTRIBUTE, shapeRendering);
69         attrMap.put(SVG_IMAGE_RENDERING_ATTRIBUTE, imageRendering);
70
71         return attrMap;
72     }
73
74     public List JavaDoc getDefinitionSet(List JavaDoc defSet) {
75         if (defSet == null)
76             defSet = new LinkedList JavaDoc();
77
78         return defSet;
79     }
80 }
81
Popular Tags