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.

GraphicsSetLineType.java 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. /* $Id$ */
  18. package org.apache.fop.afp.goca;
  19. import java.io.IOException;
  20. import java.io.OutputStream;
  21. /**
  22. * Sets the value of the current line type attribute when stroking GOCA shapes (structured fields)
  23. */
  24. public class GraphicsSetLineType extends AbstractGraphicsDrawingOrder {
  25. /** the default line type */
  26. public static final byte DEFAULT = 0x00; // normally SOLID
  27. /** the default line type */
  28. public static final byte DOTTED = 0x01;
  29. /** short dashed line type */
  30. public static final byte SHORT_DASHED = 0x02;
  31. /** dashed dotted line type */
  32. public static final byte DASH_DOT = 0x03;
  33. /** double dotted line type */
  34. public static final byte DOUBLE_DOTTED = 0x04;
  35. /** long dashed line type */
  36. public static final byte LONG_DASHED = 0x05;
  37. /** dash double dotted line type */
  38. public static final byte DASH_DOUBLE_DOTTED = 0x06;
  39. /** solid line type */
  40. public static final byte SOLID = 0x07;
  41. /** invisible line type */
  42. public static final byte INVISIBLE = 0x08;
  43. /** line type */
  44. private byte type = DEFAULT;
  45. /**
  46. * Main constructor
  47. *
  48. * @param type line type
  49. */
  50. public GraphicsSetLineType(byte type) {
  51. this.type = type;
  52. }
  53. /** {@inheritDoc} */
  54. public int getDataLength() {
  55. return 2;
  56. }
  57. /** {@inheritDoc} */
  58. public void writeToStream(OutputStream os) throws IOException {
  59. byte[] data = new byte[] {
  60. getOrderCode(), // GSLW order code
  61. type // line type
  62. };
  63. os.write(data);
  64. }
  65. private static final String[] TYPES = {
  66. "default (solid)", "dotted", "short dashed", "dash dotted", "double dotted",
  67. "long dashed", "dash double dotted", "solid", "invisible"
  68. };
  69. /** {@inheritDoc} */
  70. public String toString() {
  71. return "GraphicsSetLineType{type=" + TYPES[type] + "}";
  72. }
  73. /** {@inheritDoc} */
  74. byte getOrderCode() {
  75. return 0x18;
  76. }
  77. }