|
|
@ -680,6 +680,23 @@ void TQt3CairoPaintDevice::drawText(TQPainter *p, int x, int y, const TQString &
|
|
|
|
g_object_unref(layout);
|
|
|
|
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
|
|
|
|
\class TQt3CairoPaintDevice tdeqt4painter.h
|
|
|
|
\brief The TQt3CairoPaintDevice class is a paint device that translates
|
|
|
|
\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);
|
|
|
|
cairo_restore(m_painter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
case PdcDrawText:
|
|
|
|
case PdcDrawText:
|
|
|
|
// NOTE
|
|
|
|
if (m_painter) {
|
|
|
|
// drawText baseline = FALSE for this!
|
|
|
|
cairo_save(m_painter);
|
|
|
|
m_qt4painter->drawText( qt4point1, qt4string );
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
case PdcDrawTextFormatted:
|
|
|
|
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 );
|
|
|
|
m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -944,14 +968,27 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
TQString string = *p[1].str;
|
|
|
|
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);
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
case PdcDrawText2Formatted:
|
|
|
|
case PdcDrawText2Formatted:
|
|
|
|
m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string );
|
|
|
|
m_qt4painter->drawText( qt4rect, qt4formattedtextflags, qt4string );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
case PdcDrawPixmap:
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
case PdcDrawImage: {
|
|
|
|
case PdcDrawImage: {
|
|
|
@ -965,7 +1002,6 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
case PdcBegin:
|
|
|
|
case PdcBegin:
|
|
|
|
if (!m_painter) {
|
|
|
|
if (!m_painter) {
|
|
|
@ -975,6 +1011,11 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
m_pen = TQPen();
|
|
|
|
m_pen = TQPen();
|
|
|
|
m_brush = TQBrush();
|
|
|
|
m_brush = TQBrush();
|
|
|
|
m_brushOrigin = TQPoint(0,0);
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
case PdcEnd:
|
|
|
|
case PdcEnd:
|
|
|
@ -1097,7 +1138,6 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
case PdcSetTabStops:
|
|
|
|
case PdcSetTabStops:
|
|
|
|
s >> i_16;
|
|
|
|
s >> i_16;
|
|
|
@ -1118,32 +1158,74 @@ bool TQt3CairoPaintDevice::cmd( int c, TQPainter *pt, TQPDevCmdParam *p )
|
|
|
|
delete [] ta;
|
|
|
|
delete [] ta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case PdcSetVXform:
|
|
|
|
|
|
|
|
s >> i_8;
|
|
|
|
|
|
|
|
#ifndef QT_NO_TRANSFORMATIONS
|
|
|
|
|
|
|
|
painter->setViewXForm( i_8 );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case PdcSetVXform:
|
|
|
|
|
|
|
|
if ((p) && (m_painter)) {
|
|
|
|
|
|
|
|
m_viewportMatrixEnabled = p[0].ival;
|
|
|
|
|
|
|
|
setCairoTransformations();
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case PdcSetWindow:
|
|
|
|
case PdcSetWindow:
|
|
|
|
s >> r;
|
|
|
|
if ((p) && (m_painter) && (pt)) {
|
|
|
|
#ifndef QT_NO_TRANSFORMATIONS
|
|
|
|
TQRect viewportRect = pt->viewport();
|
|
|
|
painter->setWindow( r );
|
|
|
|
int wx = p[0].rect->x();
|
|
|
|
#endif
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
case PdcSetViewport:
|
|
|
|
case PdcSetViewport:
|
|
|
|
s >> r;
|
|
|
|
if ((p) && (m_painter) && (pt)) {
|
|
|
|
#ifndef QT_NO_TRANSFORMATIONS
|
|
|
|
TQRect windowRect = pt->window();
|
|
|
|
painter->setViewport( r );
|
|
|
|
int wx = windowRect.x();
|
|
|
|
#endif
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case PdcSetWXform:
|
|
|
|
case PdcSetWXform:
|
|
|
|
m_qt4painter->setWorldMatrixEnabled( p[0].ival );
|
|
|
|
if ((p) && (m_painter)) {
|
|
|
|
|
|
|
|
m_worldMatrixEnabled = p[0].ival;
|
|
|
|
|
|
|
|
setCairoTransformations();
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case PdcSetWMatrix:
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#ifndef QT_NO_TRANSFORMATIONS
|
|
|
|
#ifndef QT_NO_TRANSFORMATIONS
|
|
|
|
case PdcSaveWMatrix:
|
|
|
|
case PdcSaveWMatrix:
|
|
|
|
painter->saveWorldMatrix();
|
|
|
|
painter->saveWorldMatrix();
|
|
|
|