r17328 by jghali - more updates to win32 printing
scribus-commit
scribus-commit at lists.scribus.net
Thu Feb 23 23:14:39 UTC 2012
Author: jghali
Date: Thu Feb 23 23:14:39 2012
New Revision: 17328
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17328
Log:
more updates to win32 printing
Modified:
trunk/Scribus/scribus/scpageoutput.cpp
trunk/Scribus/scribus/scpageoutput.h
trunk/Scribus/scribus/scpainterex_cairo.cpp
trunk/Scribus/scribus/vgradientex.cpp
Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17328&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Thu Feb 23 23:14:39 2012
@@ -21,6 +21,7 @@
#include "pageitem_pathtext.h"
#include "pageitem_polygon.h"
#include "pageitem_polyline.h"
+#include "pageitem_regularpolygon.h"
#include "pageitem_spiral.h"
#include "pageitem_textframe.h"
#include "prefsmanager.h"
@@ -232,17 +233,6 @@
if (clip.intersects(oldR))
{
drawItem( currItem, painter, clip );
- if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0)))
- {
- PageItem *nextItem = currItem;
- while (nextItem != 0)
- {
- if (nextItem->prevInChain() != 0)
- nextItem = nextItem->prevInChain();
- else
- break;
- }
- }
}
}
for (int it = 0; it < m_doc->Items->count(); ++it)
@@ -297,6 +287,8 @@
drawItem_Polygon( (PageItem_Polygon*) item, painter, clip);
else if (itemType == PageItem::PolyLine)
drawItem_PolyLine( (PageItem_PolyLine*) item, painter, clip);
+ else if (itemType == PageItem::RegularPolygon)
+ drawItem_RegularPolygon( (PageItem_RegularPolygon*) item, painter, clip);
else if (itemType == PageItem::Spiral)
drawItem_Spiral( (PageItem_Spiral*) item, painter, clip);
else if (itemType == PageItem::TextFrame)
@@ -308,10 +300,7 @@
{
painter->save();
if (!item->isEmbedded)
- {
painter->translate( item->xPos(), item->yPos());
-// painter->rotate(item->rotation());
- }
painter->rotate(item->rotation());
painter->setBlendModeFill(item->fillBlendmode());
painter->setLineWidth(item->lineWidth());
@@ -487,7 +476,7 @@
if (!item->isGroup())
{
painter->setMaskMode(0);
- if ( item->itemType() == PageItem::PathText || item->itemType() == PageItem::PolyLine || item->itemType() == PageItem::Line )
+ if (item->isGroup() || item->isLine() || item->isPathText() || item->isPolyLine() || item->isSpiral() || item->isSymbol() || item->isTable() )
doStroke = false;
if ((doStroke))
{
@@ -1575,6 +1564,12 @@
}
}
+void ScPageOutput::drawItem_RegularPolygon( PageItem_RegularPolygon* item, ScPainterExBase* painter, const QRect& clip )
+{
+ painter->setupPolygon(&item->PoLine);
+ painter->fillPath();
+}
+
void ScPageOutput::drawItem_Spiral( PageItem_Spiral* item, ScPainterExBase* painter, const QRect& clip )
{
if (item->PoLine.size() < 4)
Modified: trunk/Scribus/scribus/scpageoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17328&path=/trunk/Scribus/scribus/scpageoutput.h
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.h (original)
+++ trunk/Scribus/scribus/scpageoutput.h Thu Feb 23 23:14:39 2012
@@ -27,6 +27,7 @@
class PageItem_Polygon;
class PageItem_PolyLine;
class PageItem_Spiral;
+class PageItem_RegularPolygon;
class PageItem_TextFrame;
class ScLayer;
class ScribusDoc;
@@ -81,6 +82,7 @@
virtual void drawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, const QRect& clip );
virtual void drawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter, const QRect& clip );
virtual void drawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painte, const QRect& clip );
+ virtual void drawItem_RegularPolygon( PageItem_RegularPolygon* item, ScPainterExBase* painte, const QRect& clip );
virtual void drawItem_Spiral( PageItem_Spiral* item, ScPainterExBase* painter, const QRect& clip );
virtual void drawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, const QRect& clip );
Modified: trunk/Scribus/scribus/scpainterex_cairo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17328&path=/trunk/Scribus/scribus/scpainterex_cairo.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_cairo.cpp (original)
+++ trunk/Scribus/scribus/scpainterex_cairo.cpp Thu Feb 23 23:14:39 2012
@@ -559,37 +559,42 @@
void ScPainterEx_Cairo::setupPolygon(FPointArray *points, bool closed)
{
bool nPath = true, first = true;
- FPoint np, np1, np2, np3;
- if (points->size() > 3)
- {
- newPath();
- for (uint poi=0; poi<points->size()-3; poi += 4)
+ FPoint np, np1, np2, np3, np4, firstP;
+
+ if (points->size() <= 3)
+ return;
+
+ newPath();
+ for (uint poi=0; poi<points->size()-3; poi += 4)
+ {
+ if (points->point(poi).x() > 900000)
{
- if (points->point(poi).x() > 900000)
- {
- nPath = true;
- continue;
- }
- if (nPath)
- {
- np = points->point(poi);
- if ((!first) && (closed))
- cairo_close_path( m_cr );
- moveTo( np.x(), np.y() );
- nPath = first = false;
- }
- np = points->point(poi);
- np1 = points->point(poi+1);
- np2 = points->point(poi+3);
- np3 = points->point(poi+2);
- if ((np == np1) && (np2 == np3))
- lineTo( np3.x(), np3.y() );
- else
- curveTo(np1, np2, np3);
+ nPath = true;
+ continue;
}
- if (closed)
- cairo_close_path( m_cr );
- }
+ if (nPath)
+ {
+ np = points->point(poi);
+ if ((!first) && (closed) && (np4 == firstP))
+ cairo_close_path( m_cr );
+ moveTo( np.x(), np.y() );
+ first = nPath = false;
+ firstP = np4 = np;
+ }
+ np = points->point(poi);
+ np1 = points->point(poi + 1);
+ np2 = points->point(poi + 3);
+ np3 = points->point(poi + 2);
+ if (np4 == np3)
+ continue;
+ if ((np == np1) && (np2 == np3))
+ lineTo( np3.x(), np3.y() );
+ else
+ curveTo(np1, np2, np3);
+ np4 = np3;
+ }
+ if (closed)
+ cairo_close_path( m_cr );
}
void ScPainterEx_Cairo::drawPolygon()
@@ -655,9 +660,13 @@
if ( gradient.Stops() < 2 )
return;
- FPoint p1( gradient.origin().x(), gradient.origin().y() );
- FPoint p2( gradient.vector().x(), gradient.vector().y() );
- cairo_pattern_t *pat = cairo_pattern_create_linear (p1.x(), p1.y(), p2.x(), p2.y());
+ double x1 = gradient.origin().x();
+ double y1 = gradient.origin().y();
+ double x2 = gradient.vector().x();
+ double y2 = gradient.vector().y();
+ cairo_pattern_t *pat = cairo_pattern_create_linear (x1, y1, x2, y2);
+ cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
+ cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
bool isFirst = true;
double lastStop = 0.0;
@@ -673,6 +682,17 @@
lastStop = stop->rampPoint;
}
+ QTransform qmatrix;
+ qmatrix.translate(x1, y1);
+ qmatrix.shear(-m_gradientSkew, 0);
+ qmatrix.translate(-x1, -y1);
+
+ cairo_matrix_t matrix;
+ cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
+ cairo_matrix_invert(&matrix);
+ cairo_pattern_set_matrix (pat, &matrix);
+
+ setRasterOp(m_blendModeFill);
cairo_set_source (m_cr, pat);
//cairo_clip_preserve (m_cr);
cairo_paint_with_alpha (m_cr, m_fillTrans);
@@ -687,12 +707,17 @@
VColorStopEx* stop = NULL;
QColor color;
- FPoint pc( gradient.origin().x(), gradient.origin().y() );
- FPoint pf( gradient.focalPoint().x(), gradient.focalPoint().y() );
- FPoint pv( gradient.vector().x(), gradient.vector().y() );
- double rad = sqrt( pow(pv.x() - pc.x(), 2) + pow(pv.y() - pc.y(), 2) );
-
- cairo_pattern_t* pat = cairo_pattern_create_radial (pc.x(), pc.y(), 0.1, pc.x(), pc.y(), rad);
+ double x1 = gradient.origin().x();
+ double y1 = gradient.origin().y();
+ double x2 = gradient.vector().x();
+ double y2 = gradient.vector().y();
+ double fx = gradient.focalPoint().x();
+ double fy = gradient.focalPoint().y();
+ double rad = sqrt( pow(x2 - x1, 2) + pow(y2 - y1, 2) );
+
+ cairo_pattern_t* pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, rad);
+ cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
+ cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
bool isFirst = true;
double lastStop = 0.0;
@@ -707,9 +732,20 @@
cairo_pattern_add_color_stop_rgba (pat, stop->rampPoint, r, g, b, stop->opacity);
lastStop = stop->rampPoint;
}
+
+ QTransform qmatrix;
+ double rotEnd = xy2Deg(x2 - x1, y2 - y1);
+ qmatrix.translate(x1, y1);
+ qmatrix.rotate(rotEnd);
+ qmatrix.shear(m_gradientSkew, 0);
+ qmatrix.translate(0, y1 * (1.0 - m_gradientScale));
+ qmatrix.translate(-x1, -y1);
+ qmatrix.scale(1, m_gradientScale);
cairo_set_source (m_cr, pat);
//cairo_clip_preserve (m_cr);
+
+ setRasterOp(m_blendModeFill);
cairo_paint_with_alpha (m_cr, m_fillTrans);
cairo_pattern_destroy (pat);
}
Modified: trunk/Scribus/scribus/vgradientex.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17328&path=/trunk/Scribus/scribus/vgradientex.cpp
==============================================================================
--- trunk/Scribus/scribus/vgradientex.cpp (original)
+++ trunk/Scribus/scribus/vgradientex.cpp Thu Feb 23 23:14:39 2012
@@ -65,6 +65,7 @@
setOrigin( FPoint( 0, 0 ) );
setVector( FPoint( 0, 50 ) );
+ setFocalPoint( FPoint( 0, 0 ) );
setRepeatMethod( VGradientEx::reflect );
}
More information about the scribus-commit
mailing list