Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 25118 → Rev 25119

/branches/Version15x/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp
536,7 → 536,7
textNode->setFillColor(CommonStrings::None);
textNode->setLineColor(CommonStrings::None);
textNode->setLineWidth(0.0);
textNode->setFillShade(m_currFillShade);
textNode->setFillShade(m_graphicStack.top().fillShade);
 
 
/* Oliver Stieber 2020-06-11 Set text matrix... This need to be done so that the global world view that we rite out glyphs to is transformed correctly by the context matrix for each glyph, possibly anyhow.
/branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
16,8 → 16,10
#include <poppler/poppler-config.h>
#include <poppler/FileSpec.h>
#include <poppler/fofi/FoFiTrueType.h>
 
#include <QApplication>
#include <QFile>
 
#include "commonstrings.h"
#include "loadsaveplugin.h"
#include "sccolorengine.h"
291,8 → 293,6
m_Elements = Elements;
pushGroup();
m_importedColors = importedColors;
m_currColorStroke = "Black";
m_currColorFill = "Black";
tmpSel = new Selection(m_doc, false);
importerFlags = flags;
currentLayer = m_doc->activeLayer();
689,23 → 689,23
if (bgCol)
{
bgFound = true;
m_currColorFill = getAnnotationColor(bgCol);
m_graphicStack.top().fillColor = getAnnotationColor(bgCol);
}
else
m_currColorFill = CommonStrings::None;
m_graphicStack.top().fillColor = CommonStrings::None;
POPPLER_CONST AnnotColor *fgCol = achar->getBorderColor();
if (fgCol)
{
fgFound = true;
m_currColorStroke = getAnnotationColor(fgCol);
m_graphicStack.top().strokeColor = getAnnotationColor(fgCol);
}
else
{
fgCol = achar->getBackColor();
if (fgCol)
m_currColorStroke = getAnnotationColor(fgCol);
m_graphicStack.top().strokeColor = getAnnotationColor(fgCol);
else
m_currColorStroke = CommonStrings::None;
m_graphicStack.top().strokeColor = CommonStrings::None;
}
}
QString m_currColorText = "Black";
724,9 → 724,9
#endif
ano->draw(gfx, false);
if (!bgFound)
m_currColorFill = annotOutDev->currColorFill;
m_graphicStack.top().fillColor = annotOutDev->currColorFill;
if (!fgFound)
m_currColorStroke = annotOutDev->currColorStroke;
m_graphicStack.top().strokeColor = annotOutDev->currColorStroke;
m_currColorText = annotOutDev->currColorText;
fontSize = annotOutDev->fontSize;
fontName = UnicodeParsedString(annotOutDev->fontName);
734,7 → 734,8
delete gfx;
delete annotOutDev;
}
int z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, xCoor, yCoor, width, height, 0, m_currColorFill, CommonStrings::None);
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::TextFrame, PageItem::Rectangle, xCoor, yCoor, width, height, 0, graphicState.fillColor, CommonStrings::None);
PageItem *ite = m_doc->Items->at(z);
int flg = annota->getFlags();
if (!(flg & 16))
766,7 → 767,7
else if (bsty == AnnotBorder::borderUnderlined)
bsty = 2;
ite->annotation().setBorderStyle(bsty);
ite->annotation().setBorderColor(m_currColorStroke);
ite->annotation().setBorderColor(graphicState.strokeColor);
ite->annotation().setBorderWidth(qRound(brd->getWidth()));
}
else
802,7 → 803,7
ite->annotation().setVis(3);
if (wtyp == Annotation::Button)
{
ite->setFillColor(m_currColorFill);
ite->setFillColor(graphicState.fillColor);
if (achar)
ite->itemText.insertChars(UnicodeParsedString(achar->getNormalCaption()));
else
1370,10 → 1371,9
m_radioMap.clear();
m_radioButtons.clear();
m_actPage = pageNum;
m_graphicStack.clear();
m_groupStack.clear();
pushGroup();
m_currentClipPath = QPainterPath();
m_clipPaths.clear();
}
 
void SlaOutputDev::endPage()
1409,7 → 1409,7
 
void SlaOutputDev::saveState(GfxState *state)
{
m_clipPaths.push(m_currentClipPath);
m_graphicStack.save();
pushGroup();
}
 
1431,7 → 1431,7
PageItem *ite = m_doc->groupObjectsSelection(tmpSel);
if (ite)
{
QPainterPath clippath = m_currentClipPath;
QPainterPath clippath = m_graphicStack.top().clipPath;
clippath.translate(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
clippath.translate(-ite->xPos(), -ite->yPos());
ite->PoLine.fromQPainterPath(clippath, true);
1479,8 → 1479,8
}
}
}
if (m_clipPaths.count() != 0)
m_currentClipPath = m_clipPaths.pop();
m_graphicStack.restore();
}
 
void SlaOutputDev::beginTransparencyGroup(GfxState *state, POPPLER_CONST_070 double *bbox, GfxColorSpace * /*blendingColorSpace*/, GBool isolated, GBool knockout, GBool forSoftMask)
1562,7 → 1562,7
ite->FrameType = 3;
if (checkClip())
{
QPainterPath clippath = m_currentClipPath;
QPainterPath clippath = m_graphicStack.top().clipPath;
clippath.translate(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
clippath.translate(-ite->xPos(), -ite->yPos());
ite->PoLine.fromQPainterPath(clippath, true);
1617,14 → 1617,16
 
void SlaOutputDev::updateFillColor(GfxState *state)
{
m_currFillShade = 100;
m_currColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &m_currFillShade);
auto& graphicState = m_graphicStack.top();
graphicState.fillShade = 100;
graphicState.fillColor = getColor(state->getFillColorSpace(), state->getFillColor(), &graphicState.fillShade);
}
 
void SlaOutputDev::updateStrokeColor(GfxState *state)
{
m_currStrokeShade = 100;
m_currColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &m_currStrokeShade);
auto& graphicState = m_graphicStack.top();
graphicState.strokeShade = 100;
graphicState.strokeColor = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &graphicState.strokeShade);
}
 
