-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add maven support. Docker still TODO
- Loading branch information
Showing
12 changed files
with
64 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM openjdk:17-jdk-slim AS build | ||
|
||
COPY pom.xml mvnw ./ | ||
COPY .mvn .mvn | ||
RUN ./mvnw dependency:resolve | ||
|
||
COPY src src | ||
RUN ./mvnw package | ||
|
||
FROM openjdk:17-jdk-slim | ||
WORKDIR demo | ||
COPY --from=build target/*.jar demo.jar | ||
ENTRYPOINT ["java", "-jar", "picturecollage-1.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
package main.java; | ||
|
||
public record Coordinate(int xC, int yC) { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
package main.java; | ||
|
||
public class Dimension { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
package main.java; | ||
|
||
import main.java.DefaultShape; | ||
|
||
import javax.imageio.ImageIO; | ||
import java.awt.*; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,39 @@ | ||
package main.java; | ||
|
||
import java.awt.*; | ||
import java.io.File; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.Objects; | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
|
||
private static String PICTURES_DIR; | ||
private static String SAVED_TO_DIR; | ||
public static DefaultShape SELECTED_SHAPE; | ||
public static int WIDTH; | ||
public static int HEIGHT; | ||
public static String FILE_NAME; | ||
|
||
public static void main(String[] args) { | ||
print("Collage created BY [email protected]\n"); | ||
Scanner scanner = new Scanner(System.in); | ||
File path = new File("C"); | ||
|
||
while(!path.isDirectory()){ | ||
print("Type the path to directory of the images you choose to use: "); | ||
path = new File(scanner.nextLine()); | ||
PICTURES_DIR = path.getAbsolutePath(); | ||
SAVED_TO_DIR = PICTURES_DIR; | ||
} | ||
File path = new File(System.getenv("IMAGES_PATH")); | ||
String picturesDir = path.getAbsolutePath(); | ||
SELECTED_SHAPE = System.getenv("SHAPE").equals("Hexagon") ? new Hexagon() : new Rectangle(); | ||
WIDTH = Integer.parseInt(System.getenv("WIDTH")); | ||
HEIGHT = Integer.parseInt(System.getenv("HEIGHT")); | ||
|
||
FILE_NAME = new SimpleDateFormat("yyyyMMddHHmm'_collage'").format(new Date()); | ||
|
||
print("Collage created BY [email protected]\n"); | ||
print("Used directory: " + picturesDir); | ||
print("Used shape:" + SELECTED_SHAPE.toString()); | ||
print("Used width:" + WIDTH); | ||
print("Used Height: " + HEIGHT + " " + (SELECTED_SHAPE instanceof Hexagon ? "rows" : "pixel")); | ||
print("Saving into: " + FILE_NAME); | ||
|
||
|
||
boolean test = true; | ||
print("Choose your shape (0: Rectangle | 1: Hexagon): "); | ||
while(test){ | ||
if (scanner.hasNextInt()){ | ||
int i = scanner.nextInt(); | ||
if (i == 0) { | ||
SELECTED_SHAPE = new Rectangle(); | ||
test = false; | ||
} else if (i == 1) { | ||
SELECTED_SHAPE = new Hexagon(); | ||
test = false; | ||
} else { | ||
scanner.next(); | ||
print("Choose your shape (0: Rectangle | 1: Hexagon): "); | ||
} | ||
}else { | ||
scanner.next(); | ||
print("Choose your shape (0: Rectangle | 1: Hexagon: "); | ||
} | ||
} | ||
|
||
test = true; | ||
print("Width (in pixel): "); | ||
while(test){ | ||
if (scanner.hasNextInt()){ | ||
WIDTH = scanner.nextInt(); | ||
test = false; | ||
}else { | ||
scanner.next(); | ||
print("Width (in pixel): "); | ||
} | ||
} | ||
|
||
|
||
test = true; | ||
print("Height (" + (SELECTED_SHAPE instanceof Hexagon ? "in rows" : "in pixel") + "): "); | ||
while(test){ | ||
if (scanner.hasNextInt()){ | ||
HEIGHT = scanner.nextInt(); | ||
test = false; | ||
}else { | ||
scanner.next(); | ||
print("Height (in pixel): "); | ||
} | ||
} | ||
|
||
test = true; | ||
print("Name of final image: "); | ||
while(test){ | ||
if (scanner.hasNext()){ | ||
FILE_NAME = scanner.next(); | ||
test = false; | ||
}else { | ||
scanner.next(); | ||
print("Name of final image: "); | ||
} | ||
} | ||
|
||
scanner.close(); | ||
ShapeManagement m; | ||
int numImages = Objects.requireNonNull(new File(PICTURES_DIR).list((dir, name) -> (name.toLowerCase().endsWith(".jpg") || name.toLowerCase().endsWith(".jpeg") || name.toLowerCase().endsWith(".png")))).length; | ||
int numImages = Objects.requireNonNull(new File(picturesDir).list((dir, name) -> (name.toLowerCase().endsWith(".jpg") || name.toLowerCase().endsWith(".jpeg") || name.toLowerCase().endsWith(".png")))).length; | ||
if (SELECTED_SHAPE instanceof Hexagon) { | ||
m = new ShapeManagement(new File(PICTURES_DIR), SELECTED_SHAPE, new File(SAVED_TO_DIR), HEIGHT, WIDTH, numImages); | ||
m = new ShapeManagement(new File(picturesDir), SELECTED_SHAPE, new File(picturesDir), HEIGHT, WIDTH, numImages); | ||
} else { | ||
m = new ShapeManagement(new File(PICTURES_DIR), SELECTED_SHAPE, new File(SAVED_TO_DIR), new Dimension(WIDTH, HEIGHT)); | ||
m = new ShapeManagement(new File(picturesDir), SELECTED_SHAPE, new File(picturesDir), new Dimension(WIDTH, HEIGHT)); | ||
} | ||
m.run(FILE_NAME); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main.java; | ||
|
||
|
||
public class RectanglePair { | ||
private Image rec1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters