summaryrefslogtreecommitdiffstats
path: root/tests/test-painter.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-15 23:02:11 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-15 23:02:11 -0500
commitc2a1262df888a6c2913c608614f00dbb41233321 (patch)
treed3a4a39f5702fa403f0134a98322e2bb3b9316b7 /tests/test-painter.cpp
parent827cba3a39a4afe688bfa848fc7dd7c5899b506f (diff)
downloadgtk3-tqt-engine-c2a1262df888a6c2913c608614f00dbb41233321.tar.gz
gtk3-tqt-engine-c2a1262df888a6c2913c608614f00dbb41233321.zip
Rectangle drawing via Cairo now functions
Diffstat (limited to 'tests/test-painter.cpp')
-rw-r--r--tests/test-painter.cpp50
1 files changed, 41 insertions, 9 deletions
diff --git a/tests/test-painter.cpp b/tests/test-painter.cpp
index c8bb77b..0cdaac1 100644
--- a/tests/test-painter.cpp
+++ b/tests/test-painter.cpp
@@ -1,5 +1,10 @@
#include <cairo.h>
+#include <tqpainter.h>
+#include <tqapplication.h>
+
+#include "tqtcairopainter.h"
+
int
main (int argc, char *argv[])
{
@@ -7,19 +12,46 @@ main (int argc, char *argv[])
cairo_t *cr;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
- cr = cairo_create (surface);
- /* Examples are in 1.0 x 1.0 coordinate space */
- cairo_scale (cr, 120, 120);
+// cr = cairo_create (surface);
+
+// /* Examples are in 1.0 x 1.0 coordinate space */
+// cairo_scale (cr, 120, 120);
+//
+// /* Drawing code goes here */
+// cairo_set_line_width (cr, 0.1);
+// cairo_set_source_rgb (cr, 0, 0, 0);
+// cairo_rectangle (cr, 0.25, 0.25, 0.5, 0.5);
+// cairo_stroke (cr);
+
+ // Initialize TQApplication required data structures
+ new TQApplication(argc, argv, TRUE);
+
+ 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
- /* Drawing code goes here */
- cairo_set_line_width (cr, 0.1);
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0.25, 0.25, 0.5, 0.5);
- cairo_stroke (cr);
+ p.end();
/* Write output and clean up */
cairo_surface_write_to_png (surface, "stroke.png");
- cairo_destroy (cr);
+// cairo_destroy (cr);
cairo_surface_destroy (surface);
return 0;