mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
代替としてStoreで管理するように
This commit is contained in:
parent
0b2d58470b
commit
da9cd9be8e
|
@ -304,7 +304,16 @@ public class FileManagerImpl implements FileManager {
|
||||||
private void saveBitmapInternal(Bitmap bitmap, Path path) throws IOException {
|
private void saveBitmapInternal(Bitmap bitmap, Path path) throws IOException {
|
||||||
try {
|
try {
|
||||||
logger.debug("saveBitmapInternal", "path: " + path);
|
logger.debug("saveBitmapInternal", "path: " + path);
|
||||||
bitmap.compress(Bitmap.CompressFormat.PNG, Store.Scan.PNG_QUALITY, Files.newOutputStream(path));
|
// Bitmapの長辺を1024pxにする
|
||||||
|
int width = bitmap.getWidth();
|
||||||
|
int height = bitmap.getHeight();
|
||||||
|
float scale = 1.0f;
|
||||||
|
if (width > height) {
|
||||||
|
scale = Store.Scan.MAX_RESOLUTION_LONG / width;
|
||||||
|
} else {
|
||||||
|
scale = Store.Scan.MAX_RESOLUTION_LONG / height;
|
||||||
|
}
|
||||||
|
bitmap.compress(new Store.Scan().COMPRESS_FORMAT, Store.Scan.QUALITY, Files.newOutputStream(path));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("saveBitmapInternal", e.getMessage());
|
logger.error("saveBitmapInternal", e.getMessage());
|
||||||
throw new IOException("Failed to save bitmap");
|
throw new IOException("Failed to save bitmap");
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class FeatureSwitch {
|
||||||
|
|
||||||
public static class FeatureMaster {
|
public static class FeatureMaster {
|
||||||
public static boolean enableSearch = false;
|
public static boolean enableSearch = false;
|
||||||
public static boolean enableDebugMenu = false;
|
public static boolean enableDebugMenu = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Vcs {
|
public static class Vcs {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package one.nem.lacerta.utils;
|
package one.nem.lacerta.utils;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
public class Store {
|
public class Store {
|
||||||
public class Scan {
|
public static class Scan {
|
||||||
public static final int PNG_QUALITY = 60;
|
public Bitmap.CompressFormat COMPRESS_FORMAT = Bitmap.CompressFormat.JPEG;
|
||||||
|
public static final int QUALITY = 60;
|
||||||
|
public static final float MAX_RESOLUTION_LONG = 2048;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user