MCPcopy
hub / github.com/coobird/thumbnailator / Region

Class Region

src/main/java/net/coobird/thumbnailator/geometry/Region.java:39–151  ·  view source on GitHub ↗

A representation of a region, using a Position object and a Dimension object. @author coobird @since 0.3.4

Source from the content-addressed store, hash-verified

37 *
38 */
39public final class Region {
40 /**
41 * Position of the region.
42 */
43 private final Position position;
44
45 /**
46 * Size of the region.
47 */
48 private final Size size;
49
50 /**
51 * Instantiates a representation of a region from a {@link Position} and
52 * {@link Size}.
53 *
54 * @param position Position of the region.
55 * @param size Size of the region.
56 * @throws NullPointerException When the position and/or the size is
57 * {@code null}.
58 */
59 public Region(Position position, Size size) {
60 super();
61 if (position == null) {
62 throw new NullPointerException("Position cannot be null.");
63 }
64 if (size == null) {
65 throw new NullPointerException("Size cannot be null.");
66 }
67
68 this.position = position;
69 this.size = size;
70 }
71
72 /**
73 * Returns the position of the region.
74 *
75 * @return Position of the region.
76 */
77 public Position getPosition() {
78 return position;
79 }
80
81 /**
82 * Returns the size of the region.
83 *
84 * @return Size of the region.
85 */
86 public Size getSize() {
87 return size;
88 }
89
90 /**
91 * Calculates the position and size of the enclosed region, relative to the
92 * enclosing region.
93 * <p>
94 * The portions of the enclosed region which lies outside the enclosing
95 * region are ignored. Effectively, the {@link Rectangle} returned by this
96 * method is an intersection of the enclosing and enclose regions.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…