SVG resources scaling, closes #214
This commit is contained in:
@@ -56,9 +56,9 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream) {
|
||||
public Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
|
||||
try {
|
||||
return new AndroidSvgBitmap(inputStream);
|
||||
return new AndroidSvgBitmap(inputStream, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
@@ -66,9 +66,9 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src) {
|
||||
public Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src, int width, int height, int percent) {
|
||||
try {
|
||||
return createBitmap(relativePathPrefix, src);
|
||||
return createBitmap(relativePathPrefix, src, width, height, percent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013-2014 Ludwig M Brinckmann
|
||||
* Copyright 2014-2016 devemux86
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@@ -74,13 +76,13 @@ public class AndroidSvgBitmap extends AndroidBitmap {
|
||||
}
|
||||
}
|
||||
|
||||
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream) throws IOException {
|
||||
private static android.graphics.Bitmap getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
synchronized (SVG.getVersion()) {
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, 0, 0, 100);
|
||||
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
|
||||
}
|
||||
}
|
||||
|
||||
public AndroidSvgBitmap(InputStream inputStream) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream));
|
||||
public AndroidSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {
|
||||
super(getResourceBitmapImpl(inputStream, width, height, percent));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user