Merge commit 'efc2845' into resize

This commit is contained in:
CodeSteak 2019-06-12 18:53:42 +02:00
commit 9a3524143a
1 changed files with 4 additions and 3 deletions

View File

@ -48,11 +48,11 @@ class RootController : Controller() {
* @param tags all tags for the file
*/
fun importTexture(path: String, name: String, tags: ObservableList<String>) {
var data = Files.readAllBytes(File(path).toPath()) // this is the image as byte array
val data = Files.readAllBytes(File(path).toPath()) // this is the image as byte array
val uuid = UUID.randomUUID()
val format = if (File(path).extension.toLowerCase() == "png") TextureFormat.PNG else TextureFormat.JPEG
val bimg = ImageIO.read(File(path)) //image for obtaining resolution
var bimg = ImageIO.read(File(path)) //image for obtaining resolution
val resolution = Pair(bimg.height, bimg.width)
val cal = Calendar.getInstance() //calendar obj with current time
val hash = Sha256(data)
@ -72,7 +72,6 @@ class RootController : Controller() {
"-fx-button-type: RAISED; -fx-background-color: #2b7bbb; -fx-text-fill: #000000;"
)
data = null //Free image
val newTexture = Texture(uuid, name, tags.toTypedArray(), format, resolution, cal, hash)
@ -84,7 +83,9 @@ class RootController : Controller() {
alertImportHash.showAndWait()
} catch (e: Exception) {
alertImport.showAndWait()
println(e)
}
}
/**