.TH "QwtPlotRasterItem" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*- .ad l .nh .SH NAME QwtPlotRasterItem \- A class, which displays raster data\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBQwtPlotItem\fP\&. .PP Inherited by \fBQwtPlotSpectrogram\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum \fBCachePolicy\fP { \fBNoCache\fP, \fBPaintCache\fP }" .br .RI "Cache policy The default policy is NoCache\&. " .ti -1c .RI "enum \fBPaintAttribute\fP { \fBPaintInDeviceResolution\fP = 1 }" .br .ti -1c .RI "typedef QFlags< \fBPaintAttribute\fP > \fBPaintAttributes\fP" .br .RI "Paint attributes\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBQwtPlotRasterItem\fP (const QString &\fBtitle\fP=QString())" .br .RI "Constructor\&. " .ti -1c .RI "\fBQwtPlotRasterItem\fP (const \fBQwtText\fP &\fBtitle\fP)" .br .RI "Constructor\&. " .ti -1c .RI "virtual \fB~QwtPlotRasterItem\fP ()" .br .RI "Destructor\&. " .ti -1c .RI "void \fBsetPaintAttribute\fP (\fBPaintAttribute\fP, bool on=true)" .br .ti -1c .RI "bool \fBtestPaintAttribute\fP (\fBPaintAttribute\fP) const" .br .ti -1c .RI "void \fBsetAlpha\fP (int \fBalpha\fP)" .br .RI "Set an alpha value for the raster data\&. " .ti -1c .RI "int \fBalpha\fP () const" .br .ti -1c .RI "void \fBsetCachePolicy\fP (\fBCachePolicy\fP)" .br .ti -1c .RI "\fBCachePolicy\fP \fBcachePolicy\fP () const" .br .ti -1c .RI "void \fBinvalidateCache\fP ()" .br .ti -1c .RI "virtual void \fBdraw\fP (QPainter *, const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &canvasRect) const" .br .RI "Draw the raster data\&. " .ti -1c .RI "virtual QRectF \fBpixelHint\fP (const QRectF &) const" .br .RI "Pixel hint\&. " .ti -1c .RI "virtual \fBQwtInterval\fP \fBinterval\fP (Qt::Axis) const" .br .ti -1c .RI "virtual QRectF \fBboundingRect\fP () const" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual QImage \fBrenderImage\fP (const \fBQwtScaleMap\fP &xMap, const \fBQwtScaleMap\fP &yMap, const QRectF &area, const QSize &imageSize) const =0" .br .RI "Render an image\&. " .ti -1c .RI "virtual \fBQwtScaleMap\fP \fBimageMap\fP (Qt::Orientation, const \fBQwtScaleMap\fP &map, const QRectF &area, const QSize &imageSize, double pixelSize) const" .br .RI "Calculate a scale map for painting to an image\&. " .in -1c .SH "Detailed Description" .PP A class, which displays raster data\&. 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 \&.\&.\&. .PP 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\&. .PP \fBQwtPlotRasterItem\fP is only implemented for images of the following formats: QImage::Format_Indexed8, QImage::Format_ARGB32\&. .PP \fBSee also\fP .RS 4 \fBQwtPlotSpectrogram\fP .RE .PP .SH "Member Enumeration Documentation" .PP .SS "enum \fBQwtPlotRasterItem::CachePolicy\fP" .PP Cache policy The default policy is NoCache\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fINoCache \fP\fP \fBrenderImage()\fP is called each time the item has to be repainted .TP \fB\fIPaintCache \fP\fP \fBrenderImage()\fP is called, whenever the image cache is not valid, or the scales, or the size of the canvas has changed\&. .PP 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\&. .SS "enum \fBQwtPlotRasterItem::PaintAttribute\fP" Attributes to modify the drawing algorithm\&. .PP \fBSee also\fP .RS 4 \fBsetPaintAttribute()\fP, \fBtestPaintAttribute()\fP .RE .PP .PP \fBEnumerator\fP .in +1c .TP \fB\fIPaintInDeviceResolution \fP\fP 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\&. .SH "Member Function Documentation" .PP .SS "int QwtPlotRasterItem::alpha () const" .PP \fBReturns\fP .RS 4 Alpha value of the raster item .RE .PP \fBSee also\fP .RS 4 \fBsetAlpha()\fP .RE .PP .SS "QRectF QwtPlotRasterItem::boundingRect () const\fC [virtual]\fP" .PP \fBReturns\fP .RS 4 Bounding rectangle of the data .RE .PP \fBSee also\fP .RS 4 \fBQwtPlotRasterItem::interval()\fP .RE .PP .PP Reimplemented from \fBQwtPlotItem\fP\&. .SS "\fBQwtPlotRasterItem::CachePolicy\fP QwtPlotRasterItem::cachePolicy () const" .PP \fBReturns\fP .RS 4 Cache policy .RE .PP \fBSee also\fP .RS 4 \fBCachePolicy\fP, \fBsetCachePolicy()\fP .RE .PP .SS "void QwtPlotRasterItem::draw (QPainter * painter, const \fBQwtScaleMap\fP & xMap, const \fBQwtScaleMap\fP & yMap, const QRectF & canvasRect) const\fC [virtual]\fP" .PP Draw the raster data\&. .PP \fBParameters\fP .RS 4 \fIpainter\fP Painter .br \fIxMap\fP X-Scale Map .br \fIyMap\fP Y-Scale Map .br \fIcanvasRect\fP Contents rectangle of the plot canvas .RE .PP .PP Implements \fBQwtPlotItem\fP\&. .PP Reimplemented in \fBQwtPlotSpectrogram\fP\&. .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" .PP Calculate a scale map for painting to an image\&. .PP \fBParameters\fP .RS 4 \fIorientation\fP Orientation, Qt::Horizontal means a X axis .br \fImap\fP Scale map for rendering the plot item .br \fIarea\fP Area to be painted on the image .br \fIimageSize\fP Image size .br \fIpixelSize\fP Width/Height of a data pixel .RE .PP \fBReturns\fP .RS 4 Calculated scale map .RE .PP .SS "\fBQwtInterval\fP QwtPlotRasterItem::interval (Qt::Axis axis) const\fC [virtual]\fP" .PP \fBReturns\fP .RS 4 Bounding interval for an axis .RE .PP This method is intended to be reimplemented by derived classes\&. The default implementation returns an invalid interval\&. .PP \fBParameters\fP .RS 4 \fIaxis\fP X, Y, or Z axis .RE .PP .PP Reimplemented in \fBQwtPlotSpectrogram\fP\&. .SS "void QwtPlotRasterItem::invalidateCache ()" Invalidate the paint cache .PP \fBSee also\fP .RS 4 \fBsetCachePolicy()\fP .RE .PP .SS "QRectF QwtPlotRasterItem::pixelHint (const QRectF & area) const\fC [virtual]\fP" .PP Pixel hint\&. The geometry of a pixel is used to calculated the resolution and alignment of the rendered image\&. .PP 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 )\&. .PP 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\&. .PP The default implementation returns an empty rectangle (QRectF()), meaning, that the image will be rendered in target device ( f\&.e screen ) resolution\&. .PP \fBParameters\fP .RS 4 \fIarea\fP In most implementations the resolution of the data doesn't depend on the requested area\&. .RE .PP \fBReturns\fP .RS 4 Bounding rectangle of a pixel .RE .PP \fBSee also\fP .RS 4 render(), \fBrenderImage()\fP .RE .PP .PP Reimplemented in \fBQwtPlotSpectrogram\fP\&. .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" .PP 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\&. .PP \fBParameters\fP .RS 4 \fIxMap\fP X-Scale Map .br \fIyMap\fP Y-Scale Map .br \fIarea\fP Requested area for the image in scale coordinates .br \fIimageSize\fP Requested size of the image .RE .PP \fBReturns\fP .RS 4 Rendered image .RE .PP .PP Implemented in \fBQwtPlotSpectrogram\fP\&. .SS "void QwtPlotRasterItem::setAlpha (int alpha)" .PP 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\&. .PP 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\&. .PP \fBParameters\fP .RS 4 \fIalpha\fP Alpha value .RE .PP .IP "\(bu" 2 alpha >= 0 .br 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)\&. .IP "\(bu" 2 alpha < 0 The alpha values returned by \fBrenderImage()\fP are not changed\&. .PP .PP The default alpha value is -1\&. .PP \fBSee also\fP .RS 4 \fBalpha()\fP .RE .PP .SS "void QwtPlotRasterItem::setCachePolicy (\fBQwtPlotRasterItem::CachePolicy\fP policy)" Change the cache policy .PP The default policy is NoCache .PP \fBParameters\fP .RS 4 \fIpolicy\fP Cache policy .RE .PP \fBSee also\fP .RS 4 \fBCachePolicy\fP, \fBcachePolicy()\fP .RE .PP .SS "void QwtPlotRasterItem::setPaintAttribute (\fBPaintAttribute\fP attribute, bool on = \fCtrue\fP)" Specify an attribute how to draw the raster item .PP \fBParameters\fP .RS 4 \fIattribute\fP Paint attribute .br \fIon\fP On/Off /sa PaintAttribute, \fBtestPaintAttribute()\fP .RE .PP .SS "bool QwtPlotRasterItem::testPaintAttribute (\fBPaintAttribute\fP attribute) const" .PP \fBReturns\fP .RS 4 True, when attribute is enabled .RE .PP \fBSee also\fP .RS 4 \fBPaintAttribute\fP, \fBsetPaintAttribute()\fP .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Qwt User's Guide from the source code\&.