qwt_plot_rasteritem.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #include "qwt_plot_rasteritem.h"
11 #include "qwt_scale_map.h"
12 #include "qwt_painter.h"
13 #include <qapplication.h>
14 #include <qdesktopwidget.h>
15 #include <qpainter.h>
16 #include <qpaintengine.h>
17 #include <qmath.h>
18 #include <qthread.h>
19 #include <qfuture.h>
20 #include <qtconcurrentrun.h>
21 #include <float.h>
22 
24 {
25 public:
27  alpha( -1 ),
29  {
31  }
32 
33  int alpha;
34 
36 
37  struct ImageCache
38  {
40  QRectF area;
41  QSizeF size;
42  QImage image;
43  } cache;
44 };
45 
46 
47 static QRectF qwtAlignRect(const QRectF &rect)
48 {
49  QRectF r;
50  r.setLeft( qRound( rect.left() ) );
51  r.setRight( qRound( rect.right() ) );
52  r.setTop( qRound( rect.top() ) );
53  r.setBottom( qRound( rect.bottom() ) );
54 
55  return r;
56 }
57 
58 static QRectF qwtStripRect(const QRectF &rect, const QRectF &area,
59  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
60  const QwtInterval &xInterval, const QwtInterval &yInterval)
61 {
62  QRectF r = rect;
63  if ( xInterval.borderFlags() & QwtInterval::ExcludeMinimum )
64  {
65  if ( area.left() <= xInterval.minValue() )
66  {
67  if ( xMap.isInverting() )
68  r.adjust(0, 0, -1, 0);
69  else
70  r.adjust(1, 0, 0, 0);
71  }
72  }
73 
74  if ( xInterval.borderFlags() & QwtInterval::ExcludeMaximum )
75  {
76  if ( area.right() >= xInterval.maxValue() )
77  {
78  if ( xMap.isInverting() )
79  r.adjust(1, 0, 0, 0);
80  else
81  r.adjust(0, 0, -1, 0);
82  }
83  }
84 
85  if ( yInterval.borderFlags() & QwtInterval::ExcludeMinimum )
86  {
87  if ( area.top() <= yInterval.minValue() )
88  {
89  if ( yMap.isInverting() )
90  r.adjust(0, 0, 0, -1);
91  else
92  r.adjust(0, 1, 0, 0);
93  }
94  }
95 
96  if ( yInterval.borderFlags() & QwtInterval::ExcludeMaximum )
97  {
98  if ( area.bottom() >= yInterval.maxValue() )
99  {
100  if ( yMap.isInverting() )
101  r.adjust(0, 1, 0, 0);
102  else
103  r.adjust(0, 0, 0, -1);
104  }
105  }
106 
107  return r;
108 }
109 
110 static QImage qwtExpandImage(const QImage &image,
111  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
112  const QRectF &area, const QRectF &area2, const QRectF &paintRect,
113  const QwtInterval &xInterval, const QwtInterval &yInterval )
114 {
115  const QRectF strippedRect = qwtStripRect(paintRect, area2,
116  xMap, yMap, xInterval, yInterval);
117  const QSize sz = strippedRect.toRect().size();
118 
119  const int w = image.width();
120  const int h = image.height();
121 
122  const QRectF r = QwtScaleMap::transform(xMap, yMap, area).normalized();
123  const double pw = ( r.width() - 1) / w;
124  const double ph = ( r.height() - 1) / h;
125 
126  double px0, py0;
127  if ( !xMap.isInverting() )
128  {
129  px0 = xMap.transform( area2.left() );
130  px0 = qRound( px0 );
131  px0 = px0 - xMap.transform( area.left() );
132  }
133  else
134  {
135  px0 = xMap.transform( area2.right() );
136  px0 = qRound( px0 );
137  px0 -= xMap.transform( area.right() );
138 
139  px0 -= 1.0;
140  }
141  px0 += strippedRect.left() - paintRect.left();
142 
143  if ( !yMap.isInverting() )
144  {
145  py0 = yMap.transform( area2.top() );
146  py0 = qRound( py0 );
147  py0 -= yMap.transform( area.top() );
148  }
149  else
150  {
151  py0 = yMap.transform( area2.bottom() );
152  py0 = qRound( py0 );
153  py0 -= yMap.transform( area.bottom() );
154 
155  py0 -= 1.0;
156  }
157  py0 += strippedRect.top() - paintRect.top();
158 
159  QImage expanded(sz, image.format());
160 
161  switch( image.depth() )
162  {
163  case 32:
164  {
165  for ( int y1 = 0; y1 < h; y1++ )
166  {
167  int yy1;
168  if ( y1 == 0 )
169  {
170  yy1 = 0;
171  }
172  else
173  {
174  yy1 = qRound( y1 * ph - py0 );
175  if ( yy1 < 0 )
176  yy1 = 0;
177  }
178 
179  int yy2;
180  if ( y1 == h - 1 )
181  {
182  yy2 = sz.height();
183  }
184  else
185  {
186  yy2 = qRound( ( y1 + 1 ) * ph - py0 );
187  if ( yy2 > sz.height() )
188  yy2 = sz.height();
189  }
190 
191  const quint32 *line1 =
192  reinterpret_cast<const quint32 *>( image.scanLine( y1 ) );
193 
194  for ( int x1 = 0; x1 < w; x1++ )
195  {
196  int xx1;
197  if ( x1 == 0 )
198  {
199  xx1 = 0;
200  }
201  else
202  {
203  xx1 = qRound( x1 * pw - px0 );
204  if ( xx1 < 0 )
205  xx1 = 0;
206  }
207 
208  int xx2;
209  if ( x1 == w - 1 )
210  {
211  xx2 = sz.width();
212  }
213  else
214  {
215  xx2 = qRound( ( x1 + 1 ) * pw - px0 );
216  if ( xx2 > sz.width() )
217  xx2 = sz.width();
218  }
219 
220  const quint32 rgb( line1[x1] );
221  for ( int y2 = yy1; y2 < yy2; y2++ )
222  {
223  quint32 *line2 = reinterpret_cast<quint32 *>(
224  expanded.scanLine( y2 ) );
225 
226  for ( int x2 = xx1; x2 < xx2; x2++ )
227  line2[x2] = rgb;
228  }
229  }
230  }
231  break;
232  }
233  case 8:
234  {
235  for ( int y1 = 0; y1 < h; y1++ )
236  {
237  int yy1;
238  if ( y1 == 0 )
239  {
240  yy1 = 0;
241  }
242  else
243  {
244  yy1 = qRound( y1 * ph - py0 );
245  if ( yy1 < 0 )
246  yy1 = 0;
247  }
248 
249  int yy2;
250  if ( y1 == h - 1 )
251  {
252  yy2 = sz.height();
253  }
254  else
255  {
256  yy2 = qRound( ( y1 + 1 ) * ph - py0 );
257  if ( yy2 > sz.height() )
258  yy2 = sz.height();
259  }
260 
261  const uchar *line1 = image.scanLine( y1 );
262 
263  for ( int x1 = 0; x1 < w; x1++ )
264  {
265  int xx1;
266  if ( x1 == 0 )
267  {
268  xx1 = 0;
269  }
270  else
271  {
272  xx1 = qRound( x1 * pw - px0 );
273  if ( xx1 < 0 )
274  xx1 = 0;
275  }
276 
277  int xx2;
278  if ( x1 == w - 1 )
279  {
280  xx2 = sz.width();
281  }
282  else
283  {
284  xx2 = qRound( ( x1 + 1 ) * pw - px0 );
285  if ( xx2 > sz.width() )
286  xx2 = sz.width();
287  }
288 
289  for ( int y2 = yy1; y2 < yy2; y2++ )
290  {
291  uchar *line2 = expanded.scanLine( y2 );
292  memset( line2 + xx1, line1[x1], xx2 - xx1 );
293  }
294  }
295  }
296  break;
297  }
298  default:
299  expanded = image;
300  }
301 
302  return expanded;
303 }
304 
305 static QRectF qwtExpandToPixels(const QRectF &rect, const QRectF &pixelRect)
306 {
307  const double pw = pixelRect.width();
308  const double ph = pixelRect.height();
309 
310  const double dx1 = pixelRect.left() - rect.left();
311  const double dx2 = pixelRect.right() - rect.right();
312  const double dy1 = pixelRect.top() - rect.top();
313  const double dy2 = pixelRect.bottom() - rect.bottom();
314 
315  QRectF r;
316  r.setLeft( pixelRect.left() - qCeil( dx1 / pw ) * pw );
317  r.setTop( pixelRect.top() - qCeil( dy1 / ph ) * ph );
318  r.setRight( pixelRect.right() - qFloor( dx2 / pw ) * pw );
319  r.setBottom( pixelRect.bottom() - qFloor( dy2 / ph ) * ph );
320 
321  return r;
322 }
323 
324 static void qwtTransformMaps( const QTransform &tr,
325  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
326  QwtScaleMap &xxMap, QwtScaleMap &yyMap )
327 {
328  const QPointF p1 = tr.map( QPointF( xMap.p1(), yMap.p1() ) );
329  const QPointF p2 = tr.map( QPointF( xMap.p2(), yMap.p2() ) );
330 
331  xxMap = xMap;
332  xxMap.setPaintInterval( p1.x(), p2.x() );
333 
334  yyMap = yMap;
335  yyMap.setPaintInterval( p1.y(), p2.y() );
336 }
337 
338 static void qwtAdjustMaps( QwtScaleMap &xMap, QwtScaleMap &yMap,
339  const QRectF &area, const QRectF &paintRect)
340 {
341  double sx1 = area.left();
342  double sx2 = area.right();
343  if ( xMap.isInverting() )
344  qSwap(sx1, sx2);
345 
346  double sy1 = area.top();
347  double sy2 = area.bottom();
348 
349  if ( yMap.isInverting() )
350  qSwap(sy1, sy2);
351 
352  xMap.setPaintInterval(paintRect.left(), paintRect.right());
353  xMap.setScaleInterval(sx1, sx2);
354 
355  yMap.setPaintInterval(paintRect.top(), paintRect.bottom());
356  yMap.setScaleInterval(sy1, sy2);
357 }
358 
360  const QPainter *painter )
361 {
362  bool doCache = false;
363 
364  if ( policy == QwtPlotRasterItem::PaintCache )
365  {
366  // Caching doesn't make sense, when the item is
367  // not painted to screen
368 
369  switch ( painter->paintEngine()->type() )
370  {
371  case QPaintEngine::SVG:
372  case QPaintEngine::Pdf:
373  case QPaintEngine::PostScript:
374  case QPaintEngine::MacPrinter:
375  case QPaintEngine::Picture:
376  break;
377  default:;
378  doCache = true;
379  }
380  }
381 
382  return doCache;
383 }
384 
385 static void qwtToRgba( const QImage* from, QImage* to,
386  const QRect& tile, int alpha )
387 {
388  const QRgb mask1 = qRgba( 0, 0, 0, alpha );
389  const QRgb mask2 = qRgba( 255, 255, 255, 0 );
390  const QRgb mask3 = qRgba( 0, 0, 0, 255 );
391 
392  const int y0 = tile.top();
393  const int y1 = tile.bottom();
394  const int x0 = tile.left();
395  const int x1 = tile.right();
396 
397  if ( from->depth() == 8 )
398  {
399  for ( int y = y0; y <= y1; y++ )
400  {
401  QRgb *alphaLine = reinterpret_cast<QRgb *>( to->scanLine( y ) );
402  const unsigned char *line = from->scanLine( y );
403 
404  for ( int x = x0; x <= x1; x++ )
405  *alphaLine++ = ( from->color( *line++ ) & mask2 ) | mask1;
406  }
407  }
408  else if ( from->depth() == 32 )
409  {
410  for ( int y = y0; y <= y1; y++ )
411  {
412  QRgb *alphaLine = reinterpret_cast<QRgb *>( to->scanLine( y ) );
413  const QRgb *line = reinterpret_cast<const QRgb *>( from->scanLine( y ) );
414 
415  for ( int x = x0; x <= x1; x++ )
416  {
417  const QRgb rgb = *line++;
418  if ( rgb & mask3 ) // alpha != 0
419  *alphaLine++ = ( rgb & mask2 ) | mask1;
420  else
421  *alphaLine++ = rgb;
422  }
423  }
424  }
425 }
426 
429  QwtPlotItem( QwtText( title ) )
430 {
431  init();
432 }
433 
436  QwtPlotItem( title )
437 {
438  init();
439 }
440 
443 {
444  delete d_data;
445 }
446 
448 {
449  d_data = new PrivateData();
450 
453 
454  setZ( 8.0 );
455 }
456 
465 {
466  if ( on )
467  d_data->paintAttributes |= attribute;
468  else
469  d_data->paintAttributes &= ~attribute;
470 }
471 
477 {
478  return ( d_data->paintAttributes & attribute );
479 }
480 
505 {
506  if ( alpha < 0 )
507  alpha = -1;
508 
509  if ( alpha > 255 )
510  alpha = 255;
511 
512  if ( alpha != d_data->alpha )
513  {
514  d_data->alpha = alpha;
515 
516  itemChanged();
517  }
518 }
519 
525 {
526  return d_data->alpha;
527 }
528 
539 {
540  if ( d_data->cache.policy != policy )
541  {
542  d_data->cache.policy = policy;
543 
544  invalidateCache();
545  itemChanged();
546  }
547 }
548 
554 {
555  return d_data->cache.policy;
556 }
557 
563 {
564  d_data->cache.image = QImage();
565  d_data->cache.area = QRect();
566  d_data->cache.size = QSize();
567 }
568 
595 QRectF QwtPlotRasterItem::pixelHint( const QRectF &area ) const
596 {
597  Q_UNUSED( area );
598  return QRectF();
599 }
600 
608 void QwtPlotRasterItem::draw( QPainter *painter,
609  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
610  const QRectF &canvasRect ) const
611 {
612  if ( canvasRect.isEmpty() || d_data->alpha == 0 )
613  return;
614 
615  const bool doCache = qwtUseCache( d_data->cache.policy, painter );
616 
617  const QwtInterval xInterval = interval( Qt::XAxis );
618  const QwtInterval yInterval = interval( Qt::YAxis );
619 
620  /*
621  Scaling an image always results in a loss of
622  precision/quality. So we always render the image in
623  paint device resolution.
624  */
625 
626  QwtScaleMap xxMap, yyMap;
627  qwtTransformMaps( painter->transform(), xMap, yMap, xxMap, yyMap );
628 
629  QRectF paintRect = painter->transform().mapRect( canvasRect );
630  QRectF area = QwtScaleMap::invTransform( xxMap, yyMap, paintRect );
631 
632  const QRectF br = boundingRect();
633  if ( br.isValid() && !br.contains( area ) )
634  {
635  area &= br;
636  if ( !area.isValid() )
637  return;
638 
639  paintRect = QwtScaleMap::transform( xxMap, yyMap, area );
640  }
641 
642  QRectF imageRect;
643  QImage image;
644 
645  QRectF pixelRect = pixelHint(area);
646  if ( !pixelRect.isEmpty() )
647  {
648  // one pixel of the target device in plot coordinates
649  const double dx = qAbs( xxMap.invTransform( 1 ) - xxMap.invTransform( 0 ) );
650  const double dy = qAbs( yyMap.invTransform( 1 ) - yyMap.invTransform( 0 ) );
651 
652  if ( dx > pixelRect.width() && dy > pixelRect.height() )
653  {
654  /*
655  When the resolution of the data pixels is higher than
656  the resolution of the target device we render in
657  target device resolution.
658  */
659  pixelRect = QRectF();
660  }
661  else
662  {
663  /*
664  If only one dimension is of the data pixel is higher
665  we expand the pixel rect to the resolution of the target device.
666  */
667 
668  if ( dx > pixelRect.width() )
669  pixelRect.setWidth( dx );
670 
671  if ( dy > pixelRect.height() )
672  pixelRect.setHeight( dy );
673  }
674  }
675 
676  if ( pixelRect.isEmpty() )
677  {
678  if ( QwtPainter::roundingAlignment( painter ) )
679  {
680  // we want to have maps, where the boundaries of
681  // the aligned paint rectangle exactly match the area
682 
683  paintRect = qwtAlignRect(paintRect);
684  qwtAdjustMaps(xxMap, yyMap, area, paintRect);
685  }
686 
687  // When we have no information about position and size of
688  // data pixels we render in resolution of the paint device.
689 
690  image = compose(xxMap, yyMap,
691  area, paintRect, paintRect.size().toSize(), doCache);
692  if ( image.isNull() )
693  return;
694 
695  // Remove pixels at the boundaries, when explicitly
696  // excluded in the intervals
697 
698  imageRect = qwtStripRect(paintRect, area,
699  xxMap, yyMap, xInterval, yInterval);
700 
701  if ( imageRect != paintRect )
702  {
703  const QRect r(
704  qRound( imageRect.x() - paintRect.x()),
705  qRound( imageRect.y() - paintRect.y() ),
706  qRound( imageRect.width() ),
707  qRound( imageRect.height() ) );
708 
709  image = image.copy(r);
710  }
711  }
712  else
713  {
714  if ( QwtPainter::roundingAlignment( painter ) )
715  paintRect = qwtAlignRect(paintRect);
716 
717  // align the area to the data pixels
718  QRectF imageArea = qwtExpandToPixels(area, pixelRect);
719 
720  if ( imageArea.right() == xInterval.maxValue() &&
721  !( xInterval.borderFlags() & QwtInterval::ExcludeMaximum ) )
722  {
723  imageArea.adjust(0, 0, pixelRect.width(), 0);
724  }
725  if ( imageArea.bottom() == yInterval.maxValue() &&
726  !( yInterval.borderFlags() & QwtInterval::ExcludeMaximum ) )
727  {
728  imageArea.adjust(0, 0, 0, pixelRect.height() );
729  }
730 
731  QSize imageSize;
732  imageSize.setWidth( qRound( imageArea.width() / pixelRect.width() ) );
733  imageSize.setHeight( qRound( imageArea.height() / pixelRect.height() ) );
734 
735  image = compose(xxMap, yyMap,
736  imageArea, paintRect, imageSize, doCache );
737 
738  if ( image.isNull() )
739  return;
740 
741  imageRect = qwtStripRect(paintRect, area,
742  xxMap, yyMap, xInterval, yInterval);
743 
744  if ( ( image.width() > 1 || image.height() > 1 ) &&
746  {
747  // Because of rounding errors the pixels
748  // need to be expanded manually to rectangles of
749  // different sizes
750 
751  image = qwtExpandImage(image, xxMap, yyMap,
752  imageArea, area, paintRect, xInterval, yInterval );
753  }
754  }
755 
756  painter->save();
757  painter->setWorldTransform( QTransform() );
758 
759  QwtPainter::drawImage( painter, imageRect, image );
760 
761  painter->restore();
762 }
763 
773 {
774  Q_UNUSED( axis );
775  return QwtInterval();
776 }
777 
783 {
784  const QwtInterval intervalX = interval( Qt::XAxis );
785  const QwtInterval intervalY = interval( Qt::YAxis );
786 
787  if ( !intervalX.isValid() && !intervalY.isValid() )
788  return QRectF(); // no bounding rect
789 
790  QRectF r;
791 
792  if ( intervalX.isValid() )
793  {
794  r.setLeft( intervalX.minValue() );
795  r.setRight( intervalX.maxValue() );
796  }
797  else
798  {
799  r.setLeft(-0.5 * FLT_MAX);
800  r.setWidth(FLT_MAX);
801  }
802 
803  if ( intervalY.isValid() )
804  {
805  r.setTop( intervalY.minValue() );
806  r.setBottom( intervalY.maxValue() );
807  }
808  else
809  {
810  r.setTop(-0.5 * FLT_MAX);
811  r.setHeight(FLT_MAX);
812  }
813 
814  return r.normalized();
815 }
816 
818  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
819  const QRectF &imageArea, const QRectF &paintRect,
820  const QSize &imageSize, bool doCache) const
821 {
822  QImage image;
823  if ( imageArea.isEmpty() || paintRect.isEmpty() || imageSize.isEmpty() )
824  return image;
825 
826  if ( doCache )
827  {
828  if ( !d_data->cache.image.isNull()
829  && d_data->cache.area == imageArea
830  && d_data->cache.size == paintRect.size() )
831  {
832  image = d_data->cache.image;
833  }
834  }
835 
836  if ( image.isNull() )
837  {
838  double dx = 0.0;
839  if ( paintRect.toRect().width() > imageSize.width() )
840  dx = imageArea.width() / imageSize.width();
841 
842  const QwtScaleMap xxMap =
843  imageMap(Qt::Horizontal, xMap, imageArea, imageSize, dx);
844 
845  double dy = 0.0;
846  if ( paintRect.toRect().height() > imageSize.height() )
847  dy = imageArea.height() / imageSize.height();
848 
849  const QwtScaleMap yyMap =
850  imageMap(Qt::Vertical, yMap, imageArea, imageSize, dy);
851 
852  image = renderImage( xxMap, yyMap, imageArea, imageSize );
853 
854  if ( doCache )
855  {
856  d_data->cache.area = imageArea;
857  d_data->cache.size = paintRect.size();
858  d_data->cache.image = image;
859  }
860  }
861 
862  if ( d_data->alpha >= 0 && d_data->alpha < 255 )
863  {
864  QImage alphaImage( image.size(), QImage::Format_ARGB32 );
865 
866 #if !defined(QT_NO_QFUTURE)
867  uint numThreads = renderThreadCount();
868 
869  if ( numThreads <= 0 )
870  numThreads = QThread::idealThreadCount();
871 
872  if ( numThreads <= 0 )
873  numThreads = 1;
874 
875  const int numRows = image.height() / numThreads;
876 
877  QVector< QFuture<void> > futures;
878  futures.reserve( numThreads - 1 );
879 
880  for ( uint i = 0; i < numThreads; i++ )
881  {
882  QRect tile( 0, i * numRows, image.width(), numRows );
883  if ( i == numThreads - 1 )
884  {
885  tile.setHeight( image.height() - i * numRows );
886  qwtToRgba( &image, &alphaImage, tile, d_data->alpha );
887  }
888  else
889  {
890  futures += QtConcurrent::run(
891  &qwtToRgba, &image, &alphaImage, tile, d_data->alpha );
892  }
893  }
894  for ( int i = 0; i < futures.size(); i++ )
895  futures[i].waitForFinished();
896 #else
897  const QRect tile( 0, 0, image.width(), image.height() );
898  qwtToRgba( &image, &alphaImage, tile, d_data->alpha );
899 #endif
900  image = alphaImage;
901  }
902 
903  return image;
904 }
905 
918  Qt::Orientation orientation,
919  const QwtScaleMap &map, const QRectF &area,
920  const QSize &imageSize, double pixelSize) const
921 {
922  double p1, p2, s1, s2;
923 
924  if ( orientation == Qt::Horizontal )
925  {
926  p1 = 0.0;
927  p2 = imageSize.width();
928  s1 = area.left();
929  s2 = area.right();
930  }
931  else
932  {
933  p1 = 0.0;
934  p2 = imageSize.height();
935  s1 = area.top();
936  s2 = area.bottom();
937  }
938 
939  if ( pixelSize > 0.0 )
940  {
941  double off = 0.5 * pixelSize;
942  if ( map.isInverting() )
943  off = -off;
944 
945  s1 += off;
946  s2 += off;
947  }
948  else
949  {
950  p2--;
951  }
952 
953  if ( map.isInverting() && ( s1 < s2 ) )
954  qSwap( s1, s2 );
955 
956  QwtScaleMap newMap = map;
957  newMap.setPaintInterval( p1, p2 );
958  newMap.setScaleInterval( s1, s2 );
959 
960  return newMap;
961 }
bool testPaintAttribute(PaintAttribute) const
double p1() const
virtual QImage renderImage(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const =0
Render an image.
virtual QRectF boundingRect() const
double p2() const
static void drawImage(QPainter *, const QRectF &, const QImage &)
Wrapper for QPainter::drawImage()
A class representing an interval.
Definition: qwt_interval.h:26
A class, which displays raster data.
Max value is not included in the interval.
Definition: qwt_interval.h:42
double minValue() const
Definition: qwt_interval.h:193
void setPaintAttribute(PaintAttribute, bool on=true)
virtual void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
Draw the raster data.
void setScaleInterval(double s1, double s2)
Specify the borders of the scale interval.
TFSIMD_FORCE_INLINE const tfScalar & y() const
static QRectF qwtStripRect(const QRectF &rect, const QRectF &area, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtInterval &xInterval, const QwtInterval &yInterval)
double maxValue() const
Definition: qwt_interval.h:199
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
The item is represented on the legend.
static QRectF qwtAlignRect(const QRectF &rect)
virtual QwtInterval interval(Qt::Axis) const
void setCachePolicy(CachePolicy)
virtual QwtScaleMap imageMap(Qt::Orientation, const QwtScaleMap &map, const QRectF &area, const QSize &imageSize, double pixelSize) const
Calculate a scale map for painting to an image.
QImage compose(const QwtScaleMap &, const QwtScaleMap &, const QRectF &imageArea, const QRectF &paintRect, const QSize &imageSize, bool doCache) const
struct QwtPlotRasterItem::PrivateData::ImageCache cache
bool isValid() const
Definition: qwt_interval.h:211
void setPaintInterval(double p1, double p2)
Specify the borders of the paint device interval.
A class representing a text.
Definition: qwt_text.h:51
void setZ(double z)
Set the z value.
virtual QRectF pixelHint(const QRectF &) const
Pixel hint.
CachePolicy
Cache policy The default policy is NoCache.
Min value is not included in the interval.
Definition: qwt_interval.h:39
TFSIMD_FORCE_INLINE const tfScalar & x() const
QRectF paintRect(const QwtScaleMap &, const QwtScaleMap &) const
Calculate the bounding paint rectangle of 2 maps.
A scale map.
Definition: qwt_scale_map.h:30
double invTransform(double p) const
BorderFlags borderFlags() const
Definition: qwt_interval.h:167
void setAlpha(int alpha)
Set an alpha value for the raster data.
virtual void itemChanged()
static QImage qwtExpandImage(const QImage &image, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QRectF &area2, const QRectF &paintRect, const QwtInterval &xInterval, const QwtInterval &yInterval)
uint renderThreadCount() const
TFSIMD_FORCE_INLINE const tfScalar & w() const
QwtPlotRasterItem(const QString &title=QString())
Constructor.
virtual ~QwtPlotRasterItem()
Destructor.
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:64
void setItemAttribute(ItemAttribute, bool on=true)
bool isInverting() const
double transform(double s) const
CachePolicy cachePolicy() const
int i
static void qwtAdjustMaps(QwtScaleMap &xMap, QwtScaleMap &yMap, const QRectF &area, const QRectF &paintRect)
static QRectF qwtExpandToPixels(const QRectF &rect, const QRectF &pixelRect)
QwtPlotRasterItem::PaintAttributes paintAttributes
static bool roundingAlignment()
Definition: qwt_painter.h:176
const QwtText & title() const
static void qwtTransformMaps(const QTransform &tr, const QwtScaleMap &xMap, const QwtScaleMap &yMap, QwtScaleMap &xxMap, QwtScaleMap &yyMap)
static bool qwtUseCache(QwtPlotRasterItem::CachePolicy policy, const QPainter *painter)
static void qwtToRgba(const QImage *from, QImage *to, const QRect &tile, int alpha)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17