QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QgsPainting Class Reference

Contains miscellaneous painting utility functions. More...

#include <qgspainting.h>

Static Public Member Functions

static void applyScaleFixForQPictureDpi (QPainter *painter)
 Applies a workaround to a painter to avoid an issue with incorrect scaling when drawing QPictures.
 
static void drawPicture (QPainter *painter, const QPointF &point, const QPicture &picture)
 Draws a picture onto a painter, correctly applying workarounds to avoid issues with incorrect scaling.
 
static bool drawTriangleUsingTexture (QPainter *painter, const QPolygonF &triangle, const QImage &textureImage, float textureX1, float textureY1, float textureX2, float textureY2, float textureX3, float textureY3)
 Draws a triangle onto a painter using a mapped texture image.
 
static Qgis::BlendMode getBlendModeEnum (QPainter::CompositionMode blendMode)
 Returns a Qgis::BlendMode corresponding to a QPainter::CompositionMode.
 
static QPainter::CompositionMode getCompositionMode (Qgis::BlendMode blendMode)
 Returns a QPainter::CompositionMode corresponding to a Qgis::BlendMode.
 
static bool isClippingMode (Qgis::BlendMode mode)
 Returns true if mode is a clipping blend mode.
 
static int qtDefaultDpiX ()
 Returns the default Qt horizontal DPI.
 
static int qtDefaultDpiY ()
 Returns the default Qt vertical DPI.
 
static QTransform triangleToTriangleTransform (double inX1, double inY1, double inX2, double inY2, double inX3, double inY3, double outX1, double outY1, double outX2, double outY2, double outX3, double outY3, bool &ok)
 Calculates the QTransform which maps the triangle defined by the points (inX1, inY1), (inY2, inY2), (inX3, inY3) to the triangle defined by (outX1, outY1), (outY2, outY2), (outX3, outY3).
 

Detailed Description

Contains miscellaneous painting utility functions.

Definition at line 31 of file qgspainting.h.

Member Function Documentation

◆ applyScaleFixForQPictureDpi()

void QgsPainting::applyScaleFixForQPictureDpi ( QPainter *  painter)
static

Applies a workaround to a painter to avoid an issue with incorrect scaling when drawing QPictures.

Note
This is a low-level method, which alters the painter state and relies on the caller saving/restoring painter state accordingly. Consider using the high-level drawPicture() method instead.
See also
drawPicture()
Since
QGIS 3.40

Definition at line 236 of file qgspainting.cpp.

◆ drawPicture()

void QgsPainting::drawPicture ( QPainter *  painter,
const QPointF &  point,
const QPicture &  picture 
)
static

Draws a picture onto a painter, correctly applying workarounds to avoid issues with incorrect scaling.

See also
applyScaleFixForQPictureDpi()
Since
QGIS 3.40

Definition at line 246 of file qgspainting.cpp.

◆ drawTriangleUsingTexture()

bool QgsPainting::drawTriangleUsingTexture ( QPainter *  painter,
const QPolygonF &  triangle,
const QImage &  textureImage,
float  textureX1,
float  textureY1,
float  textureX2,
float  textureY2,
float  textureX3,
float  textureY3 
)
static

Draws a triangle onto a painter using a mapped texture image.

The triangle will be rendered using the portion of the texture image described by the triangle (textureX1, textureY1), (textureX2, textureY2), (textureX3, textureY3). Texture coordinates should be in the range 0-1 (as a fraction of the image size), where (0, 0) coorresponds to the top-left of the texture image.

The caller must ensure that triangle is a closed QPolygonF consisting of 4 vertices (the 3 triangle vertices + the first vertex again to close the polygon).

Returns true if the triangle could be rendered, or false if it could not (e.g. when the described points are co-linear).

Since
QGIS 3.34

Definition at line 198 of file qgspainting.cpp.

◆ getBlendModeEnum()

Qgis::BlendMode QgsPainting::getBlendModeEnum ( QPainter::CompositionMode  blendMode)
static

Returns a Qgis::BlendMode corresponding to a QPainter::CompositionMode.

See also
getCompositionMode()

Definition at line 84 of file qgspainting.cpp.

◆ getCompositionMode()

QPainter::CompositionMode QgsPainting::getCompositionMode ( Qgis::BlendMode  blendMode)
static

Returns a QPainter::CompositionMode corresponding to a Qgis::BlendMode.

See also
getBlendModeEnum

Definition at line 24 of file qgspainting.cpp.

◆ isClippingMode()

bool QgsPainting::isClippingMode ( Qgis::BlendMode  mode)
static

Returns true if mode is a clipping blend mode.

Since
QGIS 3.30

Definition at line 143 of file qgspainting.cpp.

◆ qtDefaultDpiX()

int QgsPainting::qtDefaultDpiX ( )
static

Returns the default Qt horizontal DPI.

Note
This method proxies the internal Qt qt_defaultDpiX() function.
See also
qtDefaultDpiY()
Since
QGIS 3.40

Definition at line 226 of file qgspainting.cpp.

◆ qtDefaultDpiY()

int QgsPainting::qtDefaultDpiY ( )
static

Returns the default Qt vertical DPI.

Note
This method proxies the internal Qt qt_defaultDpiY() function.
See also
qtDefaultDpiX()
Since
QGIS 3.40

Definition at line 231 of file qgspainting.cpp.

◆ triangleToTriangleTransform()

QTransform QgsPainting::triangleToTriangleTransform ( double  inX1,
double  inY1,
double  inX2,
double  inY2,
double  inX3,
double  inY3,
double  outX1,
double  outY1,
double  outX2,
double  outY2,
double  outX3,
double  outY3,
bool &  ok 
)
static

Calculates the QTransform which maps the triangle defined by the points (inX1, inY1), (inY2, inY2), (inX3, inY3) to the triangle defined by (outX1, outY1), (outY2, outY2), (outX3, outY3).

Parameters
inX1source triangle vertex 1 x-coordinate
inY1source triangle vertex 1 y-coordinate
inX2source triangle vertex 2 x-coordinate
inY2source triangle vertex 2 y-coordinate
inX3source triangle vertex 3 x-coordinate
inY3source triangle vertex 3 y-coordinate
outX1destination triangle vertex 1 x-coordinate
outY1destination triangle vertex 1 y-coordinate
outX2destination triangle vertex 2 x-coordinate
outY2destination triangle vertex 2 y-coordinate
outX3destination triangle vertex 3 x-coordinate
outY3destination triangle vertex 3 y-coordinate
okwill be set to true if the transform could be determined.
Returns
Calculated transform (if possible)
Since
QGIS 3.34

Definition at line 178 of file qgspainting.cpp.


The documentation for this class was generated from the following files: