QwtPlotRasterItem.3 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. .TH "QwtPlotRasterItem" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtPlotRasterItem \- A class, which displays raster data\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_plot_rasteritem\&.h>\fP
  11. .PP
  12. Inherits \fBQwtPlotItem\fP\&.
  13. .PP
  14. Inherited by \fBQwtPlotSpectrogram\fP\&.
  15. .SS "Public Types"
  16. .in +1c
  17. .ti -1c
  18. .RI "enum \fBCachePolicy\fP { \fBNoCache\fP, \fBPaintCache\fP }"
  19. .br
  20. .RI "Cache policy The default policy is NoCache\&. "
  21. .ti -1c
  22. .RI "enum \fBPaintAttribute\fP { \fBPaintInDeviceResolution\fP = 1 }"
  23. .br
  24. .ti -1c
  25. .RI "typedef QFlags< \fBPaintAttribute\fP > \fBPaintAttributes\fP"
  26. .br
  27. .RI "Paint attributes\&. "
  28. .in -1c
  29. .SS "Public Member Functions"
  30. .in +1c
  31. .ti -1c
  32. .RI "\fBQwtPlotRasterItem\fP (const QString &\fBtitle\fP=QString())"
  33. .br
  34. .RI "Constructor\&. "
  35. .ti -1c
  36. .RI "\fBQwtPlotRasterItem\fP (const \fBQwtText\fP &\fBtitle\fP)"
  37. .br
  38. .RI "Constructor\&. "
  39. .ti -1c
  40. .RI "virtual \fB~QwtPlotRasterItem\fP ()"
  41. .br
  42. .RI "Destructor\&. "
  43. .ti -1c
  44. .RI "void \fBsetPaintAttribute\fP (\fBPaintAttribute\fP, bool on=true)"
  45. .br
  46. .ti -1c
  47. .RI "bool \fBtestPaintAttribute\fP (\fBPaintAttribute\fP) const"
  48. .br
  49. .ti -1c
  50. .RI "void \fBsetAlpha\fP (int \fBalpha\fP)"
  51. .br
  52. .RI "Set an alpha value for the raster data\&. "
  53. .ti -1c
  54. .RI "int \fBalpha\fP () const"
  55. .br
  56. .ti -1c
  57. .RI "void \fBsetCachePolicy\fP (\fBCachePolicy\fP)"
  58. .br
  59. .ti -1c
  60. .RI "\fBCachePolicy\fP \fBcachePolicy\fP () const"
  61. .br
  62. .ti -1c
  63. .RI "void \fBinvalidateCache\fP ()"
  64. .br
  65. .ti -1c
  66. .RI "virtual void \fBdraw\fP (QPainter *, const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &canvasRect) const"
  67. .br
  68. .RI "Draw the raster data\&. "
  69. .ti -1c
  70. .RI "virtual QRectF \fBpixelHint\fP (const QRectF &) const"
  71. .br
  72. .RI "Pixel hint\&. "
  73. .ti -1c
  74. .RI "virtual \fBQwtInterval\fP \fBinterval\fP (Qt::Axis) const"
  75. .br
  76. .ti -1c
  77. .RI "virtual QRectF \fBboundingRect\fP () const"
  78. .br
  79. .in -1c
  80. .SS "Protected Member Functions"
  81. .in +1c
  82. .ti -1c
  83. .RI "virtual QImage \fBrenderImage\fP (const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &area, const QSize &imageSize) const =0"
  84. .br
  85. .RI "Render an image\&. "
  86. .ti -1c
  87. .RI "virtual \fBQwtScaleMap\fP \fBimageMap\fP (Qt::Orientation, const \fBQwtScaleMap\fP &map, const QRectF &area, const QSize &imageSize, double pixelSize) const"
  88. .br
  89. .RI "Calculate a scale map for painting to an image\&. "
  90. .in -1c
  91. .SH "Detailed Description"
  92. .PP
  93. A class, which displays raster data\&.
  94. Raster data is a grid of pixel values, that can be represented as a QImage\&. It is used for many types of information like spectrograms, cartograms, geographical maps \&.\&.\&.
  95. .PP
  96. Often a plot has several types of raster data organized in layers\&. ( f\&.e a geographical map, with weather statistics )\&. Using \fBsetAlpha()\fP raster items can be stacked easily\&.
  97. .PP
  98. \fBQwtPlotRasterItem\fP is only implemented for images of the following formats: QImage::Format_Indexed8, QImage::Format_ARGB32\&.
  99. .PP
  100. \fBSee also\fP
  101. .RS 4
  102. \fBQwtPlotSpectrogram\fP
  103. .RE
  104. .PP
  105. .SH "Member Enumeration Documentation"
  106. .PP
  107. .SS "enum \fBQwtPlotRasterItem::CachePolicy\fP"
  108. .PP
  109. Cache policy The default policy is NoCache\&.
  110. .PP
  111. \fBEnumerator\fP
  112. .in +1c
  113. .TP
  114. \fB\fINoCache \fP\fP
  115. \fBrenderImage()\fP is called each time the item has to be repainted
  116. .TP
  117. \fB\fIPaintCache \fP\fP
  118. \fBrenderImage()\fP is called, whenever the image cache is not valid, or the scales, or the size of the canvas has changed\&.
  119. .PP
  120. This type of cache is useful for improving the performance of hide/show operations or manipulations of the alpha value\&. All other situations are handled by the canvas backing store\&.
  121. .SS "enum \fBQwtPlotRasterItem::PaintAttribute\fP"
  122. Attributes to modify the drawing algorithm\&.
  123. .PP
  124. \fBSee also\fP
  125. .RS 4
  126. \fBsetPaintAttribute()\fP, \fBtestPaintAttribute()\fP
  127. .RE
  128. .PP
  129. .PP
  130. \fBEnumerator\fP
  131. .in +1c
  132. .TP
  133. \fB\fIPaintInDeviceResolution \fP\fP
  134. When the image is rendered according to the data pixels ( \fBQwtRasterData::pixelHint()\fP ) it can be expanded to paint device resolution before it is passed to QPainter\&. The expansion algorithm rounds the pixel borders in the same way as the axis ticks, what is usually better than the scaling algorithm implemented in Qt\&. Disabling this flag might make sense, to reduce the size of a document/file\&. If this is possible for a document format depends on the implementation of the specific QPaintEngine\&.
  135. .SH "Member Function Documentation"
  136. .PP
  137. .SS "int QwtPlotRasterItem::alpha () const"
  138. .PP
  139. \fBReturns\fP
  140. .RS 4
  141. Alpha value of the raster item
  142. .RE
  143. .PP
  144. \fBSee also\fP
  145. .RS 4
  146. \fBsetAlpha()\fP
  147. .RE
  148. .PP
  149. .SS "QRectF QwtPlotRasterItem::boundingRect () const\fC [virtual]\fP"
  150. .PP
  151. \fBReturns\fP
  152. .RS 4
  153. Bounding rectangle of the data
  154. .RE
  155. .PP
  156. \fBSee also\fP
  157. .RS 4
  158. \fBQwtPlotRasterItem::interval()\fP
  159. .RE
  160. .PP
  161. .PP
  162. Reimplemented from \fBQwtPlotItem\fP\&.
  163. .SS "\fBQwtPlotRasterItem::CachePolicy\fP QwtPlotRasterItem::cachePolicy () const"
  164. .PP
  165. \fBReturns\fP
  166. .RS 4
  167. Cache policy
  168. .RE
  169. .PP
  170. \fBSee also\fP
  171. .RS 4
  172. \fBCachePolicy\fP, \fBsetCachePolicy()\fP
  173. .RE
  174. .PP
  175. .SS "void QwtPlotRasterItem::draw (QPainter * painter, const \fBQwtScaleMap\fP & xMap, const \fBQwtScaleMap\fP & yMap, const QRectF & canvasRect) const\fC [virtual]\fP"
  176. .PP
  177. Draw the raster data\&.
  178. .PP
  179. \fBParameters\fP
  180. .RS 4
  181. \fIpainter\fP Painter
  182. .br
  183. \fIxMap\fP X-Scale Map
  184. .br
  185. \fIyMap\fP Y-Scale Map
  186. .br
  187. \fIcanvasRect\fP Contents rectangle of the plot canvas
  188. .RE
  189. .PP
  190. .PP
  191. Implements \fBQwtPlotItem\fP\&.
  192. .PP
  193. Reimplemented in \fBQwtPlotSpectrogram\fP\&.
  194. .SS "\fBQwtScaleMap\fP QwtPlotRasterItem::imageMap (Qt::Orientation orientation, const \fBQwtScaleMap\fP & map, const QRectF & area, const QSize & imageSize, double pixelSize) const\fC [protected]\fP, \fC [virtual]\fP"
  195. .PP
  196. Calculate a scale map for painting to an image\&.
  197. .PP
  198. \fBParameters\fP
  199. .RS 4
  200. \fIorientation\fP Orientation, Qt::Horizontal means a X axis
  201. .br
  202. \fImap\fP Scale map for rendering the plot item
  203. .br
  204. \fIarea\fP Area to be painted on the image
  205. .br
  206. \fIimageSize\fP Image size
  207. .br
  208. \fIpixelSize\fP Width/Height of a data pixel
  209. .RE
  210. .PP
  211. \fBReturns\fP
  212. .RS 4
  213. Calculated scale map
  214. .RE
  215. .PP
  216. .SS "\fBQwtInterval\fP QwtPlotRasterItem::interval (Qt::Axis axis) const\fC [virtual]\fP"
  217. .PP
  218. \fBReturns\fP
  219. .RS 4
  220. Bounding interval for an axis
  221. .RE
  222. .PP
  223. This method is intended to be reimplemented by derived classes\&. The default implementation returns an invalid interval\&.
  224. .PP
  225. \fBParameters\fP
  226. .RS 4
  227. \fIaxis\fP X, Y, or Z axis
  228. .RE
  229. .PP
  230. .PP
  231. Reimplemented in \fBQwtPlotSpectrogram\fP\&.
  232. .SS "void QwtPlotRasterItem::invalidateCache ()"
  233. Invalidate the paint cache
  234. .PP
  235. \fBSee also\fP
  236. .RS 4
  237. \fBsetCachePolicy()\fP
  238. .RE
  239. .PP
  240. .SS "QRectF QwtPlotRasterItem::pixelHint (const QRectF & area) const\fC [virtual]\fP"
  241. .PP
  242. Pixel hint\&. The geometry of a pixel is used to calculated the resolution and alignment of the rendered image\&.
  243. .PP
  244. Width and height of the hint need to be the horizontal and vertical distances between 2 neighbored points\&. The center of the hint has to be the position of any point ( it doesn't matter which one )\&.
  245. .PP
  246. Limiting the resolution of the image might significantly improve the performance and heavily reduce the amount of memory when rendering a QImage from the raster data\&.
  247. .PP
  248. The default implementation returns an empty rectangle (QRectF()), meaning, that the image will be rendered in target device ( f\&.e screen ) resolution\&.
  249. .PP
  250. \fBParameters\fP
  251. .RS 4
  252. \fIarea\fP In most implementations the resolution of the data doesn't depend on the requested area\&.
  253. .RE
  254. .PP
  255. \fBReturns\fP
  256. .RS 4
  257. Bounding rectangle of a pixel
  258. .RE
  259. .PP
  260. \fBSee also\fP
  261. .RS 4
  262. render(), \fBrenderImage()\fP
  263. .RE
  264. .PP
  265. .PP
  266. Reimplemented in \fBQwtPlotSpectrogram\fP\&.
  267. .SS "virtual QImage QwtPlotRasterItem::renderImage (const \fBQwtScaleMap\fP & xMap, const \fBQwtScaleMap\fP & yMap, const QRectF & area, const QSize & imageSize) const\fC [protected]\fP, \fC [pure virtual]\fP"
  268. .PP
  269. Render an image\&. An implementation of render() might iterate over all pixels of imageRect\&. Each pixel has to be translated into the corresponding position in scale coordinates using the maps\&. This position can be used to look up a value in a implementation specific way and to map it into a color\&.
  270. .PP
  271. \fBParameters\fP
  272. .RS 4
  273. \fIxMap\fP X-Scale Map
  274. .br
  275. \fIyMap\fP Y-Scale Map
  276. .br
  277. \fIarea\fP Requested area for the image in scale coordinates
  278. .br
  279. \fIimageSize\fP Requested size of the image
  280. .RE
  281. .PP
  282. \fBReturns\fP
  283. .RS 4
  284. Rendered image
  285. .RE
  286. .PP
  287. .PP
  288. Implemented in \fBQwtPlotSpectrogram\fP\&.
  289. .SS "void QwtPlotRasterItem::setAlpha (int alpha)"
  290. .PP
  291. Set an alpha value for the raster data\&. Often a plot has several types of raster data organized in layers\&. ( f\&.e a geographical map, with weather statistics )\&. Using \fBsetAlpha()\fP raster items can be stacked easily\&.
  292. .PP
  293. The alpha value is a value [0, 255] to control the transparency of the image\&. 0 represents a fully transparent color, while 255 represents a fully opaque color\&.
  294. .PP
  295. \fBParameters\fP
  296. .RS 4
  297. \fIalpha\fP Alpha value
  298. .RE
  299. .PP
  300. .IP "\(bu" 2
  301. alpha >= 0
  302. .br
  303. All alpha values of the pixels returned by \fBrenderImage()\fP will be set to alpha, beside those with an alpha value of 0 (invalid pixels)\&.
  304. .IP "\(bu" 2
  305. alpha < 0 The alpha values returned by \fBrenderImage()\fP are not changed\&.
  306. .PP
  307. .PP
  308. The default alpha value is -1\&.
  309. .PP
  310. \fBSee also\fP
  311. .RS 4
  312. \fBalpha()\fP
  313. .RE
  314. .PP
  315. .SS "void QwtPlotRasterItem::setCachePolicy (\fBQwtPlotRasterItem::CachePolicy\fP policy)"
  316. Change the cache policy
  317. .PP
  318. The default policy is NoCache
  319. .PP
  320. \fBParameters\fP
  321. .RS 4
  322. \fIpolicy\fP Cache policy
  323. .RE
  324. .PP
  325. \fBSee also\fP
  326. .RS 4
  327. \fBCachePolicy\fP, \fBcachePolicy()\fP
  328. .RE
  329. .PP
  330. .SS "void QwtPlotRasterItem::setPaintAttribute (\fBPaintAttribute\fP attribute, bool on = \fCtrue\fP)"
  331. Specify an attribute how to draw the raster item
  332. .PP
  333. \fBParameters\fP
  334. .RS 4
  335. \fIattribute\fP Paint attribute
  336. .br
  337. \fIon\fP On/Off /sa PaintAttribute, \fBtestPaintAttribute()\fP
  338. .RE
  339. .PP
  340. .SS "bool QwtPlotRasterItem::testPaintAttribute (\fBPaintAttribute\fP attribute) const"
  341. .PP
  342. \fBReturns\fP
  343. .RS 4
  344. True, when attribute is enabled
  345. .RE
  346. .PP
  347. \fBSee also\fP
  348. .RS 4
  349. \fBPaintAttribute\fP, \fBsetPaintAttribute()\fP
  350. .RE
  351. .PP
  352. .SH "Author"
  353. .PP
  354. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.