|
|
@ -284,14 +284,20 @@ class ImageHelper {
|
|
|
|
SVG.setInternalEntitiesEnabled(false);
|
|
|
|
SVG.setInternalEntitiesEnabled(false);
|
|
|
|
|
|
|
|
|
|
|
|
SVG svg = SVG.getFromInputStream(is);
|
|
|
|
SVG svg = SVG.getFromInputStream(is);
|
|
|
|
float w = svg.getDocumentWidth();
|
|
|
|
float dw = svg.getDocumentWidth();
|
|
|
|
float h = svg.getDocumentHeight();
|
|
|
|
float dh = svg.getDocumentHeight();
|
|
|
|
if (w < 0 || h < 0) {
|
|
|
|
if (dw <= 0 || dh <= 0) {
|
|
|
|
w = scaleToPixels;
|
|
|
|
dw = scaleToPixels;
|
|
|
|
h = scaleToPixels;
|
|
|
|
dh = scaleToPixels;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Bitmap bm = Bitmap.createBitmap((int) w, (int) h, Bitmap.Config.ARGB_8888);
|
|
|
|
int w = Math.round(scaleToPixels);
|
|
|
|
|
|
|
|
int h = Math.round(scaleToPixels * dh / dw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
svg.setDocumentWidth("100%");
|
|
|
|
|
|
|
|
svg.setDocumentHeight("100%");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
|
|
|
|
bm.eraseColor(fillColor);
|
|
|
|
bm.eraseColor(fillColor);
|
|
|
|
Canvas canvas = new Canvas(bm);
|
|
|
|
Canvas canvas = new Canvas(bm);
|
|
|
|
svg.renderToCanvas(canvas);
|
|
|
|
svg.renderToCanvas(canvas);
|
|
|
|