diff options
author | Timothy Pearson <[email protected]> | 2012-09-17 11:49:39 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-09-17 11:49:39 -0500 |
commit | b6cb4612ca9c615323c0540a3b05edc24feec642 (patch) | |
tree | 7c14ed41a50285e015d351a8b2029aba9d6e7f4b /tests | |
parent | 52cddfb3039519e7745e770b5198ff43cb9d195f (diff) | |
download | gtk3-tqt-engine-b6cb4612ca9c615323c0540a3b05edc24feec642.tar.gz gtk3-tqt-engine-b6cb4612ca9c615323c0540a3b05edc24feec642.zip |
Add transformation support
Diffstat (limited to 'tests')
-rw-r--r-- | tests/open.png | bin | 0 -> 20782 bytes | |||
-rw-r--r-- | tests/test-painter.cpp | 34 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/open.png b/tests/open.png Binary files differnew file mode 100644 index 0000000..79beaf8 --- /dev/null +++ b/tests/open.png 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(); } |