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.

AFPRendererImageInfo.java 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.render.afp;
  19. import java.awt.Point;
  20. import java.awt.geom.Rectangle2D;
  21. import java.util.Map;
  22. import org.apache.xmlgraphics.image.loader.Image;
  23. import org.apache.xmlgraphics.image.loader.ImageInfo;
  24. import org.apache.fop.render.RendererContext;
  25. /**
  26. * The AFP image information
  27. */
  28. public class AFPRendererImageInfo {
  29. /** the image uri */
  30. protected final String uri;
  31. /** the current pos */
  32. protected final Rectangle2D pos;
  33. /** the origin */
  34. protected final Point origin;
  35. /** the foreign attributes */
  36. protected final Map foreignAttributes;
  37. /** the image info */
  38. protected final ImageInfo info;
  39. /** the image */
  40. protected final Image img;
  41. /** the renderer context */
  42. protected RendererContext rendererContext;
  43. /**
  44. * Main constructor
  45. *
  46. * @param uri the image uri
  47. * @param pos the image content area
  48. * @param origin the current position
  49. * @param info the image info
  50. * @param img the image
  51. * @param rendererContext the renderer context
  52. * @param foreignAttributes the foreign attributes
  53. */
  54. public AFPRendererImageInfo(String uri, Rectangle2D pos, Point origin,
  55. ImageInfo info, Image img, RendererContext rendererContext, Map foreignAttributes) {
  56. this.uri = uri;
  57. this.pos = pos;
  58. this.origin = origin;
  59. this.info = info;
  60. this.img = img;
  61. this.rendererContext = rendererContext;
  62. this.foreignAttributes = foreignAttributes;
  63. }
  64. /**
  65. * Sets the renderer context
  66. *
  67. * @param rendererContext the renderer context
  68. */
  69. public void setRendererContext(RendererContext rendererContext) {
  70. this.rendererContext = rendererContext;
  71. }
  72. /**
  73. * Returns the image info
  74. *
  75. * @return the image info
  76. */
  77. public ImageInfo getImageInfo() {
  78. return this.info;
  79. }
  80. /**
  81. * Returns the image
  82. *
  83. * @return the image
  84. */
  85. public Image getImage() {
  86. return this.img;
  87. }
  88. /**
  89. * Returns the renderer context
  90. *
  91. * @return the renderer context
  92. */
  93. public RendererContext getRendererContext() {
  94. return this.rendererContext;
  95. }
  96. /**
  97. * Return the foreign attributes
  98. * @return the foreign attributes
  99. */
  100. public Map getForeignAttributes() {
  101. return this.foreignAttributes;
  102. }
  103. /**
  104. * Return the uri
  105. *
  106. * @return the uri
  107. */
  108. public String getURI() {
  109. return this.uri;
  110. }
  111. /**
  112. * Return the origin
  113. *
  114. * @return the origin
  115. */
  116. public Point getOrigin() {
  117. return this.origin;
  118. }
  119. /**
  120. * Return the position
  121. *
  122. * @return the position
  123. */
  124. public Rectangle2D getPosition() {
  125. return this.pos;
  126. }
  127. /** {@inheritDoc} */
  128. public String toString() {
  129. return "AFPRendererImageInfo{\n"
  130. + "\turi=" + uri + ",\n"
  131. + "\tinfo=" + info + ",\n"
  132. + "\tpos=" + pos + ",\n"
  133. + "\torigin=" + origin + ",\n"
  134. + "\timg=" + img + ",\n"
  135. + "\tforeignAttributes=" + foreignAttributes + ",\n"
  136. + "\trendererContext=" + rendererContext + "\n"
  137. + "}";
  138. }
  139. }