r17313 by jghali - updates to win32 print engine

scribus-commit scribus-commit at lists.scribus.net
Sat Feb 18 14:02:15 UTC 2012


Author: jghali
Date: Sat Feb 18 14:02:15 2012
New Revision: 17313

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17313
Log:
updates to win32 print engine

Modified:
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scpainterex_cairo.cpp

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17313&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Sat Feb 18 14:02:15 2012
@@ -1132,18 +1132,81 @@
 
 void ScPageOutput::drawItem_Line( PageItem_Line* item, ScPainterExBase* painter, const QRect& clip )
 {
+	if (item->PoLine.size() < 4)
+		return;
+
 	int startArrowIndex = item->startArrowIndex();
 	int endArrowIndex = item->endArrowIndex();
 
 	if (item->NamedLStyle.isEmpty())
-		painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
+	{
+		QString patternStrokeVal = item->strokePattern();
+		if ((!patternStrokeVal.isEmpty()) && (m_doc->docPatterns.contains(patternStrokeVal)))
+		{
+			if (item->patternStrokePath)
+			{
+				QPainterPath guidePath = item->PoLine.toQPainterPath(false);
+				guidePath.moveTo(0, 0);
+				guidePath.lineTo(item->width(), 0);
+				drawStrokePattern(item, painter, guidePath);
+			}
+			else
+			{
+				painter->setPattern(&m_doc->docPatterns[patternStrokeVal], item->patternStrokeScaleX, item->patternStrokeScaleY, item->patternStrokeOffsetX, item->patternStrokeOffsetY, item->patternStrokeRotation, item->patternStrokeSkewX, item->patternStrokeSkewY, item->patternStrokeMirrorX, item->patternStrokeMirrorY);
+				painter->setStrokeMode(ScPainterExBase::Pattern);
+				painter->strokePath();
+			}
+		}
+		else if (item->strokeGradientType() > 0)
+		{
+			QString gradientStrokeVal = item->strokeGradient();
+			if ((!gradientStrokeVal.isEmpty()) && (!m_doc->docGradients.contains(gradientStrokeVal)))
+				gradientStrokeVal = "";
+			if (!(gradientStrokeVal.isEmpty()) && (m_doc->docGradients.contains(gradientStrokeVal)))
+				painter->m_strokeGradient = VGradientEx(m_doc->docGradients[gradientStrokeVal], *m_doc);
+			if (painter->m_strokeGradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+			{
+				if (item->lineColor() != CommonStrings::None)
+				{
+					ScColorShade strokeColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+					painter->setBrush(strokeColor);
+					painter->setStrokeMode(ScPainterExBase::Solid);
+				}
+				else
+					painter->setStrokeMode(ScPainterExBase::None);
+			}
+			else
+			{
+				FPoint fpStart(item->GrStrokeStartX, item->GrStrokeStartY);
+				FPoint fpEnd(item->GrStrokeEndX, item->GrStrokeEndY);
+				FPoint fpFocal(item->GrStrokeFocalX, item->GrStrokeFocalY);
+				painter->setStrokeMode(ScPainterExBase::Gradient);
+				painter->m_strokeGradient = VGradientEx(item->stroke_gradient, *m_doc);
+				if (item->GrTypeStroke == 6)
+					painter->setGradient(VGradientEx::linear, fpStart, fpEnd, fpStart, item->GrStrokeScale, item->GrStrokeSkew);
+				else
+					painter->setGradient(VGradientEx::radial, fpStart, fpEnd, fpFocal, item->GrStrokeScale, item->GrStrokeSkew);
+			}
+			painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
+		}
+		else if (item->lineColor() != CommonStrings::None)
+		{
+			ScColorShade scColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+			painter->setStrokeMode(ScPainterExBase::Solid);
+			painter->setPen(scColor, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
+			if (item->DashValues.count() != 0)
+				painter->setDash(item->DashValues, item->DashOffset);
+			painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0));
+		}
+	}
 	else
 	{
+		painter->setStrokeMode(ScPainterExBase::Solid);
 		multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
 		for (int it = ml.size()-1; it > -1; it--)
 		{
 			const SingleLine& sl = ml[it];
-			if (sl.Color != CommonStrings::None)
+			if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
 			{
 				ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
 				painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
@@ -1354,103 +1417,159 @@
 
 void ScPageOutput::drawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter, const QRect& clip )
 {
+	if (item->PoLine.size() < 4)
+		return;
+
 	int startArrowIndex = item->startArrowIndex();
 	int endArrowIndex = item->endArrowIndex();
 
-	if (item->PoLine.size()>=4)
-	{
-		if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
-		{
-			FPointArray cli;
-			FPoint Start;
-			bool firstp = true;
-			for (uint n = 0; n < item->PoLine.size()-3; n += 4)
-			{
-				if (firstp)
-				{
-					Start = item->PoLine.point(n);
-					firstp = false;
-				}
-				if (item->PoLine.point(n).x() > 900000)
-				{
-					cli.addPoint(item->PoLine.point(n-2));
-					cli.addPoint(item->PoLine.point(n-2));
-					cli.addPoint(Start);
-					cli.addPoint(Start);
-					cli.setMarker();
-					firstp = true;
-					continue;
-				}
-				cli.addPoint(item->PoLine.point(n));
-				cli.addPoint(item->PoLine.point(n+1));
-				cli.addPoint(item->PoLine.point(n+2));
-				cli.addPoint(item->PoLine.point(n+3));
-			}
-			if (cli.size() > 2)
-			{
-				FPoint l1 = cli.point(cli.size()-2);
-				cli.addPoint(l1);
-				cli.addPoint(l1);
+	if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
+	{
+		FPointArray cli;
+		FPoint Start;
+		bool firstp = true;
+		for (uint n = 0; n < item->PoLine.size()-3; n += 4)
+		{
+			if (firstp)
+			{
+				Start = item->PoLine.point(n);
+				firstp = false;
+			}
+			if (item->PoLine.point(n).x() > 900000)
+			{
+				cli.addPoint(item->PoLine.point(n-2));
+				cli.addPoint(item->PoLine.point(n-2));
 				cli.addPoint(Start);
 				cli.addPoint(Start);
-			}
-			painter->setupPolygon(&cli);
-			fillPath(item, painter, clip);
-		}
-		painter->setupPolygon(&item->PoLine, false);
-		if (item->NamedLStyle.isEmpty())
-		{
-			if (item->lineColor() != CommonStrings::None)
+				cli.setMarker();
+				firstp = true;
+				continue;
+			}
+			cli.addPoint(item->PoLine.point(n));
+			cli.addPoint(item->PoLine.point(n+1));
+			cli.addPoint(item->PoLine.point(n+2));
+			cli.addPoint(item->PoLine.point(n+3));
+		}
+		if (cli.size() > 2)
+		{
+			FPoint l1 = cli.point(cli.size()-2);
+			cli.addPoint(l1);
+			cli.addPoint(l1);
+			cli.addPoint(Start);
+			cli.addPoint(Start);
+		}
+		painter->setupPolygon(&cli);
+		fillPath(item, painter, clip);
+	}
+	painter->setupPolygon(&item->PoLine, false);
+	if (item->NamedLStyle.isEmpty())
+	{
+		QString patternStrokeVal = item->strokePattern();
+		if ((!patternStrokeVal.isEmpty()) && (m_doc->docPatterns.contains(patternStrokeVal)))
+		{
+			if (item->patternStrokePath)
+			{
+				QPainterPath guidePath = item->PoLine.toQPainterPath(false);
+				guidePath.moveTo(0, 0);
+				guidePath.lineTo(item->width(), 0);
+				drawStrokePattern(item, painter, guidePath);
+			}
+			else
+			{
+				painter->setPattern(&m_doc->docPatterns[patternStrokeVal], item->patternStrokeScaleX, item->patternStrokeScaleY, item->patternStrokeOffsetX, item->patternStrokeOffsetY, item->patternStrokeRotation, item->patternStrokeSkewX, item->patternStrokeSkewY, item->patternStrokeMirrorX, item->patternStrokeMirrorY);
+				painter->setStrokeMode(ScPainterExBase::Pattern);
 				painter->strokePath();
-		}
-		else
-		{
-			multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
-			for (int it = ml.size()-1; it > -1; it--)
-			{
-				const SingleLine& sl = ml[it];
-				if (sl.Color != CommonStrings::None)
+			}
+		}
+		else if (item->strokeGradientType() > 0)
+		{
+			QString gradientStrokeVal = item->strokeGradient();
+			if ((!gradientStrokeVal.isEmpty()) && (!m_doc->docGradients.contains(gradientStrokeVal)))
+				gradientStrokeVal = "";
+			if (!(gradientStrokeVal.isEmpty()) && (m_doc->docGradients.contains(gradientStrokeVal)))
+				painter->m_strokeGradient = VGradientEx(m_doc->docGradients[gradientStrokeVal], *m_doc);
+			if (painter->m_strokeGradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+			{
+				if (item->lineColor() != CommonStrings::None)
 				{
-					ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
-					painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
-							static_cast<Qt::PenCapStyle>(sl.LineEnd),
-							static_cast<Qt::PenJoinStyle>(sl.LineJoin));
-					painter->strokePath();
+					ScColorShade strokeColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+					painter->setBrush(strokeColor);
+					painter->setStrokeMode(ScPainterExBase::Solid);
 				}
-			}
-		}
-		if (startArrowIndex != 0)
-		{
-			FPoint Start = item->PoLine.point(0);
-			for (uint xx = 1; xx < item->PoLine.size(); xx += 2)
-			{
-				FPoint Vector = item->PoLine.point(xx);
-				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
-				{
-					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(Start.x(), Start.y());
-					arrowTrans.rotate(r);
-					drawArrow(painter, item, arrowTrans, startArrowIndex);
-					break;
-				}
-			}
-		}
-		if (endArrowIndex != 0)
-		{
-			FPoint End = item->PoLine.point(item->PoLine.size()-2);
-			for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2)
-			{
-				FPoint Vector = item->PoLine.point(xx);
-				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
-				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(End.x(), End.y());
-					arrowTrans.rotate(r);
-					drawArrow(painter, item, arrowTrans, endArrowIndex);
-					break;
-				}
+				else
+					painter->setStrokeMode(ScPainterExBase::None);
+			}
+			else
+			{
+				FPoint fpStart(item->GrStrokeStartX, item->GrStrokeStartY);
+				FPoint fpEnd(item->GrStrokeEndX, item->GrStrokeEndY);
+				FPoint fpFocal(item->GrStrokeFocalX, item->GrStrokeFocalY);
+				painter->setStrokeMode(ScPainterExBase::Gradient);
+				painter->m_strokeGradient = VGradientEx(item->stroke_gradient, *m_doc);
+				if (item->GrTypeStroke == 6)
+					painter->setGradient(VGradientEx::linear, fpStart, fpEnd, fpStart, item->GrStrokeScale, item->GrStrokeSkew);
+				else
+					painter->setGradient(VGradientEx::radial, fpStart, fpEnd, fpFocal, item->GrStrokeScale, item->GrStrokeSkew);
+			}
+			painter->strokePath();
+		}
+		else if (item->lineColor() != CommonStrings::None)
+		{
+			ScColorShade scColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+			painter->setStrokeMode(ScPainterExBase::Solid);
+			painter->setPen(scColor, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
+			if (item->DashValues.count() != 0)
+				painter->setDash(item->DashValues, item->DashOffset);
+			painter->strokePath();
+		}
+	}
+	else
+	{
+		multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
+		for (int it = ml.size()-1; it > -1; it--)
+		{
+			const SingleLine& sl = ml[it];
+			if (sl.Color != CommonStrings::None)
+			{
+				ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
+				painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
+						static_cast<Qt::PenCapStyle>(sl.LineEnd),
+						static_cast<Qt::PenJoinStyle>(sl.LineJoin));
+				painter->strokePath();
+			}
+		}
+	}
+	if (startArrowIndex != 0)
+	{
+		FPoint Start = item->PoLine.point(0);
+		for (uint xx = 1; xx < item->PoLine.size(); xx += 2)
+		{
+			FPoint Vector = item->PoLine.point(xx);
+			if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+			{
+				double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(Start.x(), Start.y());
+				arrowTrans.rotate(r);
+				drawArrow(painter, item, arrowTrans, startArrowIndex);
+				break;
+			}
+		}
+	}
+	if (endArrowIndex != 0)
+	{
+		FPoint End = item->PoLine.point(item->PoLine.size()-2);
+		for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2)
+		{
+			FPoint Vector = item->PoLine.point(xx);
+			if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+			{
+				double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(End.x(), End.y());
+				arrowTrans.rotate(r);
+				drawArrow(painter, item, arrowTrans, endArrowIndex);
+				break;
 			}
 		}
 	}
@@ -1458,103 +1577,159 @@
 
 void ScPageOutput::drawItem_Spiral( PageItem_Spiral* item, ScPainterExBase* painter, const QRect& clip )
 {
+	if (item->PoLine.size() < 4)
+		return;
+
 	int startArrowIndex = item->startArrowIndex();
 	int endArrowIndex = item->endArrowIndex();
 
-	if (item->PoLine.size()>=4)
-	{
-		if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
-		{
-			FPointArray cli;
-			FPoint Start;
-			bool firstp = true;
-			for (uint n = 0; n < item->PoLine.size()-3; n += 4)
-			{
-				if (firstp)
-				{
-					Start = item->PoLine.point(n);
-					firstp = false;
-				}
-				if (item->PoLine.point(n).x() > 900000)
-				{
-					cli.addPoint(item->PoLine.point(n-2));
-					cli.addPoint(item->PoLine.point(n-2));
-					cli.addPoint(Start);
-					cli.addPoint(Start);
-					cli.setMarker();
-					firstp = true;
-					continue;
-				}
-				cli.addPoint(item->PoLine.point(n));
-				cli.addPoint(item->PoLine.point(n+1));
-				cli.addPoint(item->PoLine.point(n+2));
-				cli.addPoint(item->PoLine.point(n+3));
-			}
-			if (cli.size() > 2)
-			{
-				FPoint l1 = cli.point(cli.size()-2);
-				cli.addPoint(l1);
-				cli.addPoint(l1);
+	if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
+	{
+		FPointArray cli;
+		FPoint Start;
+		bool firstp = true;
+		for (uint n = 0; n < item->PoLine.size()-3; n += 4)
+		{
+			if (firstp)
+			{
+				Start = item->PoLine.point(n);
+				firstp = false;
+			}
+			if (item->PoLine.point(n).x() > 900000)
+			{
+				cli.addPoint(item->PoLine.point(n-2));
+				cli.addPoint(item->PoLine.point(n-2));
 				cli.addPoint(Start);
 				cli.addPoint(Start);
-			}
-			painter->setupPolygon(&cli);
-			fillPath(item, painter, clip);
-		}
-		painter->setupPolygon(&item->PoLine, false);
-		if (item->NamedLStyle.isEmpty())
-		{
-			if (item->lineColor() != CommonStrings::None)
+				cli.setMarker();
+				firstp = true;
+				continue;
+			}
+			cli.addPoint(item->PoLine.point(n));
+			cli.addPoint(item->PoLine.point(n+1));
+			cli.addPoint(item->PoLine.point(n+2));
+			cli.addPoint(item->PoLine.point(n+3));
+		}
+		if (cli.size() > 2)
+		{
+			FPoint l1 = cli.point(cli.size()-2);
+			cli.addPoint(l1);
+			cli.addPoint(l1);
+			cli.addPoint(Start);
+			cli.addPoint(Start);
+		}
+		painter->setupPolygon(&cli);
+		fillPath(item, painter, clip);
+	}
+	painter->setupPolygon(&item->PoLine, false);
+	if (item->NamedLStyle.isEmpty())
+	{
+		QString patternStrokeVal = item->strokePattern();
+		if ((!patternStrokeVal.isEmpty()) && (m_doc->docPatterns.contains(patternStrokeVal)))
+		{
+			if (item->patternStrokePath)
+			{
+				QPainterPath guidePath = item->PoLine.toQPainterPath(false);
+				guidePath.moveTo(0, 0);
+				guidePath.lineTo(item->width(), 0);
+				drawStrokePattern(item, painter, guidePath);
+			}
+			else
+			{
+				painter->setPattern(&m_doc->docPatterns[patternStrokeVal], item->patternStrokeScaleX, item->patternStrokeScaleY, item->patternStrokeOffsetX, item->patternStrokeOffsetY, item->patternStrokeRotation, item->patternStrokeSkewX, item->patternStrokeSkewY, item->patternStrokeMirrorX, item->patternStrokeMirrorY);
+				painter->setStrokeMode(ScPainterExBase::Pattern);
 				painter->strokePath();
-		}
-		else
-		{
-			multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
-			for (int it = ml.size()-1; it > -1; it--)
-			{
-				const SingleLine& sl = ml[it];
-				if (sl.Color != CommonStrings::None)
+			}
+		}
+		else if (item->strokeGradientType() > 0)
+		{
+			QString gradientStrokeVal = item->strokeGradient();
+			if ((!gradientStrokeVal.isEmpty()) && (!m_doc->docGradients.contains(gradientStrokeVal)))
+				gradientStrokeVal = "";
+			if (!(gradientStrokeVal.isEmpty()) && (m_doc->docGradients.contains(gradientStrokeVal)))
+				painter->m_strokeGradient = VGradientEx(m_doc->docGradients[gradientStrokeVal], *m_doc);
+			if (painter->m_strokeGradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+			{
+				if (item->lineColor() != CommonStrings::None)
 				{
-					ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
-					painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
-							static_cast<Qt::PenCapStyle>(sl.LineEnd),
-							static_cast<Qt::PenJoinStyle>(sl.LineJoin));
-					painter->strokePath();
+					ScColorShade strokeColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+					painter->setBrush(strokeColor);
+					painter->setStrokeMode(ScPainterExBase::Solid);
 				}
-			}
-		}
-		if (startArrowIndex != 0)
-		{
-			FPoint Start = item->PoLine.point(0);
-			for (uint xx = 1; xx < item->PoLine.size(); xx += 2)
-			{
-				FPoint Vector = item->PoLine.point(xx);
-				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
-				{
-					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(Start.x(), Start.y());
-					arrowTrans.rotate(r);
-					drawArrow(painter, item, arrowTrans, startArrowIndex);
-					break;
-				}
-			}
-		}
-		if (endArrowIndex != 0)
-		{
-			FPoint End = item->PoLine.point(item->PoLine.size()-2);
-			for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2)
-			{
-				FPoint Vector = item->PoLine.point(xx);
-				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
-				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(End.x(), End.y());
-					arrowTrans.rotate(r);
-					drawArrow(painter, item, arrowTrans, endArrowIndex);
-					break;
-				}
+				else
+					painter->setStrokeMode(ScPainterExBase::None);
+			}
+			else
+			{
+				FPoint fpStart(item->GrStrokeStartX, item->GrStrokeStartY);
+				FPoint fpEnd(item->GrStrokeEndX, item->GrStrokeEndY);
+				FPoint fpFocal(item->GrStrokeFocalX, item->GrStrokeFocalY);
+				painter->setStrokeMode(ScPainterExBase::Gradient);
+				painter->m_strokeGradient = VGradientEx(item->stroke_gradient, *m_doc);
+				if (item->GrTypeStroke == 6)
+					painter->setGradient(VGradientEx::linear, fpStart, fpEnd, fpStart, item->GrStrokeScale, item->GrStrokeSkew);
+				else
+					painter->setGradient(VGradientEx::radial, fpStart, fpEnd, fpFocal, item->GrStrokeScale, item->GrStrokeSkew);
+			}
+			painter->strokePath();
+		}
+		else if (item->lineColor() != CommonStrings::None)
+		{
+			ScColorShade scColor(m_doc->PageColors[item->lineColor()], item->lineShade());
+			painter->setStrokeMode(ScPainterExBase::Solid);
+			painter->setPen(scColor, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
+			if (item->DashValues.count() != 0)
+				painter->setDash(item->DashValues, item->DashOffset);
+			painter->strokePath();
+		}
+	}
+	else
+	{
+		multiLine ml = m_doc->MLineStyles[item->NamedLStyle];
+		for (int it = ml.size()-1; it > -1; it--)
+		{
+			const SingleLine& sl = ml[it];
+			if (sl.Color != CommonStrings::None)
+			{
+				ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade);
+				painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash),
+						static_cast<Qt::PenCapStyle>(sl.LineEnd),
+						static_cast<Qt::PenJoinStyle>(sl.LineJoin));
+				painter->strokePath();
+			}
+		}
+	}
+	if (startArrowIndex != 0)
+	{
+		FPoint Start = item->PoLine.point(0);
+		for (uint xx = 1; xx < item->PoLine.size(); xx += 2)
+		{
+			FPoint Vector = item->PoLine.point(xx);
+			if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+			{
+				double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(Start.x(), Start.y());
+				arrowTrans.rotate(r);
+				drawArrow(painter, item, arrowTrans, startArrowIndex);
+				break;
+			}
+		}
+	}
+	if (endArrowIndex != 0)
+	{
+		FPoint End = item->PoLine.point(item->PoLine.size()-2);
+		for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2)
+		{
+			FPoint Vector = item->PoLine.point(xx);
+			if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+			{
+				double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(End.x(), End.y());
+				arrowTrans.rotate(r);
+				drawArrow(painter, item, arrowTrans, endArrowIndex);
+				break;
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/scpainterex_cairo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17313&path=/trunk/Scribus/scribus/scpainterex_cairo.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_cairo.cpp (original)
+++ trunk/Scribus/scribus/scpainterex_cairo.cpp Sat Feb 18 14:02:15 2012
@@ -836,10 +836,10 @@
 	QLineF edge2 = QLineF(centerP, QPointF(p2x, p2y));
 	QLineF edge3 = QLineF(centerP, QPointF(p3x, p3y));
 	QLineF edge4 = QLineF(centerP, QPointF(p4x, p4y));
-	QPointF p1 = edge1.pointAt(colorStops[colorStops.count() - 1]->rampPoint);
-	QPointF p2 = edge2.pointAt(colorStops[colorStops.count() - 1]->rampPoint);
-	QPointF p3 = edge3.pointAt(colorStops[colorStops.count() - 1]->rampPoint);
-	QPointF p4 = edge4.pointAt(colorStops[colorStops.count() - 1]->rampPoint);
+	QPointF p1 = edge1.pointAt(colorStops.last()->rampPoint);
+	QPointF p2 = edge2.pointAt(colorStops.last()->rampPoint);
+	QPointF p3 = edge3.pointAt(colorStops.last()->rampPoint);
+	QPointF p4 = edge4.pointAt(colorStops.last()->rampPoint);
 	cairo_set_source_rgba(cr, r, g, b, a);
 	cairo_paint_with_alpha(cr, 1.0);
 	cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OUT);




More information about the scribus-commit mailing list