void drawColorWheel( QPainter *p ) { QFont f( "times", 18, QFont::Bold ); p->setFont( f ); p->setPen( Qt::black ); p->setWindow( 0, 0, 500, 500 ); // defines coordinate system for ( int i=0; i<36; i++ ) { // draws 36 rotated rectangles QWMatrix matrix; matrix.translate( 250.0F, 250.0F ); // move to center matrix.shear( 0.0F, 0.3F ); // twist it matrix.rotate( (float)i*10 ); // rotate 0,10,20,.. degrees p->setWorldMatrix( matrix ); // use this world matrix QColor c; c.setHsv( i*10, 255, 255 ); // rainbow effect p->setBrush( c ); // solid fill with color c p->drawRect( 70, -10, 80, 10 ); // draw the rectangle QString n; n.sprintf( "H=%d", i*10 ); p->drawText( 80+70+5, 0, n ); // draw the hue number } }
void KoChild::updateMatrix() { QWMatrix r; r.rotate( - d->m_rotation ); QPoint p = r.map( QPoint( d->m_rotationPoint.x(), d->m_rotationPoint.y() ) ); QWMatrix m; m.rotate( d->m_rotation ); m.translate( -d->m_rotationPoint.x() + d->m_geometry.x(), -d->m_rotationPoint.y() + d->m_geometry.y() ); m.translate( p.x(), p.y() ); m.shear( d->m_shearX, d->m_shearY ); d->m_matrix = m; }