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 is NoCache
  • enum 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, iykyk
  • enum ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 } β€” plot Item Attributes
  • enum ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 } β€” plot Item Interests
  • enum RenderHint { RenderAntialiased = 0x1 } β€” render hints
  • typedef QFlags< ItemAttribute > ItemAttributes
  • typedef QFlags< ItemInterest > ItemInterests
  • typedef QFlags< RenderHint > RenderHints

πŸŽ€ Public Member Functions πŸŽ€

  • QwtPlotRasterItem (const QString &title=QString()) β€” constructor ✨
  • QwtPlotRasterItem (const QwtText &title) β€” constructor ✨
  • virtual ~QwtPlotRasterItem () β€” destructor
  • void setPaintAttribute (PaintAttribute, bool on=true)
  • bool testPaintAttribute (PaintAttribute) const
  • void setAlpha (int alpha) β€” sets an alpha value for the raster data
  • int alpha () const
  • void setCachePolicy (CachePolicy)
  • CachePolicy cachePolicy () const
  • void invalidateCache ()
  • virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override β€” draws the raster data
  • virtual QRectF pixelHint (const QRectF &) const β€” pixel hint
  • virtual QwtInterval interval (Qt::Axis) const
  • virtual QRectF boundingRect () const override

πŸ’œ Public Member Functions inherited from QwtPlotItem πŸ’œ

  • QwtPlotItem ()
  • QwtPlotItem (const QString &title)
  • QwtPlotItem (const QwtText &title)
  • virtual ~QwtPlotItem () β€” destroys the QwtPlotItem
  • void attach (QwtPlot *plot) β€” attaches the item to a plot
  • void detach () β€” this method detaches a QwtPlotItem from any QwtPlot it has been associated with
  • QwtPlot * plot () const β€” returns the attached plot
  • void setTitle (const QString &title)
  • void setTitle (const QwtText &title)
  • const QwtText & title () const
  • virtual int rtti () const
  • void setItemAttribute (ItemAttribute, bool on=true)
  • bool testItemAttribute (ItemAttribute) const
  • void setItemInterest (ItemInterest, bool on=true)
  • bool testItemInterest (ItemInterest) const
  • void setRenderHint (RenderHint, bool on=true)
  • bool testRenderHint (RenderHint) const
  • void setRenderThreadCount (uint numThreads)
  • uint renderThreadCount () const
  • void setLegendIconSize (const QSize &)
  • QSize legendIconSize () const
  • double z () const
  • void setZ (double z) β€” sets the z value
  • void show () β€” shows the item
  • void hide () β€” hides the item
  • virtual void setVisible (bool)
  • bool isVisible () const
  • void setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
  • void setXAxis (QwtAxisId)
  • QwtAxisId xAxis () const β€” returns xAxis
  • void setYAxis (QwtAxisId)
  • QwtAxisId yAxis () const β€” returns yAxis
  • virtual 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 margin
  • virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) β€” updates the item to changes of the axes scale division
  • virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &) β€” updates the item to changes of the legend info
  • QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const β€” calculates the bounding scale rectangle of 2 maps
  • QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const β€” calculates the bounding paint rectangle of 2 maps
  • virtual QList< QwtLegendData > legendData () const β€” returns all information that is needed to represent the item on the legend
  • virtual 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: QwtPlotRasterItem is 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 repainted
  • PaintCache β€” 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 to QPainter. 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 specific QPaintEngine. 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::Horizontal means 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 by renderImage() will be set to alpha, beside those with an alpha value of 0 (invalid pixels).
  • alpha < 0 β€” the alpha values returned by renderImage() 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