SVG resources scaling, closes #214
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user