You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PDFGraphicsDevice.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.svg;
  18. import java.awt.GraphicsDevice;
  19. import java.awt.GraphicsConfiguration;
  20. import java.awt.GraphicsConfigTemplate;
  21. /**
  22. * This implements the GraphicsDevice interface as appropriate for
  23. * a PDFGraphics2D. This is quite simple since we only have one
  24. * GraphicsConfiguration for now (this might change in the future
  25. * I suppose).
  26. */
  27. class PDFGraphicsDevice extends GraphicsDevice {
  28. /**
  29. * The Graphics Config that created us...
  30. */
  31. protected GraphicsConfiguration gc;
  32. /**
  33. * Create a new PDF graphics device.
  34. *
  35. * @param The gc we should reference
  36. */
  37. PDFGraphicsDevice(PDFGraphicsConfiguration gc) {
  38. this.gc = gc;
  39. }
  40. /**
  41. * Ignore template and return the only config we have
  42. *
  43. * @param gct the template configuration
  44. * @return the best configuration which is the only one
  45. */
  46. public GraphicsConfiguration getBestConfiguration(
  47. GraphicsConfigTemplate gct) {
  48. return gc;
  49. }
  50. /**
  51. * Return an array of our one GraphicsConfig
  52. *
  53. * @return an array containing the one graphics configuration
  54. */
  55. public GraphicsConfiguration[] getConfigurations() {
  56. return new GraphicsConfiguration[]{ gc };
  57. }
  58. /**
  59. * Return out sole GraphicsConfig.
  60. *
  61. * @return the grpahics configuration that created this object
  62. */
  63. public GraphicsConfiguration getDefaultConfiguration() {
  64. return gc;
  65. }
  66. /**
  67. * Generate an IdString..
  68. *
  69. * @return the ID string for this device, uses toString
  70. */
  71. public String getIDstring() {
  72. return toString();
  73. }
  74. /**
  75. * Let the caller know that we are "a printer"
  76. *
  77. * @return the type which is always printer
  78. */
  79. public int getType() {
  80. return GraphicsDevice.TYPE_PRINTER;
  81. }
  82. }