问题描述
这是我的问题:
我涵盖的第一点。 帮我争取剩下的两分
预先感谢
解决方法
尝试
1-将文本写入位图的代码
Bitmap bitmap = ... // your bitmap here
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
paint.setColor(Color.BLACK);
paint.setTextSize(10);
canvas.drawText("Some Text here",x,y,paint);
2-将位图保存到存储的代码
// Assume block needs to be inside a Try/Catch block.
String path = Environment.getExternalStorageDirectory().toString();
OutputStream fOut = null;
File file = new File(path,"File.jpg");
fOut = new FileOutputStream(file);
pictureBitmap.compress(Bitmap.CompressFormat.JPEG,85,fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
fOut.flush(); // Not really required
fOut.close(); // do not forget to close the stream
MediaStore.Images.Media.insertImage(getContentResolver(),file.getAbsolutePath(),file.getName(),file.getName());