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 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. /**
  30. * Default constructor
  31. */
  32. public AFPImageObjectInfo() {
  33. super();
  34. }
  35. /**
  36. * Sets the number of bits per pixel
  37. *
  38. * @param bitsPerPixel the number of bits per pixel
  39. */
  40. public void setBitsPerPixel(int bitsPerPixel) {
  41. this.bitsPerPixel = bitsPerPixel;
  42. }
  43. /**
  44. * Sets if this image is color
  45. *
  46. * @param color true if this is a color image
  47. */
  48. public void setColor(boolean color) {
  49. this.color = color;
  50. }
  51. /**
  52. * Returns the number of bits used per pixel
  53. *
  54. * @return the number of bits used per pixel
  55. */
  56. public int getBitsPerPixel() {
  57. return bitsPerPixel;
  58. }
  59. /**
  60. * Returns true if this is a color image
  61. *
  62. * @return true if this is a color image
  63. */
  64. public boolean isColor() {
  65. return color;
  66. }
  67. /**
  68. * Returns true if this image uses compression
  69. *
  70. * @return true if this image uses compression
  71. */
  72. public boolean hasCompression() {
  73. return compression > -1;
  74. }
  75. /**
  76. * Returns the compression type
  77. *
  78. * @return the compression type
  79. */
  80. public int getCompression() {
  81. return compression;
  82. }
  83. /**
  84. * Sets the compression used with this image
  85. *
  86. * @param compression the type of compression used with this image
  87. */
  88. public void setCompression(int compression) {
  89. this.compression = compression;
  90. }
  91. /** {@inheritDoc} */
  92. public String toString() {
  93. return "AFPImageObjectInfo{" + super.toString()
  94. + ", compression=" + compression
  95. + ", color=" + color
  96. + ", bitsPerPixel=" + bitsPerPixel
  97. + "}";
  98. }
  99. }