diff options
Diffstat (limited to 'tests/test-painter.cpp')
-rw-r--r-- | tests/test-painter.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test-painter.cpp b/tests/test-painter.cpp index 0fb811c..6979af4 100644 --- a/tests/test-painter.cpp +++ b/tests/test-painter.cpp @@ -8,6 +8,31 @@ // TQt3 test image only #include <tqpixmap.h> +void drawColorWheel(TQPainter *p, double scale) +{ + TQFont f( "times", 18, TQFont::Bold ); + p->setFont( f ); + p->setPen(TQt::black); + p->setWindow( 0, 0, 500*scale, 500*scale ); // defines coordinate system + + for ( int i=0; i<36; i++ ) { // draws 36 rotated rectangles + TQWMatrix matrix; + matrix.translate( 250.0F*scale, 250.0F*scale ); // move to center + matrix.shear( 0.0F*scale, 0.3F*scale ); // twist it + matrix.rotate( (float)i*10 ); // rotate 0,10,20,.. degrees + p->setWorldMatrix( matrix ); // use this world matrix + + TQColor c; + c.setHsv( i*10, 255, 255 ); // rainbow effect + p->setBrush( c ); // solid fill with color c + p->drawRect( 70*scale, -10*scale, 80*scale, 10*scale ); // draw the rectangle + + TQString n; + n.sprintf( "H=%d", i*10 ); + p->drawText( (80+70+5)*scale, 0, n ); // draw the hue number + } +} + void runTests(TQPaintDevice* pd) { TQPainter p(pd); @@ -136,6 +161,12 @@ void runTests(TQPaintDevice* pd) { p.drawCubicBezier(a); } + // Pixmap tests + { + TQPixmap pixmap("open.png"); + p.drawPixmap(200, 10, pixmap, 0, 0, -1, -1); + } + // Font tests { static const char *fonts[] = { "Helvetica", "Courier", "Times", 0 }; @@ -163,6 +194,9 @@ void runTests(TQPaintDevice* pd) { } } + //drawColorWheel(&p, 0.5); + //drawColorWheel(&p, 1.0); + p.end(); } |