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.

Picture.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.ss.usermodel;
  16. import java.awt.Dimension;
  17. /**
  18. * Repersents a picture in a SpreadsheetML document
  19. *
  20. * @author Yegor Kozlov
  21. */
  22. public interface Picture {
  23. /**
  24. * Reset the image to the dimension of the embedded image
  25. *
  26. * @see #resize(double, double)
  27. */
  28. void resize();
  29. /**
  30. * Resize the image proportionally.
  31. *
  32. * @see #resize(double, double)
  33. */
  34. void resize(double scale);
  35. /**
  36. * Resize the image.
  37. * <p>
  38. * Please note, that this method works correctly only for workbooks
  39. * with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx).
  40. * If the default font is changed the resized image can be streched vertically or horizontally.
  41. * </p>
  42. * <p>
  43. * <code>resize(1.0,1.0)</code> keeps the original size,<br/>
  44. * <code>resize(0.5,0.5)</code> resize to 50% of the original,<br/>
  45. * <code>resize(2.0,2.0)</code> resizes to 200% of the original.<br/>
  46. * <code>resize({@link Double#MAX_VALUE},{@link Double#MAX_VALUE})</code> resizes to the dimension of the embedded image.
  47. * </p>
  48. *
  49. * @param scaleX the amount by which the image width is multiplied relative to the original width.
  50. * @param scaleY the amount by which the image height is multiplied relative to the original height.
  51. */
  52. void resize(double scaleX, double scaleY);
  53. /**
  54. * Calculate the preferred size for this picture.
  55. *
  56. * @return XSSFClientAnchor with the preferred size for this image
  57. */
  58. ClientAnchor getPreferredSize();
  59. /**
  60. * Calculate the preferred size for this picture.
  61. *
  62. * @param scaleX the amount by which image width is multiplied relative to the original width.
  63. * @param scaleY the amount by which image height is multiplied relative to the original height.
  64. * @return ClientAnchor with the preferred size for this image
  65. */
  66. ClientAnchor getPreferredSize(double scaleX, double scaleY);
  67. /**
  68. * Return the dimension of the embedded image in pixel
  69. *
  70. * @return image dimension in pixels
  71. */
  72. Dimension getImageDimension();
  73. /**
  74. * Return picture data for this picture
  75. *
  76. * @return picture data for this picture
  77. */
  78. PictureData getPictureData();
  79. /**
  80. * @return the anchor that is used by this picture
  81. */
  82. ClientAnchor getClientAnchor();
  83. /**
  84. * @return the sheet which contains the picture
  85. */
  86. Sheet getSheet();
  87. }