1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include <QPainter>
#include <QPixmap>
#include <QColor>
#include <QApplication>
#include <QLabel>
int main(int argc,char ** argv)
{ QApplication app(argc,argv) ;
int pct1 = 0 ;
int pct2 = 0 ;
QPixmap pixels(400,400) ;
pixels.fill(QColor::QColor(0,0,0)) ;
QPainter crayon(&pixels) ;
for(pct1 = 0 ; pct1 < 360 ; pct1++)
{ crayon.setPen(QColor::QColor(0,0,pct2)) ;
crayon.drawPie(20,20,360,360,(16*pct1),16) ;
if (pct1 < 180)
{ pct2++ ; }
else
{ pct2-- ; }
}
QLabel label ;
label.setFixedSize(410,410) ;
label.setPixmap(pixels) ;
label.setMargin(5) ;
label.show() ;
app.exec() ;
return 0 ;
} |
Partager