Skip to content

Commit

Permalink
Check for to many rows in Hexagon
Browse files Browse the repository at this point in the history
//TODO: Resizing vertical images in Hexagon results in brocken pixels
  • Loading branch information
lr101 committed Jan 30, 2024
1 parent 597d52f commit a3e43a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/main/java/Hexagon.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ int getHeight(int rows) {
}

int getWidth(int width) {
return (width / (2 * this.getXSize())) * 2 * this.getXSize();
int w = (width / (2 * this.getXSize())) * 2 * this.getXSize();
if (w <= 1) {
throw new NullPointerException("Height is big -> Therefore width is smaller than 1 pixel");
}
return w;
}

public void setSize(int width, int numImages, int rows) {
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ public static void main(String[] args) {
print("Stopping without doing anything: Not enough images found (only 0 or 1)");
return;
}
if (SELECTED_SHAPE instanceof Hexagon) {
m = new ShapeManagement(new File(picturesDir), imagePaths, SELECTED_SHAPE, new File(picturesDir), HEIGHT, WIDTH);
} else {
m = new ShapeManagement(new File(picturesDir), imagePaths, SELECTED_SHAPE, new File(picturesDir), new Dimension(WIDTH, HEIGHT));
try {
if (SELECTED_SHAPE instanceof Hexagon) {
m = new ShapeManagement(new File(picturesDir), imagePaths, SELECTED_SHAPE, new File(picturesDir), HEIGHT, WIDTH);
} else {
m = new ShapeManagement(new File(picturesDir), imagePaths, SELECTED_SHAPE, new File(picturesDir), new Dimension(WIDTH, HEIGHT));
}
m.run(FILE_NAME);
} catch (Exception e){
print("Stopping: " + e.getMessage());
return;
}
m.run(FILE_NAME);
print("Finished: Saved into: " + FILE_NAME);

}
Expand Down

0 comments on commit a3e43a6

Please sign in to comment.