有没有可能将Android画布保存为SVG格式的文件?我知道如何将其保存为PNG/JPEG格式,目前我正在使用JPEG格式进行保存。以下是我目前用于保存的代码:
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();
}
我希望将画布保存为svg格式?