omeshwar / svg-android-2

Automatically exported from code.google.com/p/svg-android-2
Apache License 2.0
0 stars 0 forks source link

Load the SVG on the size wanted #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1.Load a SVG dont have the option for resize 

What is the expected output? What do you see instead?
Sizes of  Pictures what you like

What version of the product are you using? On what operating system?
The last version 

Please provide any additional information below.
I provide you the function who i make it for do this;
this function must be in SVG.class
and when you like load make this steps;

svg = SVGParser.getSVGFromResource(getResources(), R.raw.bolsa);
Picture=svg.resizePicture(height);//I only send one parameter for mantaining 
the scale

---
FUNCTION ON SVG.class

---
public Picture resizePicture(int height){
        int width=(int) ((height*limits.right)/limits.bottom);
        Picture newPicture = new Picture();
        Canvas canvas;
        Bitmap bitmap=Bitmap.createBitmap((int)limits.right,(int) limits.bottom, Bitmap.Config.ARGB_4444);
        canvas = new Canvas(bitmap);
        canvas.drawPicture(picture);
        bitmap=Bitmap.createScaledBitmap(bitmap, width, height, true);
        canvas=newPicture.beginRecording(width, height);
        canvas.drawBitmap(bitmap, 0,0, null);
        newPicture.endRecording();
        bitmap=null;
        limits.right=width;
        limits.bottom=height;
        return newPicture;
    }

Original issue reported on code.google.com by turboch...@gmail.com on 25 Apr 2012 at 2:23

GoogleCodeExporter commented 8 years ago
This method scales a bitmap created from the SVG, which results in a 
significant reduction in quality of the scaled image. 

What this needs is a method for scaling the SVG coordinates prior to drawing 
the Picture or PictureDrawable.

Original comment by daffydle...@gmail.com on 4 Jan 2013 at 11:05

GoogleCodeExporter commented 8 years ago
How do I may use your code in the present version of the android svg 2?Could 
you give me any example?

Original comment by anibal.b...@gmail.com on 30 Jul 2013 at 3:19

GoogleCodeExporter commented 8 years ago

Original comment by suh...@google.com on 7 Nov 2013 at 3:54