qwt_painter.h
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 #ifndef QWT_PAINTER_H
11 #define QWT_PAINTER_H
12 
13 #include "qwt_global.h"
14 
15 #include <qpoint.h>
16 #include <qrect.h>
17 #include <qpen.h>
18 #include <qline.h>
19 #include <qpalette.h>
20 
21 class QPainter;
22 class QBrush;
23 class QColor;
24 class QWidget;
25 class QPolygonF;
26 class QRectF;
27 class QImage;
28 class QPixmap;
29 class QwtScaleMap;
30 class QwtColorMap;
31 class QwtInterval;
32 
33 class QTextDocument;
34 class QPainterPath;
35 
40 {
41 public:
42  static void setPolylineSplitting( bool );
43  static bool polylineSplitting();
44 
45  static void setRoundingAlignment( bool );
46  static bool roundingAlignment();
47  static bool roundingAlignment(QPainter *);
48 
49  static void drawText( QPainter *, double x, double y, const QString & );
50  static void drawText( QPainter *, const QPointF &, const QString & );
51  static void drawText( QPainter *, double x, double y, double w, double h,
52  int flags, const QString & );
53  static void drawText( QPainter *, const QRectF &,
54  int flags, const QString & );
55 
56 #ifndef QT_NO_RICHTEXT
57  static void drawSimpleRichText( QPainter *, const QRectF &,
58  int flags, const QTextDocument & );
59 #endif
60 
61  static void drawRect( QPainter *, double x, double y, double w, double h );
62  static void drawRect( QPainter *, const QRectF &rect );
63  static void fillRect( QPainter *, const QRectF &, const QBrush & );
64 
65  static void drawEllipse( QPainter *, const QRectF & );
66  static void drawPie( QPainter *, const QRectF & r, int a, int alen );
67 
68  static void drawLine( QPainter *, double x1, double y1, double x2, double y2 );
69  static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2 );
70  static void drawLine( QPainter *, const QLineF & );
71 
72  static void drawPolygon( QPainter *, const QPolygonF & );
73  static void drawPolyline( QPainter *, const QPolygonF & );
74  static void drawPolyline( QPainter *, const QPointF *, int pointCount );
75 
76  static void drawPolygon( QPainter *, const QPolygon & );
77  static void drawPolyline( QPainter *, const QPolygon & );
78  static void drawPolyline( QPainter *, const QPoint *, int pointCount );
79 
80  static void drawPoint( QPainter *, const QPoint & );
81  static void drawPoints( QPainter *, const QPolygon & );
82  static void drawPoints( QPainter *, const QPoint *, int pointCount );
83 
84  static void drawPoint( QPainter *, double x, double y );
85  static void drawPoint( QPainter *, const QPointF & );
86  static void drawPoints( QPainter *, const QPolygonF & );
87  static void drawPoints( QPainter *, const QPointF *, int pointCount );
88 
89  static void drawPath( QPainter *, const QPainterPath & );
90  static void drawImage( QPainter *, const QRectF &, const QImage & );
91  static void drawPixmap( QPainter *, const QRectF &, const QPixmap & );
92 
93  static void drawRoundFrame( QPainter *,
94  const QRectF &, const QPalette &, int lineWidth, int frameStyle );
95 
96  static void drawRoundedFrame( QPainter *,
97  const QRectF &, double xRadius, double yRadius,
98  const QPalette &, int lineWidth, int frameStyle );
99 
100  static void drawFrame( QPainter *, const QRectF &rect,
101  const QPalette &palette, QPalette::ColorRole foregroundRole,
102  int lineWidth, int midLineWidth, int frameStyle );
103 
104  static void drawFocusRect( QPainter *, const QWidget * );
105  static void drawFocusRect( QPainter *, const QWidget *, const QRect & );
106 
107  static void drawColorBar( QPainter *painter,
108  const QwtColorMap &, const QwtInterval &,
109  const QwtScaleMap &, Qt::Orientation, const QRectF & );
110 
111  static bool isAligning( QPainter *painter );
112  static bool isX11GraphicsSystem();
113 
114  static void fillPixmap( const QWidget *,
115  QPixmap &, const QPoint &offset = QPoint() );
116 
117  static void drawBackgound( QPainter *painter,
118  const QRectF &rect, const QWidget *widget );
119 
120  static QPixmap backingStore( QWidget *, const QSize & );
121  static qreal devicePixelRatio( const QPaintDevice * );
122 
123 private:
124  static bool d_polylineSplitting;
125  static bool d_roundingAlignment;
126 };
127 
129 inline void QwtPainter::drawPoint( QPainter *painter, double x, double y )
130 {
131  QwtPainter::drawPoint( painter, QPointF( x, y ) );
132 }
133 
135 inline void QwtPainter::drawPoints( QPainter *painter, const QPolygon &polygon )
136 {
137  drawPoints( painter, polygon.data(), polygon.size() );
138 }
139 
141 inline void QwtPainter::drawPoints( QPainter *painter, const QPolygonF &polygon )
142 {
143  drawPoints( painter, polygon.data(), polygon.size() );
144 }
145 
147 inline void QwtPainter::drawLine( QPainter *painter,
148  double x1, double y1, double x2, double y2 )
149 {
150  QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
151 }
152 
154 inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line )
155 {
156  QwtPainter::drawLine( painter, line.p1(), line.p2() );
157 }
158 
164 {
165  return d_polylineSplitting;
166 }
167 
177 {
178  return d_roundingAlignment;
179 }
180 
185 inline bool QwtPainter::roundingAlignment(QPainter *painter)
186 {
187  return d_roundingAlignment && isAligning(painter);
188 }
189 #endif
A collection of QPainter workarounds.
Definition: qwt_painter.h:39
static void drawLine(QPainter *, double x1, double y1, double x2, double y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:147
A class representing an interval.
Definition: qwt_interval.h:26
#define QWT_EXPORT
Definition: qwt_global.h:38
static void drawPoints(QPainter *, const QPolygon &)
Wrapper for QPainter::drawPoints()
Definition: qwt_painter.h:135
static bool polylineSplitting()
Definition: qwt_painter.h:163
TFSIMD_FORCE_INLINE const tfScalar & y() const
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:33
TFSIMD_FORCE_INLINE const tfScalar & x() const
A scale map.
Definition: qwt_scale_map.h:30
static bool d_roundingAlignment
Definition: qwt_painter.h:125
TFSIMD_FORCE_INLINE const tfScalar & w() const
int flags
static void drawPoint(QPainter *, const QPoint &)
Wrapper for QPainter::drawPoint()
int a
static bool roundingAlignment()
Definition: qwt_painter.h:176
static bool d_polylineSplitting
Definition: qwt_painter.h:124


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