r14285 by fschmid - Part of Bug-Nr 4293: "Improved support for gradients", added support for Qt based rendering.

scribus-commit scribus-commit at lists.scribus.net
Thu Nov 12 15:25:16 CET 2009


Revision: 14285
Author: fschmid
Date: 2009-11-12T07:04:02.839868Z
Commit message: Part of Bug-Nr 4293: "Improved support for gradients", added support for Qt based rendering.

Changeset: 
M  /trunk/Scribus/scribus/scpainter.cpp

Diffs:
Index: scribus/scpainter.cpp
===================================================================
--- scribus/scpainter.cpp	(revision 14284)
+++ scribus/scpainter.cpp	(revision 14285)
@@ -1267,6 +1267,24 @@
 				qStopColor.setAlphaF(colorStops[offset]->opacity);
 				pat.setColorAt(colorStops[ offset ]->rampPoint, qStopColor);
 			}
+			QTransform qmatrix;
+			if (fill_gradient.type() == VGradient::radial)
+			{
+				double rotEnd = xy2Deg(x2 - x1, y2 - y1);
+				qmatrix.translate(x1, y1);
+				qmatrix.rotate(rotEnd);
+				qmatrix.shear(gradientSkew, 0);
+				qmatrix.translate(0, y1 * (1.0 - gradientScale));
+				qmatrix.translate(-x1, -y1);
+				qmatrix.scale(1, gradientScale);
+			}
+			else
+			{
+				qmatrix.translate(x1, y1);
+				qmatrix.shear(-gradientSkew, 0);
+				qmatrix.translate(-x1, -y1);
+			}
+			pat.setTransform(qmatrix);
 			painter.setOpacity(fill_trans);
 			painter.fillPath(m_path, pat);
 		}
@@ -1375,6 +1393,24 @@
 				qStopColor.setAlphaF(colorStops[offset]->opacity);
 				pat.setColorAt(colorStops[ offset ]->rampPoint, qStopColor);
 			}
+			QTransform qmatrix;
+			if (stroke_gradient.type() == VGradient::radial)
+			{
+				double rotEnd = xy2Deg(x2 - x1, y2 - y1);
+				qmatrix.translate(x1, y1);
+				qmatrix.rotate(rotEnd);
+				qmatrix.shear(gradientSkew, 0);
+				qmatrix.translate(0, y1 * (1.0 - gradientScale));
+				qmatrix.translate(-x1, -y1);
+				qmatrix.scale(1, gradientScale);
+			}
+			else
+			{
+				qmatrix.translate(x1, y1);
+				qmatrix.shear(-gradientSkew, 0);
+				qmatrix.translate(-x1, -y1);
+			}
+			pat.setTransform(qmatrix);
 			painter.setOpacity(stroke_trans);
 			pen.setBrush(pat);
 		}




More information about the scribus-commit mailing list