01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: /* $Id: PDFGraphicsDevice.java 426576 2006-07-28 15:44:37Z jeremias $ */
19:
20: package org.apache.fop.svg;
21:
22: import java.awt.GraphicsDevice;
23: import java.awt.GraphicsConfiguration;
24: import java.awt.GraphicsConfigTemplate;
25:
26: /**
27: * This implements the GraphicsDevice interface as appropriate for
28: * a PDFGraphics2D. This is quite simple since we only have one
29: * GraphicsConfiguration for now (this might change in the future
30: * I suppose).
31: */
32: class PDFGraphicsDevice extends GraphicsDevice {
33:
34: /**
35: * The Graphics Config that created us...
36: */
37: protected GraphicsConfiguration gc;
38:
39: /**
40: * Create a new PDF graphics device.
41: *
42: * @param The gc we should reference
43: */
44: PDFGraphicsDevice(PDFGraphicsConfiguration gc) {
45: this .gc = gc;
46: }
47:
48: /**
49: * Ignore template and return the only config we have
50: *
51: * @param gct the template configuration
52: * @return the best configuration which is the only one
53: */
54: public GraphicsConfiguration getBestConfiguration(
55: GraphicsConfigTemplate gct) {
56: return gc;
57: }
58:
59: /**
60: * Return an array of our one GraphicsConfig
61: *
62: * @return an array containing the one graphics configuration
63: */
64: public GraphicsConfiguration[] getConfigurations() {
65: return new GraphicsConfiguration[] { gc };
66: }
67:
68: /**
69: * Return out sole GraphicsConfig.
70: *
71: * @return the grpahics configuration that created this object
72: */
73: public GraphicsConfiguration getDefaultConfiguration() {
74: return gc;
75: }
76:
77: /**
78: * Generate an IdString..
79: *
80: * @return the ID string for this device, uses toString
81: */
82: public String getIDstring() {
83: return toString();
84: }
85:
86: /**
87: * Let the caller know that we are "a printer"
88: *
89: * @return the type which is always printer
90: */
91: public int getType() {
92: return GraphicsDevice.TYPE_PRINTER;
93: }
94:
95: }
|