我已经编写了在图像上绘制文本的代码,它工作正常我在 potrait 模式下捕获图像,但是当我在横向模式下捕获图像时应用程序崩溃,我收到异常 Java.lang.IllegalStateException: Immutable bitmap pass to Canvas构造函数
Canvas canvas = new Canvas(photo);
Typeface tf = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Style.FILL);
paint.setTypeface(tf);
paint.setColor(Color.WHITE);
paint.setStrokeWidth(12);
canvas.drawBitmap(photo, 0, 0, paint);
canvas.drawText(topaste, 10, 115, paint);
image.setImageBitmap(photo);