2011-04-18 168 views
0

有關如何像Android的PorterDuff模式一樣擦除一部分位圖的想法? 我正在創建一個像Paint這樣的應用程序,而且我不知道如何擦除使用筆寫入的繪圖。如何擦除Qt中的一部分位圖?

關於這個的任何想法? 謝謝!

回答

1

我建議你使用QPainter類,它可以在QBitmap上執行各種繪圖操作(更精確地說:它利用QPaintDeviceQBitmap從中導出)。

在畫家的各種操作,有QPainter::eraseRect()能夠擦除一個QBitmap的一部分。

這是你使用它的方式:

QBitmap b; 
QPainter p(&b); 
p.eraseRect(x, y, w, h); // With x, y, w and h defining the portion 
          // of your bitmap you want to erase