QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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 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. More...
 
static Qgis::BlendMode getBlendModeEnum (QPainter::CompositionMode blendMode)
 Returns a Qgis::BlendMode corresponding to a QPainter::CompositionMode. More...
 
static QPainter::CompositionMode getCompositionMode (Qgis::BlendMode blendMode)
 Returns a QPainter::CompositionMode corresponding to a Qgis::BlendMode. More...
 
static bool isClippingMode (Qgis::BlendMode mode)
 Returns true if mode is a clipping blend mode. More...
 
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). More...
 

Detailed Description

Contains miscellaneous painting utility functions.

Definition at line 31 of file qgspainting.h.

Member Function Documentation

◆ 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 195 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 81 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 21 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 140 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 175 of file qgspainting.cpp.


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