Skip to content

Commit b7cf21a

Browse files
committed
Add new ZRect constructor and method
1 parent ca8b454 commit b7cf21a

File tree

1 file changed

+12
-0
lines changed
  • src/main/groovy/net/zomis/machlearn/images

1 file changed

+12
-0
lines changed

src/main/groovy/net/zomis/machlearn/images/ZRect.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ public ZRect() {
1111
this(0, 0, 0, 0);
1212
}
1313

14+
public ZRect(ZRect copyOf) {
15+
this(copyOf.left, copyOf.top, copyOf.right, copyOf.bottom);
16+
}
17+
1418
public ZRect(int left, int top, int right, int bottom) {
1519
this.left = left;
1620
this.top = top;
@@ -35,4 +39,12 @@ public int width() {
3539
public int height() {
3640
return this.bottom - this.top;
3741
}
42+
43+
public ZRect expand(int amount) {
44+
this.left -= amount;
45+
this.top -= amount;
46+
this.right += amount;
47+
this.bottom += amount;
48+
return this;
49+
}
3850
}

0 commit comments

Comments
 (0)