void SlaOutputDev::clip(GfxState *state)
1659,26 → 1661,29
// this information.
QPainterPath pathN = out.toQPainterPath(false);
pathN.setFillRule(fillRule);
m_currentClipPath = intersection(pathN, m_currentClipPath);
m_graphicStack.top().clipPath = intersection(pathN, m_graphicStack.top().clipPath);
}
else
m_currentClipPath = out.toQPainterPath(false);
m_graphicStack.top().clipPath = out.toQPainterPath(false);
}
 
void SlaOutputDev::stroke(GfxState *state)
{
// qDebug() << "Stroke";
const double *ctm;
ctm = state->getCTM();
const double *ctm = state->getCTM();
double xCoor = m_doc->currentPage()->xOffset();
double yCoor = m_doc->currentPage()->yOffset();
getPenState(state);
 
auto& graphicState = m_graphicStack.top();
graphicState.strokeColor = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &graphicState.strokeShade);
QString output = convertPath(state->getPath());
getPenState(state);
if ((m_Elements->count() != 0) && (output == Coords)) // Path is the same as in last fill
{
PageItem* ite = m_Elements->last();
ite->setLineColor(m_currColorStroke);
ite->setLineShade(m_currStrokeShade);
ite->setLineColor(graphicState.strokeColor);
ite->setLineShade(graphicState.strokeShade);
ite->setLineEnd(m_lineEnd);
ite->setLineJoin(m_lineJoin);
ite->setLineWidth(state->getTransformedLineWidth());
1685,22 → 1690,22
ite->setDashes(DashValues);
ite->setDashOffset(DashOffset);
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
return;
}
else
{
 
FPointArray out;
out.parseSVG(output);
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
out.map(m_ctm);
FPoint wh = out.widthHeight();
if ((out.size() > 3) && ((wh.x() != 0.0) || (wh.y() != 0.0)))
{
m_currColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &m_currStrokeShade);
if ((out.size() <= 3) || ((wh.x() <= 0.0) && (wh.y() <= 0.0)))
return;
 
int z;
if (pathIsClosed)
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, m_currColorStroke);
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, graphicState.strokeColor);
else
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, m_currColorStroke);
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, state->getTransformedLineWidth(), CommonStrings::None, graphicState.strokeColor);
PageItem* ite = m_doc->Items->at(z);
ite->PoLine = out.copy();
ite->ClipEdited = true;
1712,9 → 1717,9
PageItem* lItem = m_Elements->last();
if ((lItem->lineColor() == CommonStrings::None) && (lItem->PoLine == ite->PoLine))
{
lItem->setLineColor(m_currColorStroke);
lItem->setLineColor(graphicState.strokeColor);
lItem->setLineWidth(state->getTransformedLineWidth());
lItem->setLineShade(m_currStrokeShade);
lItem->setLineShade(graphicState.strokeShade);
lItem->setLineTransparency(1.0 - state->getStrokeOpacity());
lItem->setLineBlendmode(getBlendMode(state));
lItem->setLineEnd(m_lineEnd);
1726,7 → 1731,7
}
else
{
ite->setLineShade(m_currStrokeShade);
ite->setLineShade(graphicState.strokeShade);
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(m_lineEnd);
1741,7 → 1746,7
}
else
{
ite->setLineShade(m_currStrokeShade);
ite->setLineShade(graphicState.strokeShade);
ite->setLineTransparency(1.0 - state->getStrokeOpacity());
ite->setLineBlendmode(getBlendMode(state));
ite->setLineEnd(m_lineEnd);
1754,8 → 1759,6
m_groupStack.top().Items.append(ite);
}
}
}
}
 
