diff options
author | Timothy Pearson <[email protected]> | 2012-09-16 02:41:13 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-09-16 02:41:13 -0500 |
commit | 2e57d2cf81ee9f642a59bd20712f80fa9b13ee08 (patch) | |
tree | 5c134ea62aa912bcf5833e88bd1daaef154c1471 /tests | |
parent | c2a1262df888a6c2913c608614f00dbb41233321 (diff) | |
download | gtk3-tqt-engine-2e57d2cf81ee9f642a59bd20712f80fa9b13ee08.tar.gz gtk3-tqt-engine-2e57d2cf81ee9f642a59bd20712f80fa9b13ee08.zip |
Activate lines and polylines
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-painter.cpp | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/tests/test-painter.cpp b/tests/test-painter.cpp index 0cdaac1..8a2b02e 100644 --- a/tests/test-painter.cpp +++ b/tests/test-painter.cpp @@ -11,7 +11,7 @@ main (int argc, char *argv[]) cairo_surface_t *surface; cairo_t *cr; - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 500, 500); // cr = cairo_create (surface); // /* Examples are in 1.0 x 1.0 coordinate space */ @@ -28,24 +28,50 @@ main (int argc, char *argv[]) TQt3CairoPaintDevice pd(surface); TQPainter p(&pd); - p.setPen(TQPen(TQt::red, 1)); - p.drawRect(5, 5, 50, 50); - - TQBrush brush( TQt::yellow, TQBrush::DiagCrossPattern ); // yellow pattern - p.setBrush( brush ); // set the yellow brush - p.setPen( TQt::NoPen ); // do not draw outline - p.drawRect( 0,0, 25,25 ); // draw filled rectangle - TQBrush brush2( TQt::green, TQBrush::SolidPattern ); // green pattern - p.setBrush( brush2 ); // set the yellow brush - p.setPen( TQt::NoPen ); // do not draw outline - p.drawRect( 40,30, 200,100 ); // draw filled rectangle - p.setBrush( TQt::NoBrush ); // do not fill - p.setPen( TQt::blue ); // set blue pen, 0 pixel width - p.drawRect( 10,10, 30,20 ); // draw rectangle outline - TQBrush brush3( TQColor(255,128,0), TQBrush::SolidPattern ); // green pattern - p.setBrush( brush3 ); // set the yellow brush - p.setPen( TQColor(255,0,255) ); // draw outline - p.drawRect( 50,50, 180,80 ); // draw filled rectangle + + // Rectangle tests + { + p.setPen(TQPen(TQt::red, 1)); + p.drawRect(5, 5, 50, 50); + TQBrush brush( TQt::yellow, TQBrush::DiagCrossPattern ); // yellow pattern + p.setBrush( brush ); // set the yellow brush + p.setPen( TQt::NoPen ); // do not draw outline + p.drawRect( 0,0, 25,25 ); // draw filled rectangle + TQBrush brush2( TQt::green, TQBrush::SolidPattern ); // green pattern + p.setBrush( brush2 ); // set the yellow brush + p.setPen( TQt::NoPen ); // do not draw outline + p.drawRect( 40,30, 200,100 ); // draw filled rectangle + p.setBrush( TQt::NoBrush ); // do not fill + p.setPen( TQt::blue ); // set blue pen, 0 pixel width + p.drawRect( 10,10, 30,20 ); // draw rectangle outline + TQBrush brush3( TQColor(255,128,0), TQBrush::SolidPattern ); // green pattern + p.setBrush( brush3 ); // set the yellow brush + p.setPen( TQColor(255,0,255) ); // draw outline + p.drawRect( 50,40, 180,80 ); // draw filled rectangle + } + + // Line tests + { + p.setPen( TQt::blue ); // set blue pen, 0 pixel width + p.drawLine(140,140, 160,160); + } + + // Point tests + { + p.setPen( TQt::green ); // set green pen, 0 pixel width + p.drawPoint(135,135); + } + + // Polyline tests + { + TQPointArray a; + int x1 = 200; + int y1 = 10; + + a.setPoints( 11, x1+0, y1+85, x1+75, y1+75, x1+100, y1+10, x1+125, y1+75, x1+200, y1+85, x1+150, y1+125, x1+160, y1+190, x1+100, y1+150, x1+40, y1+190, x1+50, y1+125, x1+0, y1+85 ); + p.setPen(TQt::red); + p.drawPolyline(a); + } p.end(); |