Add missing TQPainter::tqdrawPolyline(...) method

pull/1/head
Timothy Pearson 13 years ago
parent 12897770f4
commit 88b0885ab8

@ -302,6 +302,7 @@ public:
inline void tqdrawPolyline(const QPolygon &pa, int index, int npoints = -1) { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
inline void tqdrawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1) { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); }
inline void tqdrawPolygon(const QPolygonF &polygon, bool winding, int index = 0, int npoints = -1) { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); }
void tqdrawPolyline( const TQPointArray &, int index=0, int npoints=-1 );
inline void tqdrawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1) { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
inline void tqdrawConvexPolygon(const QPolygon &pa, int index, int npoints = -1) { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
// static inline void redirect(QPaintDevice *pdev, QPaintDevice *replacement) { setRedirected(pdev, replacement); }

@ -248,6 +248,68 @@ void TQPainter::drawWinFocusRect( int x, int y, int w, int h, bool xorPaint, con
setPen( old_pen );
}
/*!
Draws the polyline defined by the \a npoints points in \a a
starting at \a a[index]. (\a index defaults to 0.)
If \a npoints is -1 (the default) all points until the end of the
array are used (i.e. a.size()-index-1 line segments are drawn).
\warning On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
TQt 4.
\sa drawLineSegments(), drawPolygon(), TQPen
*/
void TQPainter::tqdrawPolyline( const TQPointArray &a, int index, int npoints )
{
if ( npoints < 0 )
npoints = a.size() - index;
if ( index + npoints > (int)a.size() )
npoints = a.size() - index;
if ( !isActive() || npoints < 2 || index < 0 )
return;
TQPointArray pa = a;
if ( testf(ExtDev|VxF|WxF) ) {
if ( testf(ExtDev) ) {
// if ( npoints != (int)pa.size() ) {
// pa = TQPointArray( npoints );
// for ( int i=0; i<npoints; i++ )
// pa.setPoint( i, a.point(index+i) );
// index = 0;
// }
// TQPDevCmdParam param[1];
// param[0].ptarr = (TQPointArray*)&pa;
// if ( !pdev->cmd(TQPaintDevice::PdcDrawPolyline, this, param) || !hd )
// return;
printf("[FIXME] TQPainter::drawPolyline not yet supported on external paint devices\n\r");
}
#if 0
if ( txop != TxNone ) {
pa = xForm( pa, index, npoints );
if ( pa.size() != a.size() ) {
index = 0;
npoints = pa.size();
}
}
}
if ( cpen.style() != Qt::NoPen ) {
while(npoints>65535) {
XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, 65535 )),
65535, CoordModeOrigin );
npoints-=65535;
index+=65535;
}
XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, npoints )),
npoints, CoordModeOrigin );
}
#else
}
printf("[WARNING] TQPainter::tqdrawPolyline UNIMPLEMENTED\n\r");
#endif
}
#else // USE_QT4
// paintevent magic to provide Windows semantics on X11

Loading…
Cancel
Save