SVG resources scaling, closes #214

This commit is contained in:
Emux
2016-12-07 19:58:23 +02:00
parent 6344542b10
commit 4cd11462da
16 changed files with 380 additions and 137 deletions

View File

@@ -30,7 +30,7 @@ import java.io.InputStream;
*/
public class IosGraphics extends CanvasAdapter {
static final Logger log = LoggerFactory.getLogger(IosGraphics.class);
private static final Logger log = LoggerFactory.getLogger(IosGraphics.class);
public static void init() {
CanvasAdapter.init(new IosGraphics());
@@ -62,9 +62,9 @@ public class IosGraphics extends CanvasAdapter {
}
@Override
protected Bitmap decodeSvgBitmapImpl(InputStream inputStream) {
protected Bitmap decodeSvgBitmapImpl(InputStream inputStream, int width, int height, int percent) {
try {
return new IosSvgBitmap(inputStream);
return new IosSvgBitmap(inputStream, width, height, percent);
} catch (IOException e) {
log.error("decodeSvgBitmapImpl", e);
return null;
@@ -72,9 +72,9 @@ public class IosGraphics extends CanvasAdapter {
}
@Override
protected Bitmap loadBitmapAssetImpl(String relativePathPrefix, String src) {
protected 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) {
log.error("loadBitmapAssetImpl", e);
return null;

View File

@@ -89,11 +89,11 @@ public class IosSvgBitmap extends IosBitmap {
return renderer.asImageWithSize(new CGSize(bitmapWidth, bitmapHeight), 1);
}
private static UIImage getResourceBitmapImpl(InputStream inputStream) {
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, 0, 0, 100);
private static UIImage getResourceBitmapImpl(InputStream inputStream, int width, int height, int percent) {
return getResourceBitmap(inputStream, CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI, DEFAULT_SIZE, width, height, percent);
}
public IosSvgBitmap(InputStream inputStream) throws IOException {
super(getResourceBitmapImpl(inputStream));
public IosSvgBitmap(InputStream inputStream, int width, int height, int percent) throws IOException {
super(getResourceBitmapImpl(inputStream, width, height, percent));
}
}