lazy-ninja / svg-android

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

Load the SVG on the size wanted #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 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:20

GoogleCodeExporter commented 9 years ago
Hello. Don't you loose quality resizing a picture? I'm new at this, but I think 
that when you change your vector image to a normal image you lose the ability 
of resizing without loosing quality. Thanks in advance! Daniel

Original comment by cdroch...@gmail.com on 26 Jul 2013 at 2:18