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.

GraphicsSetPatternSymbol.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 pattern symbol to use when filling following GOCA structured fields
  23. */
  24. public class GraphicsSetPatternSymbol extends AbstractGraphicsDrawingOrder {
  25. /** dotted density 1 */
  26. public static final byte DOTTED_DENSITY_1 = 0x01;
  27. /** dotted density 2 */
  28. public static final byte DOTTED_DENSITY_2 = 0x02;
  29. /** dotted density 3 */
  30. public static final byte DOTTED_DENSITY_3 = 0x03;
  31. /** dotted density 4 */
  32. public static final byte DOTTED_DENSITY_4 = 0x04;
  33. /** dotted density 5 */
  34. public static final byte DOTTED_DENSITY_5 = 0x05;
  35. /** dotted density 6 */
  36. public static final byte DOTTED_DENSITY_6 = 0x06;
  37. /** dotted density 7 */
  38. public static final byte DOTTED_DENSITY_7 = 0x07;
  39. /** dotted density 8 */
  40. public static final byte DOTTED_DENSITY_8 = 0x08;
  41. /** dotted density 9 */
  42. public static final byte VERTICAL_LINES = 0x09;
  43. /** horizontal lines */
  44. public static final byte HORIZONTAL_LINES = 0x0A;
  45. /** diagonal lines, bottom left to top right 1 */
  46. public static final byte DIAGONAL_LINES_BLTR_1 = 0x0B;
  47. /** diagonal lines, bottom left to top right 2 */
  48. public static final byte DIAGONAL_LINES_BLTR_2 = 0x0C;
  49. /** diagonal lines, top left to bottom right 1 */
  50. public static final byte DIAGONAL_LINES_TLBR_1 = 0x0D;
  51. /** diagonal lines, top left to bottom right 2 */
  52. public static final byte DIAGONAL_LINES_TLBR_2 = 0x0E;
  53. /** no fill */
  54. public static final byte NO_FILL = 0x0F;
  55. /** solid fill */
  56. public static final byte SOLID_FILL = 0x10;
  57. /** blank (same as no fill) */
  58. public static final byte BLANK = 0x40; // processed same as NO_FILL
  59. /** the graphics pattern symbol to use */
  60. private final byte pattern;
  61. /**
  62. * Main constructor
  63. *
  64. * @param symb the pattern symbol to use
  65. */
  66. public GraphicsSetPatternSymbol(byte pattern) {
  67. this.pattern = pattern;
  68. }
  69. /** {@inheritDoc} */
  70. public int getDataLength() {
  71. return 2;
  72. }
  73. /** {@inheritDoc} */
  74. public void writeToStream(OutputStream os) throws IOException {
  75. byte[] data = new byte[] {
  76. getOrderCode(), // GSPT order code
  77. pattern
  78. };
  79. os.write(data);
  80. }
  81. /** {@inheritDoc} */
  82. public String toString() {
  83. return "GraphicsSetPatternSymbol(fill="
  84. + (pattern == SOLID_FILL ? true : false) + ")";
  85. }
  86. /** {@inheritDoc} */
  87. byte getOrderCode() {
  88. return 0x28;
  89. }
  90. }