void SlaOutputDev::fill(GfxState *state)
{
1781,10 → 1784,12
out.parseSVG(output);
out.map(m_ctm);
 
auto& graphicState = m_graphicStack.top();
 
// Clip the new path first and only add it if it is not empty.
QPainterPath path = out.toQPainterPath(false);
path.setFillRule(fillRule);
QPainterPath clippedPath = intersection(m_currentClipPath, path);
QPainterPath clippedPath = intersection(graphicState.clipPath, path);
 
// Undo the rotation of the clipping path as it is rotated together with the item.
double angle = m_ctm.map(QLineF(0, 0, 1, 0)).angle();
1796,17 → 1801,17
QRectF bbox = clippedPath.boundingRect();
if (!clippedPath.isEmpty() && !bbox.isNull())
{
m_currColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &m_currFillShade);
graphicState.fillColor = getColor(state->getFillColorSpace(), state->getFillColor(), &graphicState.fillShade);
int z;
if (pathIsClosed)
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, m_currColorFill, CommonStrings::None);
z = m_doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, graphicState.fillColor, CommonStrings::None);
else
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, m_currColorFill, CommonStrings::None);
z = m_doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, xCoor, yCoor, 10, 10, 0, graphicState.fillColor, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
ite->PoLine.fromQPainterPath(clippedPath, true);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setRotation(-angle);
// Only the new path has to be interpreted according to fillRule. QPainterPath
1886,7 → 1891,7
{
// Apply the clip path early to adjust the gradient vector to the
// smaller boundign box.
out = intersection(m_currentClipPath, out);
out = intersection(m_graphicStack.top().clipPath, out);
crect = out.boundingRect();
}
const double *ctm = state->getCTM();
1921,7 → 1926,9
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), bb.width(), bb.height(), 0, m_currColorFill, CommonStrings::None);
 
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), bb.width(), bb.height(), 0, graphicState.fillColor, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
if (checkClip())
{
1931,7 → 1938,7
ite->setRotation(-angle);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
2006,6 → 2013,7
QString stopColor2 = getColor(color_space, &stop2, &shade);
FillGradient.addStop( ScColorEngine::getShadeColor(m_doc->PageColors[stopColor2], m_doc, shade), 1.0, 0.5, 1.0, stopColor2, shade );
}
 
double r0, x1, y1, r1;
shading->getCoords(&GrStartX, &GrStartY, &r0, &x1, &y1, &r1);
double xmin, ymin, xmax, ymax;
2040,11 → 2048,13
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, m_currColorFill, CommonStrings::None);
 
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, graphicState.fillColor, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
if (checkClip())
{
QPainterPath out = m_currentClipPath;
QPainterPath out = graphicState.clipPath;
out.translate(m_doc->currentPage()->xOffset(), m_doc->currentPage()->yOffset());
out.translate(-ite->xPos(), -ite->yPos());
ite->PoLine.fromQPainterPath(out, true);
2052,7 → 2062,7
}
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
2102,11 → 2112,12
Coords = output;
const double *ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, m_currColorFill, CommonStrings::None);
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, graphicState.fillColor, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
2182,11 → 2193,12
Coords = output;
const double *ctm = state->getCTM();
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, m_currColorFill, CommonStrings::None);
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, graphicState.fillColor, CommonStrings::None);
PageItem* ite = m_doc->Items->at(z);
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setFillEvenOdd(false);
ite->setFillTransparency(1.0 - state->getFillOpacity());
2348,14 → 2360,14
gfx = new Gfx(pdfDoc, this, resDict, &box, nullptr);
inPattern++;
// Unset the clip path as it is unrelated to the pattern's coordinate space.
QPainterPath savedClip = m_currentClipPath;
m_currentClipPath = QPainterPath();
QPainterPath savedClip = m_graphicStack.top().clipPath;
m_graphicStack.top().clipPath = QPainterPath();
#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(21, 3, 0)
gfx->display(tPat->getContentStream());
#else
gfx->display(str);
#endif
m_currentClipPath = savedClip;
m_graphicStack.top().clipPath = savedClip;
inPattern--;
gElements = m_groupStack.pop();
m_doc->m_Selection->clear();
2410,7 → 2422,9
output += QString("Z");
pathIsClosed = true;
Coords = output;
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, m_currColorFill, CommonStrings::None);
 
