在我的Android繪畫應用程序中,我將在畫布上繪畫。 但有些時候我有圖像之前,油漆。那時我的油漆變慢了。哪裏有問題 ??爲什麼圖像上的顏色變慢?
,只有在畫布上作畫的代碼:
@Override
protected void onDraw(Canvas canvas) {
//canvas.drawColor(0, PorterDuff.Mode.CLEAR);
// set the Canvas Color
canvas.drawColor(canvasColor); // edited
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
canvas.drawPath(mPath, mPaint);
}
這讓作爲背景圖像的代碼是:
@Override
protected void onDraw(Canvas canvas) {
//canvas.drawColor(0, PorterDuff.Mode.CLEAR);
// set the Canvas Color
canvas.drawColor(canvasColor); // edited
if(!(imagePath==null))
{
Bitmap tempBitmap = BitmapFactory.decodeFile(imagePath); // from the gallery
photoBitmap = Bitmap.createScaledBitmap(tempBitmap, display.getWidth(), display.getHeight(), true);
}
if(!(imagePath==null))
{
canvas.drawBitmap (photoBitmap,0, 0, null);
}
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
canvas.drawPath(mPath, mPaint);
}
現在,我不知道爲什麼我的油漆慢變,而我的油漆在畫布上,如果有圖像作爲背景。 請幫我。 謝謝。
你也可以使用ImageLoader快速獲取圖像...試試吧... –
@HardikGajjar:謝謝Hardik。 :-) –
@HardikGajjar:我的問題是關於不加載圖像,但我的塗料變得緩慢,而有一個圖像作爲背景。 –