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.

AFPImageObjectInfo.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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;
  19. /**
  20. * A list of parameters associated with an image
  21. */
  22. public class AFPImageObjectInfo extends AFPDataObjectInfo {
  23. /** number of bits per pixel used */
  24. private int bitsPerPixel;
  25. /** is this a color image? */
  26. private boolean color;
  27. /** compression type if any */
  28. private int compression = -1;
  29. private boolean subtractive;
  30. /**
  31. * Default constructor
  32. */
  33. public AFPImageObjectInfo() {
  34. super();
  35. }
  36. /**
  37. * Sets the number of bits per pixel
  38. *
  39. * @param bitsPerPixel the number of bits per pixel
  40. */
  41. public void setBitsPerPixel(int bitsPerPixel) {
  42. this.bitsPerPixel = bitsPerPixel;
  43. }
  44. /**
  45. * Sets if this image is color
  46. *
  47. * @param color true if this is a color image
  48. */
  49. public void setColor(boolean color) {
  50. this.color = color;
  51. }
  52. /**
  53. * Returns the number of bits used per pixel
  54. *
  55. * @return the number of bits used per pixel
  56. */
  57. public int getBitsPerPixel() {
  58. return bitsPerPixel;
  59. }
  60. /**
  61. * Returns true if this is a color image
  62. *
  63. * @return true if this is a color image
  64. */
  65. public boolean isColor() {
  66. return color;
  67. }
  68. /**
  69. * Returns true if this image uses compression
  70. *
  71. * @return true if this image uses compression
  72. */
  73. public boolean hasCompression() {
  74. return compression != -1;
  75. }
  76. /**
  77. * Returns the compression type
  78. *
  79. * @return the compression type
  80. */
  81. public int getCompression() {
  82. return compression;
  83. }
  84. /**
  85. * Sets the compression used with this image
  86. *
  87. * @param compression the type of compression used with this image
  88. */
  89. public void setCompression(int compression) {
  90. this.compression = compression;
  91. }
  92. /**
  93. * Set either additive or subtractive mode (used for ASFLAG).
  94. * @param subtractive true for subtractive mode, false for additive mode
  95. */
  96. public void setSubtractive(boolean subtractive) {
  97. this.subtractive = subtractive;
  98. }
  99. /**
  100. * Indicates whether additive or subtractive mode is set.
  101. * @return true for subtractive mode, false for additive mode
  102. */
  103. public boolean isSubtractive() {
  104. return subtractive;
  105. }
  106. /** {@inheritDoc} */
  107. @Override
  108. public String toString() {
  109. return "AFPImageObjectInfo{" + super.toString()
  110. + ", compression=" + compression
  111. + ", color=" + color
  112. + ", bitsPerPixel=" + bitsPerPixel
  113. + ", " + (isSubtractive() ? "subtractive" : "additive")
  114. + "}";
  115. }
  116. }