const auto& graphicState = m_graphicStack.top();
int z = m_doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, xCoor + crect.x(), yCoor + crect.y(), crect.width(), crect.height(), 0, graphicState.fillColor, CommonStrings::None);
ite = m_doc->Items->at(z);
 
m_ctm = QTransform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
2418,7 → 2432,7
ite->setRotation(-angle);
if (checkClip())
{
QPainterPath outline = m_currentClipPath;
QPainterPath outline = graphicState.clipPath;
outline.translate(xCoor - ite->xPos(), yCoor - ite->yPos());
// Undo the rotation of the clipping path as it is rotated together with the item.
QTransform mm;
2429,7 → 2443,7
}
ite->ClipEdited = true;
ite->FrameType = 3;
ite->setFillShade(m_currFillShade);
ite->setFillShade(graphicState.fillShade);
ite->setLineShade(100);
ite->setFillTransparency(1.0 - state->getFillOpacity());
ite->setFillBlendmode(getBlendMode(state));
2502,7 → 2516,8
}
}
}
QColor backColor = ScColorEngine::getShadeColorProof(m_doc->PageColors[m_currColorFill], m_doc, m_currFillShade);
const auto& graphicState = m_graphicStack.top();
QColor backColor = ScColorEngine::getShadeColorProof(m_doc->PageColors[graphicState.fillColor], m_doc, graphicState.fillShade);
QImage res = QImage(width, height, QImage::Format_ARGB32);
res.fill(backColor.rgb());
unsigned char cc, cm, cy, ck;
2785,7 → 2800,7
QPainterPath outline;
outline.addRect(0, 0, 1, 1);
outline = m_ctm.map(outline);
outline = intersection(outline, m_currentClipPath);
outline = intersection(outline, m_graphicStack.top().clipPath);
 
