ImageViewコンポーネントに表示される画像にさまざまな描画レイヤーを配置する方法を教えてください。基本的に、描画アプリケーションに元に戻す機能とやり直し機能を実装したいと考えています。
現在、画像の上にテキストや描画を配置できますが、元に戻す/やり直し機能を実現できません。これは、いくつかのレイヤーを維持することで可能になるのではないかと思います。
助けてください。
これは私の現在の描画コードです..
try {
image.buildDrawingCache();
Bitmap bitmap = image.getDrawingCache();
try
{
bitmap = getResizedBitmap(bitmap, image.getHeight(),
image.getWidth());
} catch (OutOfMemoryError e) {
Toast.makeText(getApplicationContext(), e.getMessage(), 1)
.show();
}
TextPaint tp = new TextPaint();
tp.setColor(Color.GREEN);
tp.setAntiAlias(true);
tp.setTextSize(30);
Canvas canvas = new Canvas(bitmap);
canvas.drawText(input.getText().toString(), xPos, yPos, tp);
image.setImageBitmap(bitmap);
input.setText("");
input.setVisibility(View.INVISIBLE);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), e.getMessage(), 1).show();
}
前もって感謝します...!!!