From b6cb4612ca9c615323c0540a3b05edc24feec642 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 17 Sep 2012 11:49:39 -0500 Subject: [PATCH] Add transformation support --- tdegtk/tqtcairopainter.cpp | 126 ++++++++++++++++++++++++++++++------- tdegtk/tqtcairopainter.h | 6 ++ tests/open.png | Bin 0 -> 20782 bytes tests/test-painter.cpp | 34 ++++++++++ 4 files changed, 144 insertions(+), 22 deletions(-) create mode 100644 tests/open.png diff --git a/tdegtk/tqtcairopainter.cpp b/tdegtk/tqtcairopainter.cpp index 05e9a0a..2f16d11 100644 --- a/tdegtk/tqtcairopainter.cpp +++ b/tdegtk/tqtcairopainter.cpp @@ -680,6 +680,23 @@ void TQt3CairoPaintDevice::drawText(TQPainter *p, int x, int y, const TQString & g_object_unref(layout); } +void TQt3CairoPaintDevice::setCairoTransformations() { + cairo_matrix_t combinedMatrix; + cairo_matrix_t tempMatrix; + + cairo_matrix_init_identity(&combinedMatrix); + if (m_worldMatrixEnabled) { + cairo_matrix_multiply(&tempMatrix, &combinedMatrix, &m_worldMatrix); + combinedMatrix = tempMatrix; + } + if (m_viewportMatrixEnabled) { + cairo_matrix_multiply(&tempMatrix, &combinedMatrix, &m_viewportMatrix); + combinedMatrix = tempMatrix; + } + + cairo_set_matrix(m_painter, &combinedMatrix); +} + /*! \class TQt3CairoPaintDevice tdeqt4painter.h \brief The TQt3CairoPaintDevice class is a paint device that translates @@ -927,13 +944,20 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) cairo_restore(m_painter); } break; -#if 0 case PdcDrawText: - // NOTE - // drawText baseline = FALSE for this! - m_qt4painter->drawText( qt4point1, qt4string ); + if (m_painter) { + cairo_save(m_painter); + if (p) { + TQString string = *p[1].str; + drawText(pt, p[0].rect->x()+CAIRO_PIXEL_OFFSET, p[0].rect->y()+CAIRO_PIXEL_OFFSET, string, 0, -1, TQPainter::Auto, TRUE); + } + cairo_restore(m_painter); + } break; +#if 0 case PdcDrawTextFormatted: + // NOTE + // Unlike PdcDrawText and PdcDrawText2, PdcDrawTextFormatted and PdcDrawText2Formatted do NOT use the baseline as the Y position coordinate! m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string ); break; #endif @@ -944,14 +968,27 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) TQString string = *p[1].str; drawText(pt, p[0].rect->x()+CAIRO_PIXEL_OFFSET, p[0].rect->y()+CAIRO_PIXEL_OFFSET, string, 0, -1, TQPainter::Auto, TRUE); } + cairo_restore(m_painter); } break; #if 0 case PdcDrawText2Formatted: m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string ); break; +#endif case PdcDrawPixmap: - m_qt4painter->drawPixmap( qt4rect, qt4pixmap ); + if (m_painter) { + cairo_save(m_painter); + if (p) { + TQImage sourceImage = p[1].pixmap->convertToImage(); + cairo_surface_t* sourceSurface = TQImageToCairoSurface(sourceImage); + cairo_rectangle(m_painter, p[0].rect->x(), p[0].rect->y(), p[0].rect->width(), p[0].rect->height()); + cairo_set_source_surface(m_painter, sourceSurface, p[0].rect->x(), p[0].rect->y()); + cairo_fill(m_painter); + cairo_surface_destroy(sourceSurface); + } + cairo_restore(m_painter); + } break; #if 0 case PdcDrawImage: { @@ -965,7 +1002,6 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) } } break; -#endif #endif case PdcBegin: if (!m_painter) { @@ -975,6 +1011,11 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) m_pen = TQPen(); m_brush = TQBrush(); m_brushOrigin = TQPoint(0,0); + m_worldMatrixEnabled = false; + m_viewportMatrixEnabled = false; + cairo_matrix_init_identity(&m_worldMatrix); + cairo_matrix_init_identity(&m_viewportMatrix); + setCairoTransformations(); } break; case PdcEnd: @@ -1097,7 +1138,6 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) } } break; -#if 0 #if 0 case PdcSetTabStops: s >> i_16; @@ -1118,32 +1158,74 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p ) delete [] ta; } break; - case PdcSetVXform: - s >> i_8; -#ifndef QT_NO_TRANSFORMATIONS - painter->setViewXForm( i_8 ); #endif + case PdcSetVXform: + if ((p) && (m_painter)) { + m_viewportMatrixEnabled = p[0].ival; + setCairoTransformations(); + } break; case PdcSetWindow: - s >> r; -#ifndef QT_NO_TRANSFORMATIONS - painter->setWindow( r ); -#endif + if ((p) && (m_painter) && (pt)) { + TQRect viewportRect = pt->viewport(); + int wx = p[0].rect->x(); + int wy = p[0].rect->y(); + int ww = p[0].rect->width(); + int wh = p[0].rect->height(); + int vx = viewportRect.x(); + int vy = viewportRect.y(); + int vw = viewportRect.width(); + int vh = viewportRect.height(); + double scaleW = (double)vw/(double)ww; + double scaleH = (double)vh/(double)wh; + cairo_matrix_init(&m_viewportMatrix, scaleW, 0, 0, scaleH, vx - wx*scaleW, vy - wy*scaleH); + setCairoTransformations(); + } break; case PdcSetViewport: - s >> r; -#ifndef QT_NO_TRANSFORMATIONS - painter->setViewport( r ); -#endif + if ((p) && (m_painter) && (pt)) { + TQRect windowRect = pt->window(); + int wx = windowRect.x(); + int wy = windowRect.y(); + int ww = windowRect.width(); + int wh = windowRect.height(); + int vx = p[0].rect->x(); + int vy = p[0].rect->y(); + int vw = p[0].rect->width(); + int vh = p[0].rect->height(); + double scaleW = (double)vw/(double)ww; + double scaleH = (double)vh/(double)wh; + cairo_matrix_init(&m_viewportMatrix, scaleW, 0, 0, scaleH, vx - wx*scaleW, vy - wy*scaleH); + setCairoTransformations(); + } break; -#endif case PdcSetWXform: - m_qt4painter->setWorldMatrixEnabled( p[0].ival ); + if ((p) && (m_painter)) { + m_worldMatrixEnabled = p[0].ival; + setCairoTransformations(); + } break; case PdcSetWMatrix: - m_qt4painter->setWorldMatrix( qt4matrix, p[1].ival ); + if ((p) && (m_painter)) { + const TQWMatrix* tqt3matrix = p[0].matrix; + if (tqt3matrix) { + if (p[1].ival) { + // Combine + cairo_matrix_t new_matrix; + cairo_matrix_t original_matrix = m_worldMatrix; + cairo_matrix_init(&new_matrix, tqt3matrix->m11(), tqt3matrix->m12(), tqt3matrix->m21(), tqt3matrix->m22(), tqt3matrix->dx(), tqt3matrix->dy()); + cairo_matrix_multiply(&m_worldMatrix, &original_matrix, &new_matrix); + } + else { + // Replace + cairo_matrix_init(&m_worldMatrix, tqt3matrix->m11(), tqt3matrix->m12(), tqt3matrix->m21(), tqt3matrix->m22(), tqt3matrix->dx(), tqt3matrix->dy()); + } + setCairoTransformations(); + } + } break; #if 0 +#if 0 #ifndef QT_NO_TRANSFORMATIONS case PdcSaveWMatrix: painter->saveWorldMatrix(); diff --git a/tdegtk/tqtcairopainter.h b/tdegtk/tqtcairopainter.h index 99a3dc2..9700b63 100644 --- a/tdegtk/tqtcairopainter.h +++ b/tdegtk/tqtcairopainter.h @@ -59,10 +59,16 @@ class Q_EXPORT TQt3CairoPaintDevice : public TQPaintDevice // picture class void pangoSetupTextPath(PangoLayout *layout, const char* text); void drawText(TQPainter *p, int x, int y, const TQString &str, int pos, int len, TQPainter::TextDirection dir, bool baseline=TRUE); + + void setCairoTransformations(); private: cairo_surface_t *m_surface; cairo_t *m_painter; + cairo_matrix_t m_worldMatrix; + cairo_matrix_t m_viewportMatrix; + bool m_worldMatrixEnabled; + bool m_viewportMatrixEnabled; TQColor m_bgColor; TQt::BGMode m_bgColorMode; diff --git a/tests/open.png b/tests/open.png new file mode 100644 index 0000000000000000000000000000000000000000..79beaf89d467f1f180144b1578c77c70e8c7314a GIT binary patch literal 20782 zcmV)gK%~EkP)DRR35_8@hMMOwHJxFf{eACR>;AFU`|W+IDsf0vh_^YoOcQ~T`mz3W}W zZ~fM90pI%g*2lL#{`dW$C(9do&G-D^6|a27i{89$?W!v_U47*r_U}J<YEW_JHW5AV2p&z^%{-?R6?p>5mu+`V`I!N2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8>avO literal 0 HcmV?d00001 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 +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(); }