if ((inPattern == 0) && (outline.isEmpty() || outline.boundingRect().isNull()))
return;
3450,8 → 3465,9
ite = m_doc->m_Selection->itemAt(0);
if (!f3e.colored)
{
m_doc->itemSelection_SetItemBrush(m_currColorFill);
m_doc->itemSelection_SetItemBrushShade(m_currFillShade);
const auto& graphicState = m_graphicStack.top();
m_doc->itemSelection_SetItemBrush(graphicState.fillColor);
m_doc->itemSelection_SetItemBrushShade(graphicState.fillShade);
m_doc->itemSelection_SetItemFillTransparency(1.0 - state->getFillOpacity());
m_doc->itemSelection_SetItemFillBlend(getBlendMode(state));
}
3485,7 → 3501,7
// qDebug() << "SlaOutputDev::endTextObject";
if (!m_clipTextPath.isEmpty())
{
m_currentClipPath = intersection(m_currentClipPath, m_clipTextPath);
m_graphicStack.top().clipPath = intersection(m_graphicStack.top().clipPath, m_clipTextPath);
m_clipTextPath = QPainterPath();
}
if (m_groupStack.count() != 0)
3934,9 → 3950,10
bool SlaOutputDev::checkClip()
{
bool ret = false;
if (!m_currentClipPath.isEmpty())
const auto& graphicState = m_graphicStack.top();
if (!graphicState.clipPath.isEmpty())
{
QRectF bbox = m_currentClipPath.boundingRect();
QRectF bbox = graphicState.clipPath.boundingRect();
if ((bbox.width() > 0) && (bbox.height() > 0))
ret = true;
}
3957,10 → 3974,12
if (textRenderingMode == 3)
return;
 
auto& graphicState = m_graphicStack.top();
 
// Fill text rendering modes. See above
if (textRenderingMode == 0 || textRenderingMode == 2 || textRenderingMode == 4 || textRenderingMode == 6)
{
m_currColorFill = getColor(state->getFillColorSpace(), state->getFillColor(), &m_currFillShade);
graphicState.fillColor = getColor(state->getFillColorSpace(), state->getFillColor(), &graphicState.fillShade);
if (textNode->isTextFrame())
{
textNode->setFillTransparency(1.0 - (state->getFillOpacity() > state->getStrokeOpacity() ? state->getFillOpacity() : state->getStrokeOpacity())); //fill colour sets the background colour for the frame not the fill colour fore the text
3968,12 → 3987,12
textNode->setFillColor(CommonStrings::None);
textNode->setLineColor(CommonStrings::None);
textNode->setLineWidth(0);//line width doesn't effect drawing text, it creates a bounding box state->getTransformedLineWidth());
textNode->setFillShade(m_currFillShade);
textNode->setFillShade(graphicState.fillShade);
}
else
{
textNode->setFillColor(m_currColorFill);
textNode->setFillShade(m_currFillShade);
textNode->setFillColor(graphicState.fillColor);
textNode->setFillShade(graphicState.fillShade);
textNode->setFillEvenOdd(false);
textNode->setFillTransparency(1.0 - state->getFillOpacity());
textNode->setFillBlendmode(getBlendMode(state));
3982,7 → 4001,7
// Stroke text rendering modes. See above
if (textRenderingMode == 1 || textRenderingMode == 2 || textRenderingMode == 5 || textRenderingMode == 6)
{
m_currColorStroke = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &m_currStrokeShade);
graphicState.strokeColor = getColor(state->getStrokeColorSpace(), state->getStrokeColor(), &graphicState.strokeShade);
if (textNode->isTextFrame())
{
//fill color sets the background color for the frame not the fill color fore the text
3992,16 → 4011,16
textNode->setLineColor(CommonStrings::None);
textNode->setLineWidth(0);//line width doesn't effect drawing text, it creates a bounding box state->getTransformedLineWidth());
textNode->setFillBlendmode(getBlendMode(state));
textNode->setFillShade(m_currFillShade);
textNode->setFillShade(graphicState.fillShade);
}
else
{
textNode->setLineColor(m_currColorStroke);
textNode->setLineColor(graphicState.strokeColor);
textNode->setLineWidth(0);//line width doesn't effect drawing text, it creates a bounding box state->getTransformedLineWidth());
textNode->setFillTransparency(1.0 - state->getFillOpacity() > state->getStrokeOpacity() ? state->getFillOpacity() : state->getStrokeOpacity());
textNode->setLineTransparency(1.0); // this sets the transparency of the textbox border and we don't want to see it
textNode->setLineBlendmode(getBlendMode(state));
textNode->setLineShade(m_currStrokeShade);
textNode->setLineShade(graphicState.strokeShade);
}
}
}
/branches/Version15x/Scribus/scribus/plugins/import/pdf/slaoutput.h
300,6 → 300,57
Qt::PenJoinStyle m_lineJoin { Qt::MiterJoin };
QList<PageItem*>* m_Elements;
 
class GraphicState
{
public:
QString fillColor { "Black" };
int fillShade { 100 };
QString strokeColor { "Black "};
int strokeShade { 100 };
 
// The currently visible area. If it is empty, everything is visible.
// QPainterPath has the drawback that it sometimes approximates Bezier curves
// by line segments for numerical stability. If available, a better class
// should be used. However, it is important that the used class knows which
// areas are covered and does not rely on external information about the fill
// rule to use.
QPainterPath clipPath;
};
 
class GraphicStack
{
public:
GraphicStack()
{
m_stack.push(GraphicState());
}
 
void clear()
{
m_stack.clear();
m_stack.push(GraphicState());
}
 
void save()
{
m_stack.push(m_stack.top());
}
 
void restore()
{
if (m_stack.count() > 0)
m_stack.pop();
if (m_stack.count() == 0)
m_stack.push(GraphicState());
}
 
GraphicState& top() { return m_stack.top(); }
const GraphicState& top() const { return m_stack.top(); }
 
private:
QStack<GraphicState> m_stack;
};
 
struct groupEntry
{
QList<PageItem*> Items;
312,10 → 363,7
};
 
QStack<groupEntry> m_groupStack;
QString m_currColorFill;
QString m_currColorStroke;
int m_currFillShade { 100 };
int m_currStrokeShade { 100 };
GraphicStack m_graphicStack;
 
private:
void getPenState(GfxState *state);
341,14 → 389,7
QVector<double> DashValues;
double DashOffset { 0.0 };
QString Coords;
// The currently visible area. If it is empty, everything is visible.
// QPainterPath has the drawback that it sometimes approximates Bezier curves
// by line segments for numerical stability. If available, a better class
// should be used. However, it is important that the used class knows which
// areas are covered and does not rely on external information about the fill
// rule to use.
QPainterPath m_currentClipPath;
QStack<QPainterPath> m_clipPaths;
 
// Collect the paths of character glyphs for clipping of a whole text group.
QPainterPath m_clipTextPath;