我想挽救AndroidPlot一个PNG图片 [英] I want to save a .png image from AndroidPlot
本文介绍了我想挽救AndroidPlot一个PNG图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经写了code这绘制的线图。
此图是采用Android绘制曲线..
我该如何拯救这个图作为PNG图片??
解决方案
xyPlot.setDrawingCacheEnabled(真);
INT宽度= xyPlot.getWidth();
INT高度= xyPlot.getHeight();
xyPlot.measure(宽度,高度);
BMP位图= Bitmap.createBitmap(xyPlot.getDrawingCache());
xyPlot.setDrawingCacheEnabled(假);
FOS的FileOutputStream =新的FileOutputStream(fullFileName,真);
bmp.com preSS(比较pressFormat.JPEG,100,FOS);
I have written a code which plots a Line Graph. This graph is plotted by using Android Plot.. How can i save this graph as .png image??
解决方案
xyPlot.setDrawingCacheEnabled(true);
int width = xyPlot.getWidth();
int height = xyPlot.getHeight();
xyPlot.measure(width, height);
Bitmap bmp = Bitmap.createBitmap(xyPlot.getDrawingCache());
xyPlot.setDrawingCacheEnabled(false);
FileOutputStream fos = new FileOutputStream(fullFileName, true);
bmp.compress(CompressFormat.JPEG, 100, fos);
这篇关于我想挽救AndroidPlot一个PNG图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文