27 return QPainter::CompositionMode_SourceOver;
29 return QPainter::CompositionMode_Lighten;
31 return QPainter::CompositionMode_Screen;
33 return QPainter::CompositionMode_ColorDodge;
35 return QPainter::CompositionMode_Plus;
37 return QPainter::CompositionMode_Darken;
39 return QPainter::CompositionMode_Multiply;
41 return QPainter::CompositionMode_ColorBurn;
43 return QPainter::CompositionMode_Overlay;
45 return QPainter::CompositionMode_SoftLight;
47 return QPainter::CompositionMode_HardLight;
49 return QPainter::CompositionMode_Difference;
51 return QPainter::CompositionMode_Exclusion;
53 return QPainter::CompositionMode_Source;
55 return QPainter::CompositionMode_DestinationOver;
57 return QPainter::CompositionMode_Clear;
59 return QPainter::CompositionMode_Destination;
61 return QPainter::CompositionMode_SourceIn;
63 return QPainter::CompositionMode_DestinationIn;
65 return QPainter::CompositionMode_SourceOut;
67 return QPainter::CompositionMode_DestinationOut;
69 return QPainter::CompositionMode_SourceAtop;
71 return QPainter::CompositionMode_DestinationAtop;
73 return QPainter::CompositionMode_Xor;
76 return QPainter::CompositionMode_SourceOver;
86 case QPainter::CompositionMode_SourceOver:
88 case QPainter::CompositionMode_Lighten:
90 case QPainter::CompositionMode_Screen:
92 case QPainter::CompositionMode_ColorDodge:
94 case QPainter::CompositionMode_Plus:
96 case QPainter::CompositionMode_Darken:
98 case QPainter::CompositionMode_Multiply:
100 case QPainter::CompositionMode_ColorBurn:
102 case QPainter::CompositionMode_Overlay:
104 case QPainter::CompositionMode_SoftLight:
106 case QPainter::CompositionMode_HardLight:
108 case QPainter::CompositionMode_Difference:
110 case QPainter::CompositionMode_Exclusion:
112 case QPainter::CompositionMode_Source:
114 case QPainter::CompositionMode_DestinationOver:
116 case QPainter::CompositionMode_Clear:
118 case QPainter::CompositionMode_Destination:
120 case QPainter::CompositionMode_SourceIn:
122 case QPainter::CompositionMode_DestinationIn:
124 case QPainter::CompositionMode_SourceOut:
126 case QPainter::CompositionMode_DestinationOut:
128 case QPainter::CompositionMode_SourceAtop:
130 case QPainter::CompositionMode_DestinationAtop:
132 case QPainter::CompositionMode_Xor:
135 QgsDebugError( QStringLiteral(
"Composition mode %1 mapped to Normal" ).arg( blendMode ) );
195bool QgsPainting::drawTriangleUsingTexture( QPainter *painter,
const QPolygonF &triangle,
const QImage &textureImage,
float textureX1,
float textureY1,
float textureX2,
float textureY2,
float textureX3,
float textureY3 )
199 textureX1 * ( textureImage.width() - 1 ), textureY1 * ( textureImage.height() - 1 ),
200 textureX2 * ( textureImage.width() - 1 ), textureY2 * ( textureImage.height() - 1 ),
201 textureX3 * ( textureImage.width() - 1 ), textureY3 * ( textureImage.height() - 1 ),
202 triangle.at( 0 ).x(), triangle.at( 0 ).y(),
203 triangle.at( 1 ).x(), triangle.at( 1 ).y(),
204 triangle.at( 2 ).x(), triangle.at( 2 ).y(),
211 const QBrush previousBrush = painter->brush();
213 QBrush textureBrush( textureImage );
214 textureBrush.setTransform( brushTransform );
216 painter->setBrush( textureBrush );
217 painter->drawPolygon( triangle );
218 painter->setBrush( previousBrush );
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 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),...