|
QGIS API Documentation 4.3.0-Master (0cef2469b72)
|
Rasterizes and caches a QPicture as a QImage at a requested size. More...
#include <qgspicturerasterizer.h>

Signals | |
| void | rendered () |
| Emitted when a background rasterization finishes and a new cached image is available. | |
Public Member Functions | |
| QgsPictureRasterizer (QObject *parent=nullptr) | |
| Constructor for QgsPictureRasterizer, with the specified parent object. | |
| ~QgsPictureRasterizer () override | |
| void | clear () |
| Clears the source picture and cached image, canceling any in-progress background render. | |
| QImage | image (const QSize &targetSize) |
| Immediately returns the best available QImage for the given targetSize. | |
| void | invalidate () |
| Immediately invalidates the current cached image. | |
| bool | isRendering () const |
Returns true if a background job is currently running or scheduled. | |
| int | maxCacheSize () const |
| Returns the maximum width or height (in pixels) of the cached QImage. | |
| QPicture | picture () const |
| Returns the current source QPicture. | |
| void | setMaxCacheSize (int maxSize) |
| Sets the maximum width or height (in pixels) of the cached QImage. | |
| void | setPicture (const QPicture &picture) |
| Sets the source picture to cache. | |
Rasterizes and caches a QPicture as a QImage at a requested size.
Allows for background asynchronous regeneration of the cached image at a different size.
This class is useful for generating pre-rendered versions of QPictures for rendering on the main GUI thread, where those pictures are too expensive to draw directly.
Definition at line 69 of file qgspicturerasterizer.h.
|
explicit |
Constructor for QgsPictureRasterizer, with the specified parent object.
Definition at line 98 of file qgspicturerasterizer.cpp.
|
override |
Definition at line 106 of file qgspicturerasterizer.cpp.
| void QgsPictureRasterizer::clear | ( | ) |
Clears the source picture and cached image, canceling any in-progress background render.
Definition at line 128 of file qgspicturerasterizer.cpp.
| QImage QgsPictureRasterizer::image | ( | const QSize & | targetSize | ) |
Immediately returns the best available QImage for the given targetSize.
This method never blocks. If no cached image exists for the specified targetSize or the cache has been invalidated then the previously cached image is returned, and a background render at the desired targetSize will be started.
Definition at line 148 of file qgspicturerasterizer.cpp.
| void QgsPictureRasterizer::invalidate | ( | ) |
Immediately invalidates the current cached image.
Definition at line 139 of file qgspicturerasterizer.cpp.
| bool QgsPictureRasterizer::isRendering | ( | ) | const |
Returns true if a background job is currently running or scheduled.
Definition at line 177 of file qgspicturerasterizer.cpp.
|
inline |
Returns the maximum width or height (in pixels) of the cached QImage.
Definition at line 130 of file qgspicturerasterizer.h.
|
inline |
Returns the current source QPicture.
Definition at line 92 of file qgspicturerasterizer.h.
|
signal |
Emitted when a background rasterization finishes and a new cached image is available.
| void QgsPictureRasterizer::setMaxCacheSize | ( | int | maxSize | ) |
Sets the maximum width or height (in pixels) of the cached QImage.
Definition at line 182 of file qgspicturerasterizer.cpp.
| void QgsPictureRasterizer::setPicture | ( | const QPicture & | picture | ) |
Sets the source picture to cache.
Definition at line 112 of file qgspicturerasterizer.cpp.