X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fhtmlindexer%2Fmetadata%2FfileTypes%2FPicture.java;h=ae220712167d35b120178d1aa95f3faf10491323;hb=567410640f4e0428caf9de9fc83df4c73f0e5067;hp=7ed4d092efae911a6151e4a7f6389975d537c336;hpb=1b742640af99284aae1cd10c259254137316ba7c;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java b/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java index 7ed4d09..ae22071 100755 --- a/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java +++ b/src/main/java/eu/svjatoslav/meviz/htmlindexer/metadata/fileTypes/Picture.java @@ -1,11 +1,11 @@ /* * Meviz - Various tools collection to work with multimedia. - * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * Copyright (C) 2012 -- 2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ + * modify it under the terms of version 3 of the GNU Lesser General Public License + * or later as published by the Free Software Foundation. +*/ package eu.svjatoslav.meviz.htmlindexer.metadata.fileTypes; @@ -27,6 +27,8 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import static eu.svjatoslav.meviz.htmlindexer.Utils.getBufferedImage; + public class Picture extends AbstractFile { private static final long serialVersionUID = -4156533490858298387L; @@ -53,7 +55,7 @@ public class Picture extends AbstractFile { * exceeding provided thumbnail width and height, and preserving aspect * ratio of original image. */ - public static java.awt.Dimension getTargetThumbnailDimension( + private static java.awt.Dimension getTargetThumbnailDimension( final java.awt.Dimension originalImageDimension, final java.awt.Dimension desiredTargetDimension) { @@ -87,7 +89,7 @@ public class Picture extends AbstractFile { * Propose list of thumbnail dimensions. */ public static List getThumbnailDimensions(Dimension current) { - final ArrayList result = new ArrayList(); + final ArrayList result = new ArrayList<>(); result.add(current); while (current.getArea() > 1000000) { @@ -105,7 +107,7 @@ public class Picture extends AbstractFile { try { - final BufferedImage inputImage = Utils.getBufferedImage(inputFile); + final BufferedImage inputImage = getBufferedImage(inputFile); final java.awt.Dimension sourceImageDimension = new java.awt.Dimension( inputImage.getWidth(), inputImage.getHeight()); @@ -138,8 +140,8 @@ public class Picture extends AbstractFile { /** * @return new image scaled to desired dimensions */ - public static Image scaleImage(final Image srcImage, final int width, - final int height) { + private static Image scaleImage(final Image srcImage, final int width, + final int height) { final ImageFilter filter = new java.awt.image.AreaAveragingScaleFilter( width, height); @@ -179,9 +181,8 @@ public class Picture extends AbstractFile { } @Override - public void updateFileMetainfo(final File parentDirectory) throws Exception { - final BufferedImage image = Utils - .getBufferedImage(getFile(parentDirectory)); + public void updateFileMetadata(final File parentDirectory) throws Exception { + final BufferedImage image = getBufferedImage(getFile(parentDirectory)); dimensions = new Dimension(image.getWidth(), image.getHeight()); }