QwtPlotRasterItem(3)
π¦ QwtPlotRasterItem(3) π¦
okay bestie so this is from the Library Functions Manual, and it's literally the whole glow-up guide to QwtPlotRasterItem π
β the class that's out here displaying raster data. buckle up, it's giving thorough.
β¨ NAME β¨
QwtPlotRasterItem β a class that displays raster data π
πΈ SYNOPSIS πΈ
#include <qwt_plot_rasteritem.h>
so it Inherits QwtPlotItem (yes, we stan a parent class), and it's Inherited by QwtPlotSpectrogram π
π Public Types π
enum CachePolicy { NoCache, PaintCache }β cache policy, and the default policy isNoCacheenum PaintAttribute { PaintInDeviceResolution = 1 }typedef QFlags< PaintAttribute > PaintAttributes
π Public Types inherited from QwtPlotItem π
enum RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotLegend, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotGraphic, Rtti_PlotTradingCurve, Rtti_PlotBarChart, Rtti_PlotMultiBarChart, Rtti_PlotShape, Rtti_PlotTextLabel, Rtti_PlotZone, Rtti_PlotVectorField, Rtti_PlotUserItem = 1000 }β runtime type information, iykykenum ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 }β plot Item Attributesenum ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 }β plot Item Interestsenum RenderHint { RenderAntialiased = 0x1 }β render hintstypedef QFlags< ItemAttribute > ItemAttributestypedef QFlags< ItemInterest > ItemIntereststypedef QFlags< RenderHint > RenderHints
π Public Member Functions π
QwtPlotRasterItem (const QString &title=QString())β constructor β¨QwtPlotRasterItem (const QwtText &title)β constructor β¨virtual ~QwtPlotRasterItem ()β destructorvoid setPaintAttribute (PaintAttribute, bool on=true)bool testPaintAttribute (PaintAttribute) constvoid setAlpha (int alpha)β sets an alpha value for the raster dataint alpha () constvoid setCachePolicy (CachePolicy)CachePolicy cachePolicy () constvoid invalidateCache ()virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const overrideβ draws the raster datavirtual QRectF pixelHint (const QRectF &) constβ pixel hintvirtual QwtInterval interval (Qt::Axis) constvirtual QRectF boundingRect () const override
π Public Member Functions inherited from QwtPlotItem π
QwtPlotItem ()QwtPlotItem (const QString &title)QwtPlotItem (const QwtText &title)virtual ~QwtPlotItem ()β destroys theQwtPlotItemvoid attach (QwtPlot *plot)β attaches the item to a plotvoid detach ()β this method detaches aQwtPlotItemfrom anyQwtPlotit has been associated withQwtPlot * plot () constβ returns the attached plotvoid setTitle (const QString &title)void setTitle (const QwtText &title)const QwtText & title () constvirtual int rtti () constvoid setItemAttribute (ItemAttribute, bool on=true)bool testItemAttribute (ItemAttribute) constvoid setItemInterest (ItemInterest, bool on=true)bool testItemInterest (ItemInterest) constvoid setRenderHint (RenderHint, bool on=true)bool testRenderHint (RenderHint) constvoid setRenderThreadCount (uint numThreads)uint renderThreadCount () constvoid setLegendIconSize (const QSize &)QSize legendIconSize () constdouble z () constvoid setZ (double z)β sets the z valuevoid show ()β shows the itemvoid hide ()β hides the itemvirtual void setVisible (bool)bool isVisible () constvoid setAxes (QwtAxisId xAxis, QwtAxisId yAxis)void setXAxis (QwtAxisId)QwtAxisId xAxis () constβ returns xAxisvoid setYAxis (QwtAxisId)QwtAxisId yAxis () constβ returns yAxisvirtual void itemChanged ()virtual void legendChanged ()virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) constβ calculates a hint for the canvas marginvirtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)β updates the item to changes of the axes scale divisionvirtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)β updates the item to changes of the legend infoQRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculates the bounding scale rectangle of 2 mapsQRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculates the bounding paint rectangle of 2 mapsvirtual QList< QwtLegendData > legendData () constβ returns all information that is needed to represent the item on the legendvirtual QwtGraphic legendIcon (int index, const QSizeF &) const
π§ Protected Member Functions π§
virtual QImage renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const =0β renders an image (note the=0, it's pure virtual, so you gotta implement it, no cap)virtual QwtScaleMap imageMap (Qt::Orientation, const QwtScaleMap &map, const QRectF &area, const QSize &imageSize, double pixelSize) constβ calculates a scale map for painting to an image
π Protected Member Functions inherited from QwtPlotItem π
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) constβ returns a default icon from a brush
π Detailed Description π
a class that displays raster data β periodt β¨
raster data is literally a grid of pixel values that can be represented as a QImage. it gets used for so many types of information, like spectrograms, cartograms, geographical mapsβ¦ the range is iconic π
often a plot has several types of raster data organized in layers (f.e. a geographical map, with weather statistics π¦οΈ). using setAlpha() raster items can be stacked easily β main character energy fr fr.
β οΈ heads up bestie:QwtPlotRasterItemis only implemented for images of the following formats:QImage::Format_Indexed8,QImage::Format_ARGB32. don't come at it with anything else, it will not slay.
See also: QwtPlotSpectrogram π«Ά
Definition at line 37 of file qwt_plot_rasteritem.h.
π Member Typedef Documentation π
typedef QFlags<PaintAttribute > QwtPlotRasterItem::PaintAttributes
an ORed combination of PaintAttribute values π«
Definition at line 83 of file qwt_plot_rasteritem.h.
π₯ Member Enumeration Documentation π₯
enum QwtPlotRasterItem::CachePolicy
cache policy β and the default policy is NoCache, remember that π
Enumerator
NoCacheβrenderImage()is called each time the item has to be repaintedPaintCacheβrenderImage()is called whenever the image cache is not valid, or the scales, or the size of the canvas has changed
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 β¨
Definition at line 44 of file qwt_plot_rasteritem.h.
enum QwtPlotRasterItem::PaintAttribute
attributes to modify the drawing algorithm π
See also: setPaintAttribute(), testPaintAttribute()
Enumerator
PaintInDeviceResolutionβ when the image is rendered according to the data pixels (QwtRasterData::pixelHint()) it can be expanded to paint device resolution before it is passed toQPainter. the expansion algorithm rounds the pixel borders in the same way as the axis ticks, which is usually better than the scaling algorithm implemented in Qt. disabling this flag might make sense, to reduce the size of a document/file π. whether this is possible for a document format depends on the implementation of the specificQPaintEngine. so likeβ¦ it's giving situational, ngl.
Definition at line 66 of file qwt_plot_rasteritem.h.
π Constructor & Destructor Documentation π
QwtPlotRasterItem::QwtPlotRasterItem (const QString & title = QString()) β [explicit]
constructor β¨
Definition at line 434 of file qwt_plot_rasteritem.cpp.
QwtPlotRasterItem::QwtPlotRasterItem (const QwtText & title) β [explicit]
constructor β¨ (yes, this one takes a QwtText, different vibe)
Definition at line 441 of file qwt_plot_rasteritem.cpp.
QwtPlotRasterItem::~QwtPlotRasterItem () β [virtual]
destructor π¦
Definition at line 448 of file qwt_plot_rasteritem.cpp.
okay and that's literally just the setup β part 2 is coming and it's gonna be so good, stay with me bestie π π«Ά
π Member Function Documentation π
Okay bestie, here's where the actual doing happens. Every function in alphabetical order, no skips, no cap. π«Ά
π int QwtPlotRasterItem::alpha () const
Hands you back the alpha value of the raster item β you know, the transparency situation.
Returns: the alpha value of the raster item.
See also: setAlpha()
Defined at line 530 of file qwt_plot_rasteritem.cpp.
π¦ QRectF QwtPlotRasterItem::boundingRect () const [override], [virtual]
Gives you the bounding rectangle of the data. That's the box it lives in, essentially.
Returns: bounding rectangle of the data.
See also: QwtPlotRasterItem::interval()
Reimplemented from QwtPlotItem.
Defined at line 800 of file qwt_plot_rasteritem.cpp.
β¨ QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy () const
Spills the current cache policy. That's it, that's the whole function.
Returns: the cache policy.
See also: CachePolicy, setCachePolicy()
Defined at line 559 of file qwt_plot_rasteritem.cpp.
π₯ void QwtPlotRasterItem::draw (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect) const [override], [virtual]
Draws the raster data. Main character function energy honestly.
Parameters:
- painter β painter
- xMap β X-Scale Map
- yMap β Y-Scale Map
- canvasRect β contents rectangle of the plot canvas
Implements QwtPlotItem.
Reimplemented in QwtPlotSpectrogram.
Defined at line 614 of file qwt_plot_rasteritem.cpp.
π§ QwtScaleMap QwtPlotRasterItem::imageMap (Qt::Orientation orientation, const QwtScaleMap & map, const QRectF & area, const QSize & imageSize, double pixelSize) const [protected], [virtual]
Calculates a scale map for painting to an image. Protected, so it's for the derived-class girlies π
Parameters:
- orientation β orientation,
Qt::Horizontalmeans a X axis - map β scale map for rendering the plot item
- area β area to be painted on the image
- imageSize β image size
- pixelSize β width/height of a data pixel
Returns: the calculated scale map.
Defined at line 939 of file qwt_plot_rasteritem.cpp.
πΈ QwtInterval QwtPlotRasterItem::interval (Qt::Axis axis) const [virtual]
Returns the bounding interval for an axis.
This one is intended to be reimplemented by derived classes β like, the base version is a placeholder. The default implementation returns an invalid interval. No drama, just how it is.
Parameters:
- axis β X, Y, or Z axis
Reimplemented in QwtPlotSpectrogram.
Defined at line 790 of file qwt_plot_rasteritem.cpp.
π void QwtPlotRasterItem::invalidateCache ()
Invalidates the paint cache. Begone, stale pixels.
See also: setCachePolicy()
Defined at line 568 of file qwt_plot_rasteritem.cpp.
π QRectF QwtPlotRasterItem::pixelHint (const QRectF & area) const [virtual]
Pixel hint, bestie. The geometry of a pixel is used to calculate the resolution and alignment of the rendered image.
So here's the tea: the width and height of the hint need to be the horizontal and vertical distances between 2 neighbored points. And the center of the hint has to be the position of any point (it doesn't matter which one β literally any).
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. Efficiency slay β¨
The default implementation returns an empty rectangle (QRectF()), meaning that the image will be rendered in target device (f.e screen) resolution.
Parameters:
- area β in most implementations the resolution of the data doesn't depend on the requested area
Returns: bounding rectangle of a pixel.
See also: render(), renderImage()
Reimplemented in QwtPlotSpectrogram.
Defined at line 601 of file qwt_plot_rasteritem.cpp.
π virtual QImage QwtPlotRasterItem::renderImage (const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & area, const QSize & imageSize) const [protected], [pure virtual]
Renders an image. Pure virtual, so you gotta implement this one β it's giving "do it yourself" but make it chic.
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. That position can then be used to look up a value in an implementation-specific way, and to map it into a color.
Parameters:
- xMap β X-Scale Map
- yMap β Y-Scale Map
- area β requested area for the image in scale coordinates
- imageSize β requested size of the image
Returns: the rendered image.
Implemented in QwtPlotSpectrogram.
π void QwtPlotRasterItem::setAlpha (int alpha)
Sets 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 setAlpha() raster items can be stacked easily β layers upon layers, we love a stacked moment π
The alpha value is a value [0, 255] controlling the transparency of the image. 0 represents a fully transparent color, while 255 represents a fully opaque color.
Parameters:
- alpha β alpha value
alpha >= 0β all alpha values of the pixels returned byrenderImage()will be set to alpha, beside those with an alpha value of0(invalid pixels).alpha < 0β the alpha values returned byrenderImage()are not changed.
The default alpha value is -1.
See also: alpha()
Defined at line 510 of file qwt_plot_rasteritem.cpp.
π void QwtPlotRasterItem::setCachePolicy (QwtPlotRasterItem::CachePolicy policy)
Changes the cache policy.
The default policy is NoCache. Just so you know π
Parameters:
- policy β cache policy
See also: CachePolicy, cachePolicy()
Defined at line 543 of file qwt_plot_rasteritem.cpp.
π¦ void QwtPlotRasterItem::setPaintAttribute (PaintAttribute attribute, bool on = true)
Specifies an attribute for how to draw the raster item.
Parameters:
- attribute β paint attribute
- on β On/Off
See also: PaintAttribute, testPaintAttribute()
Defined at line 470 of file qwt_plot_rasteritem.cpp.
β bool QwtPlotRasterItem::testPaintAttribute (PaintAttribute attribute) const
Returns: True, when attribute is enabled.
See also: PaintAttribute, setPaintAttribute()
Defined at line 482 of file qwt_plot_rasteritem.cpp.
π Author π
Generated automatically by Doxygen for Qwt User's Guide from the source code. Not a human, not a vibe curator, just Doxygen doing its thing π
And that's the whole page, bestie! Every single function, every line number, every see-also β nothing dropped, periodt π
This lil' beauty came to you from the Qwt User's Guide β that's the source and version tag on the page, QwtPlotRasterItem(3) β so go be iconic with your rasters πβ¨
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms