mardi 4 août 2015

How to save android canvas as svg?

Is there any possible way to save the android canvas as svg. I know how to save it as png/jpeg. Im currently saving it as jpeg. Here is the code that I use now for saving.

            canvas.setDrawingCacheEnabled(true);
            canvas.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
            Bitmap bitmap = canvas.getDrawingCache();
            String path = Environment.getExternalStorageDirectory().getAbsolutePath();
            File file = new File(path+"/image.jpg");
            FileOutputStream ostream;
            try {
                file.createNewFile();
                ostream = new FileOutputStream(file);
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, ostream);
                ostream.flush();
                ostream.close();
                Toast.makeText(getApplicationContext(), "image saved", Toast.LENGTH_SHORT).show();
            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_SHORT).show();
            }

I want this to be saved as svg?

Aucun commentaire:

Enregistrer un commentaire