Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 18772 → Rev 18771

/trunk/Scribus/scribus/ui/propertiespalette_shadow.cpp
File deleted
/trunk/Scribus/scribus/ui/propertiespalette_shadowbase.ui
File deleted
/trunk/Scribus/scribus/ui/propertiespalette_shadow.h
File deleted
/trunk/Scribus/scribus/ui/propertiespalette.cpp
41,7 → 41,6
#include "propertiespalette_group.h"
#include "propertiespalette_image.h"
#include "propertiespalette_line.h"
#include "propertiespalette_shadow.h"
#include "propertiespalette_shape.h"
#include "propertiespalette_table.h"
#include "propertiespalette_text.h"
92,9 → 91,6
xyzPal = new PropertiesPalette_XYZ( this );
idXYZItem = TabStack->addItem( xyzPal, "X, Y, &Z" );
 
shadowPal = new PropertiesPalette_Shadow( this );
idShadowItem = TabStack->addItem( shadowPal, "Soft Shadow" );
 
shapePal = new PropertiesPalette_Shape( this );
idShapeItem = TabStack->addItem( shapePal, "&Shape" );
 
136,7 → 132,7
connect(Tpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
 
m_haveItem = false;
for (int ws = 1; ws < 10; ++ws)
for (int ws = 1; ws < 9; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->setCurrentIndex(0);
TabStack->widget(0)->setEnabled(false);
169,7 → 165,6
move(p2);
 
this->xyzPal->setMainWindow(mw);
this->shadowPal->setMainWindow(mw);
this->shapePal->setMainWindow(mw);
this->groupPal->setMainWindow(mw);
this->imagePal->setMainWindow(mw);
233,7 → 228,6
m_haveItem = false;
 
xyzPal->setDoc(m_doc);
shadowPal->setDoc(m_doc);
shapePal->setDoc(m_doc);
groupPal->setDoc(m_doc);
imagePal->setDoc(m_doc);
265,8 → 259,6
 
xyzPal->unsetItem();
xyzPal->unsetDoc();
shadowPal->unsetItem();
shadowPal->unsetDoc();
shapePal->unsetItem();
shapePal->unsetDoc();
groupPal->unsetItem();
398,7 → 390,6
if ((m_item->isGroup()) && (!m_item->isSingleSel))
{
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idGroupItem, true);
TabStack->setItemEnabled(idLineItem, false);
434,7 → 425,6
if (m_item->asOSGFrame())
{
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idGroupItem, false);
TabStack->setItemEnabled(idLineItem, false);
448,7 → 438,6
if (m_item->asSymbolFrame())
{
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idGroupItem, true);
TabStack->setItemEnabled(idLineItem, false);
471,11 → 460,10
PageItem* currItem = currentItemFromSelection();
if (m_doc->m_Selection->count() > 1)
{
for (int ws = 1; ws < 10; ++ws)
for (int ws = 1; ws < 9; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(true);
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idLineItem, true);
TabStack->setItemEnabled(idColorsItem, true);
TabStack->setItemEnabled(idTransparencyItem, true);
501,7 → 489,7
{
case -1:
m_haveItem = false;
for (int ws = 1; ws < 10; ++ws)
for (int ws = 1; ws < 9; ++ws)
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(false);
TabStack->setItemEnabled(idXYZItem, false);
513,7 → 501,6
if (currItem->asOSGFrame())
{
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idGroupItem, false);
TabStack->setItemEnabled(idLineItem, false);
531,7 → 518,6
}
break;
case PageItem::TextFrame:
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, true);
TabStack->setItemEnabled(idImageItem, false);
538,7 → 524,6
TabStack->setItemEnabled(idLineItem, true);
break;
case PageItem::Line:
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
549,7 → 534,6
case PageItem::Polygon:
case PageItem::RegularPolygon:
case PageItem::Arc:
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
557,7 → 541,6
break;
case PageItem::PolyLine:
case PageItem::Spiral:
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
564,7 → 547,6
TabStack->setItemEnabled(idLineItem, true);
break;
case PageItem::PathText:
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, true);
TabStack->setItemEnabled(idImageItem, false);
572,7 → 554,6
break;
case PageItem::Symbol:
case PageItem::Group:
TabStack->setItemEnabled(idShadowItem, false);
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
583,7 → 564,6
break;
case PageItem::Table:
TabStack->setItemEnabled(idTableItem, true);
TabStack->setItemEnabled(idShadowItem, true);
TabStack->setItemEnabled(idShapeItem, true);
TabStack->setItemEnabled(idTextItem, m_doc->appMode == modeEditTable);
TabStack->setItemEnabled(idImageItem, false);
617,7 → 597,6
m_unitIndex = m_doc->unitIndex();
 
xyzPal->unitChange();
shadowPal->unitChange();
shapePal->unitChange();
groupPal->unitChange();
imagePal->unitChange();
881,7 → 860,6
tablePal->updateColorList();
Cpal->updateColorList();
Tpal->updateColorList();
shadowPal->updateColorList();
 
assert (m_doc->PageColors.document());
}
911,7 → 889,6
TabStack->setItemText(idXYZItem, tr("X, Y, &Z"));
TabStack->setItemText(idTextItem, tr("&Text"));
TabStack->setItemText(idImageItem, tr("&Image"));
TabStack->setItemText(idShadowItem, tr("Soft Shadow"));
TabStack->setItemText(idShapeItem, tr("&Shape"));
TabStack->setItemText(idLineItem, tr("&Line"));
TabStack->setItemText(idColorsItem, tr("&Colors"));
920,7 → 897,6
TabStack->setItemText(idTableItem, tr("T&able"));
 
xyzPal->languageChange();
shadowPal->languageChange();
shapePal->languageChange();
groupPal->languageChange();
imagePal->languageChange();
/trunk/Scribus/scribus/ui/propertiespalette.h
36,7 → 36,6
class PropertiesPalette_Group;
class PropertiesPalette_Image;
class PropertiesPalette_Line;
class PropertiesPalette_Shadow;
class PropertiesPalette_Shape;
class PropertiesPalette_Table;
class PropertiesPalette_Text;
75,7 → 74,6
PropertiesPalette_Group* groupPal;
PropertiesPalette_Image* imagePal;
PropertiesPalette_Line* linePal;
PropertiesPalette_Shadow* shadowPal;
PropertiesPalette_Shape* shapePal;
PropertiesPalette_Table* tablePal;
PropertiesPalette_Text* textPal;
138,7 → 136,6
int idColorsItem;
int idTransparencyItem;
int idGroupItem;
int idShadowItem;
};
 
#endif
/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
1448,30 → 1448,6
groupStack.top().Items.append(nite);
groupStack.top().Items.append(ite);
}
/*
double xof = 0.0;
double yof = 0.0;
if (m_style["draw:shadow-offset-x"])
xof = valueAsPoint(m_style["draw:shadow-offset-x"]);
if (m_style["draw:shadow-offset-y"])
yof = valueAsPoint(m_style["draw:shadow-offset-y"]);
QString shadowColor = CurrColorFill;
double shadowTrans = 1.0;
if (m_style["draw:shadow-color"])
{
shadowColor = parseColor(QString(m_style["draw:shadow-color"]->getStr().cstr()));
if(m_style["draw:shadow-opacity"])
shadowTrans = 1.0 - qMin(1.0, qMax(fromPercentage(QString(m_style["draw:shadow-opacity"]->getStr().cstr())), 0.0));
}
ite->setHasSoftShadow(true);
ite->setSoftShadowColor(shadowColor);
ite->setSoftShadowXOffset(xof);
ite->setSoftShadowYOffset(yof);
ite->setSoftShadowBlurRadius(5);
ite->setSoftShadowShade(100);
ite->setSoftShadowOpacity(shadowTrans);
ite->setSoftShadowBlendMode(0);
*/
}
}
 
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
2721,17 → 2721,6
docu.writeAttribute("TransBlend", item->fillBlendmode());
if (item->lineBlendmode() != 0)
docu.writeAttribute("TransBlendS", item->lineBlendmode());
if (item->hasSoftShadow())
{
docu.writeAttribute("HASSOFTSHADOW",item->hasSoftShadow() ? 1 : 0);
docu.writeAttribute("SOFTSHADOWXOFFSET",item->softShadowXOffset());
docu.writeAttribute("SOFTSHADOWYOFFSET",item->softShadowYOffset());
docu.writeAttribute("SOFTSHADOWCOLOR",item->softShadowColor());
docu.writeAttribute("SOFTSHADOWBLURRADIUS",item->softShadowBlurRadius());
docu.writeAttribute("SOFTSHADOWSHADE",item->softShadowShade());
docu.writeAttribute("SOFTSHADOWBLENDMODE",item->softShadowBlendMode());
docu.writeAttribute("SOFTSHADOWOPACITY",item->softShadowOpacity());
}
 
if (item->isTable())
{
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
5235,15 → 5235,6
else
currItem->inlineCharID = -1;
 
currItem->setHasSoftShadow(attrs.valueAsBool("HASSOFTSHADOW", false));
currItem->setSoftShadowXOffset(attrs.valueAsDouble("SOFTSHADOWXOFFSET", 5.0));
currItem->setSoftShadowYOffset(attrs.valueAsDouble("SOFTSHADOWYOFFSET", 5.0));
currItem->setSoftShadowColor(attrs.valueAsString("SOFTSHADOWCOLOR", CommonStrings::None));
currItem->setSoftShadowShade(attrs.valueAsInt("SOFTSHADOWSHADE", 100));
currItem->setSoftShadowBlurRadius(attrs.valueAsDouble("SOFTSHADOWBLURRADIUS", 5.0));
currItem->setSoftShadowBlendMode(attrs.valueAsInt("SOFTSHADOWBLENDMODE", 0));
currItem->setSoftShadowOpacity(attrs.valueAsDouble("SOFTSHADOWOPACITY", 1.0));
 
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
return currItem;
/trunk/Scribus/scribus/plugins/xpsexport/xpsexplugin.cpp
517,12 → 517,12
path.lineTo(0, bounds.height());
path.closeSubpath();
QTransform mpx;
// if (Item->rotation() != 0.0)
// {
// mpx.translate(xOffset * conversionFactor, yOffset * conversionFactor);
// mpx.rotate(Item->rotation());
// mpx.translate(-xOffset * conversionFactor, -yOffset * conversionFactor);
// }
if (Item->rotation() != 0.0)
{
mpx.translate(xOffset * conversionFactor, yOffset * conversionFactor);
mpx.rotate(Item->rotation());
mpx.translate(-xOffset * conversionFactor, -yOffset * conversionFactor);
}
QTransform mpp;
mpp.translate((Item->visualXPos() - m_Doc->currentPage()->xOffset()) * conversionFactor, (Item->visualYPos() - m_Doc->currentPage()->yOffset()) * conversionFactor);
mpp.scale(conversionFactor, conversionFactor);
535,8 → 535,8
else
pa.prepend("F 1 ");
ob.setAttribute("Data", pa);
// if (Item->rotation() != 0.0)
// ob.setAttribute("RenderTransform", MatrixToStr(mpx));
if (Item->rotation() != 0.0)
ob.setAttribute("RenderTransform", MatrixToStr(mpx));
QDomElement obf = p_docu.createElement("Path.Fill");
QDomElement gr = p_docu.createElement("ImageBrush");
double maxSize = qMax(Item->visualWidth(), Item->visualHeight());
2771,8 → 2771,6
ret = true;
if (Item->lineBlendmode() != 0)
ret = true;
if (Item->hasSoftShadow())
ret = true;
return ret;
}
 
/trunk/Scribus/scribus/CMakeLists.txt
138,7 → 138,6
ui/propertiespalette_groupbase.ui
ui/propertiespalette_imagebase.ui
ui/propertiespalette_linebase.ui
ui/propertiespalette_shadowbase.ui
ui/propertiespalette_shapebase.ui
ui/propertiespalette_tablebase.ui
ui/propertiespalette_textbase.ui
405,7 → 404,6
ui/propertiespalette_group.h
ui/propertiespalette_image.h
ui/propertiespalette_line.h
ui/propertiespalette_shadow.h
ui/propertiespalette_shape.h
ui/propertiespalette_table.h
ui/propertiespalette_text.h
852,7 → 850,6
ui/propertiespalette_image.cpp
ui/propertiespalette_group.cpp
ui/propertiespalette_line.cpp
ui/propertiespalette_shadow.cpp
ui/propertiespalette_shape.cpp
ui/propertiespalette_table.cpp
ui/propertiespalette_text.cpp
/trunk/Scribus/scribus/scribusdoc.h
1046,8 → 1046,6
void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0);
void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0);
 
void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend);
 
void itemSelection_SetLineWidth(double w);
void itemSelection_SetLineArt(Qt::PenStyle w);
void itemSelection_SetLineJoin(Qt::PenJoinStyle w);
/trunk/Scribus/scribus/scribusdoc.cpp
7750,33 → 7750,6
}
}
 
void ScribusDoc::itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend)
{
if (color == CommonStrings::tr_NoneColor)
color = CommonStrings::None;
uint selectedItemCount = m_Selection->count();
if (selectedItemCount != 0)
{
for (uint a = 0; a < selectedItemCount; ++a)
{
PageItem *currItem = m_Selection->itemAt(a);
currItem->setHasSoftShadow(has);
currItem->setSoftShadowColor(color);
currItem->setSoftShadowXOffset(dx);
currItem->setSoftShadowYOffset(dy);
currItem->setSoftShadowBlurRadius(radius);
currItem->setSoftShadowShade(shade);
currItem->setSoftShadowOpacity(opac);
currItem->setSoftShadowBlendMode(blend);
QRectF newRect = currItem->getVisualBoundingRect().adjusted(-dx, -dy, dx, dy);
currItem->invalidateLayout();
regionsChanged()->update(newRect);
}
}
changed();
 
}
 
void ScribusDoc::itemSelection_SetLineWidth(double w)
{
uint selectedItemCount=m_Selection->count();
/trunk/Scribus/scribus/pdflib_core.cpp
3445,130 → 3445,6
return retString;
}
 
QString PDFLibCore::PDF_PutSoftShadow(PageItem* ite, const ScPage *pag)
{
if (Options.Version < PDFOptions::PDFVersion_14 || !ite->hasSoftShadow() || ite->softShadowColor() == CommonStrings::None || !ite->printEnabled())
return "";
QString tmp("q\n");
double softShadowDPI = Options.Resolution;
int pixelRadius = qRound(ite->softShadowBlurRadius() / 72.0 * softShadowDPI);
tmp += "1 0 0 1 ";
tmp += FToStr(ite->softShadowXOffset() - ite->softShadowBlurRadius())+" ";
tmp += FToStr(-ite->softShadowYOffset() - ite->softShadowBlurRadius())+" cm\n";
tmp += "1 0 0 1 0 " + FToStr(-(ite->height() + ite->visualLineWidth()))+" cm\n";
tmp += FToStr(ite->width() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius()) + " 0 0 " + FToStr(ite->height() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius())+" 0 0 cm\n" ;
 
double savRot = ite->rotation();
ite->setRotation(0, true);
double maxSize = qMax(ite->visualWidth(), ite->visualHeight());
maxSize = qMin(3000.0, maxSize * (softShadowDPI / 72.0));
bool savedShadow = ite->hasSoftShadow();
ite->setHasSoftShadow(false);
QImage imgC = ite->DrawObj_toImage(maxSize);
ite->setRotation(savRot, true);
ite->setHasSoftShadow(savedShadow);
 
imgC = imgC.copy(-pixelRadius,-pixelRadius,imgC.width()+2*pixelRadius,imgC.height()+2*pixelRadius); // Add border
ScImage img = imgC.alphaChannel().convertToFormat(QImage::Format_RGB32);
 
ImageEffect eff;
ScImageEffectList el;
eff.effectCode = ScImage::EF_BLUR;
eff.effectParameters = QString("%1 1.0").arg(pixelRadius);
el.append(eff);
img.applyEffect(el,ite->doc()->PageColors,false);
 
uint maskObj = newObject();
StartObj(maskObj);
PutDoc("<<\n/Type /XObject\n/Subtype /Image\n");
PutDoc("/Width "+QString::number(img.width())+"\n");
PutDoc("/Height "+QString::number(img.height())+"\n");
PutDoc("/ColorSpace /DeviceGray\n");
PutDoc("/BitsPerComponent 8\n");
uint lengthObj = newObject();
PutDoc("/Length "+QString::number(lengthObj)+" 0 R\n");
PutDoc("/Filter /FlateDecode\n");
PutDoc(">>\nstream\n");
int bytesWritten = WriteFlateImageToStream(img, maskObj, ColorSpaceGray, false);
PutDoc("\nendstream\nendobj\n");
StartObj(lengthObj);
PutDoc(QString(" %1\n").arg(bytesWritten));
PutDoc("endobj\n");
 
uint colObj = newObject();
StartObj(colObj);
PutDoc("<<\n/Type /XObject\n/Subtype /Image\n");
PutDoc("/Width 1\n");
PutDoc("/Height 1\n");
PutDoc("/Interpolate false\n");
PutDoc("/BitsPerComponent 8\n");
PutDoc("/SMask "+QString::number(maskObj)+" 0 R\n");
 
ScImage col(1,1);
QString colstr = SetColor(ite->softShadowColor(), ite->softShadowShade());
if (Options.isGrayscale)
{
double gf;
int g;
QTextStream ts(&colstr, QIODevice::ReadOnly);
ts >> gf;
g = round(gf*255);
col.imgInfo.colorspace = ColorSpaceGray;
col.qImagePtr()->setPixel(0,0,qRgba(g,g,g,255));
PutDoc("/ColorSpace /DeviceGray\n");
PutDoc("/Length 1\n");
PutDoc(">>\nstream\n");
WriteImageToStream(col, colObj, ColorSpaceGray, true);
PutDoc("\nendstream\nendobj\n");
}
else if (Options.UseRGB)
{
double r,g,b;
QTextStream ts(&colstr, QIODevice::ReadOnly);
ts >> r;
ts >> g;
ts >> b;
col.imgInfo.colorspace = ColorSpaceRGB;
col.qImagePtr()->setPixel(0,0,qRgba(round(r*255),round(g*255),round(b*255),255));
PutDoc("/ColorSpace /DeviceRGB\n");
PutDoc("/Length 3\n");
PutDoc(">>\nstream\n");
WriteImageToStream(col, colObj, ColorSpaceRGB, false);
PutDoc("\nendstream\nendobj\n");
}
else //CMYK
{
double c,m,y,k;
QTextStream ts(&colstr, QIODevice::ReadOnly);
ts >> c;
ts >> m;
ts >> y;
ts >> k;
col.imgInfo.colorspace = ColorSpaceCMYK;
col.qImagePtr()->setPixel(0,0,qRgba(round(c*255),round(m*255),round(y*255),round(k*255)));
PutDoc("/ColorSpace /DeviceCMYK\n");
PutDoc("/Length 4\n");
PutDoc(">>\nstream\n");
WriteImageToStream(col, colObj, ColorSpaceCMYK, false);
PutDoc("\nendstream\nendobj\n");
}
 
QString colRes = ResNam+QString::number(ResCount);
Seite.ImgObjects[colRes] = colObj;
ResCount++;
 
QString ShName = ResNam+QString::number(ResCount);
ResCount++;
Transpar[ShName] = writeGState("/ca "+FToStr(1.0 - ite->softShadowOpacity())+"\n"
+ "/AIS false\n/OPM 1\n"
+ "/BM /" + blendMode(ite->softShadowBlendMode()) + "\n");
 
tmp += "/"+ShName+" gs\n";
 
tmp += "/"+colRes+" Do Q\n";
return tmp;
}
 
/**
* Fill this.output with the QString representation of the item.
* Checks if the item can be represented in the chosen PDF version, based on some of its caracteristics
3706,7 → 3582,6
sr = 0;
tmp += FToStr(cr)+" "+FToStr(sr)+" "+FToStr(-sr)+" "+FToStr(cr)+" 0 0 cm\n";
}
tmp += PDF_PutSoftShadow(ite,pag);
switch (ite->itemType())
{
case PageItem::ImageFrame:
/trunk/Scribus/scribus/pdflib_core.h
154,7 → 154,6
QByteArray ComputeMD5(const QString& in);
QByteArray ComputeRC4Key(int ObjNum);
 
QString PDF_PutSoftShadow(PageItem* ite, const ScPage* pag);
bool PDF_ProcessItem(QString& output, PageItem* ite, const ScPage* pag, uint PNr, bool embedded = false, bool pattern = false);
void PDF_Bookmark(PageItem *currItem, double ypos);
bool PDF_PatternFillStroke(QString& output, PageItem *currItem, int kind = 0, bool forArrow = false);
/trunk/Scribus/scribus/pageitem.cpp
193,14 → 193,6
fill_gradient(other.fill_gradient),
fillRule(other.fillRule),
doOverprint(other.doOverprint),
m_hasSoftShadow(other.m_hasSoftShadow),
m_softShadowColor(other.m_softShadowColor),
m_softShadowShade(other.m_softShadowShade),
m_softShadowBlurRadius(other.m_softShadowBlurRadius),
m_softShadowXOffset(other.m_softShadowXOffset),
m_softShadowYOffset(other.m_softShadowYOffset),
m_softShadowOpacity(other.m_softShadowOpacity),
m_softShadowBlendMode(other.m_softShadowBlendMode),
LeftLink(other.LeftLink),
RightLink(other.RightLink),
TopLink(other.TopLink),
832,15 → 824,6
}
isInlineImage = false;
isTempFile = false;
 
m_hasSoftShadow = false;
m_softShadowColor = "Black";
m_softShadowShade = 100;
m_softShadowBlurRadius = 5.0;
m_softShadowXOffset = 5.0;
m_softShadowYOffset = 5.0;
m_softShadowOpacity = 0.0;
m_softShadowBlendMode = 0;
}
 
PageItem::~PageItem()
1650,8 → 1633,6
{
if (!isGroup())
{
if (hasSoftShadow())
DrawSoftShadow(p);
p->setBlendModeFill(fillBlendmode());
p->setLineWidth(lwCorr);
if (GrType != 0)
2192,39 → 2173,6
p->newPath();
}
 
void PageItem::DrawSoftShadow(ScPainter *p)
{
if (m_softShadowColor == CommonStrings::None)
return;
if ((itemType() == PathText) || (itemType() == Symbol) || (itemType() == Group) || (itemType() == Line) || (itemType() == PolyLine) || (itemType() == Spiral))
return;
double lwCorr = m_lineWidth;
double sc = p->zoomFactor();
if ((m_lineWidth * sc) < 1)
lwCorr = 0;
const ScColor& col = m_Doc->PageColors[m_softShadowColor];
QColor tmp = ScColorEngine::getShadeColorProof(col, m_Doc, m_softShadowShade);
if (m_Doc->viewAsPreview)
{
VisionDefectColor defect;
tmp = defect.convertDefect(tmp, m_Doc->previewVisual);
}
p->save();
FPointArray sh = PoLine.copy();
sh.translate(m_softShadowXOffset, m_softShadowYOffset);
p->beginLayer(1.0 - m_softShadowOpacity, m_softShadowBlendMode);
p->setupPolygon(&sh);
p->setBrush(tmp);
p->setFillMode(ScPainter::Solid);
p->setStrokeMode(ScPainter::Solid);
p->setPen(tmp, lwCorr, PLineArt, PLineEnd, PLineJoin);
p->fillPath();
p->strokePath();
p->blurAlpha(m_softShadowBlurRadius);
p->endLayer();
p->restore();
}
 
QImage PageItem::DrawObj_toImage(double maxSize)
{
bool isEmbedded_Old = isEmbedded;
/trunk/Scribus/scribus/scpainter.cpp
1953,345 → 1953,45
closePath();
setBrush(light);
fillPath();
}
 
void ScPainter::blurAlpha(int radius)
{
if (radius < 1)
return;
cairo_surface_t *data = cairo_get_group_target(m_cr);
QRgb *pix = (QRgb*)cairo_image_surface_get_data(data);
int w = cairo_image_surface_get_width(data);
int h = cairo_image_surface_get_height(data);
int wm = w-1;
int hm = h-1;
int wh = w*h;
int div = radius+radius+1;
int *a = new int[wh];
int asum, x, y, i, yp, yi, yw;
QRgb p;
int *vmin = new int[qMax(w,h)];
int divsum = (div+1)>>1;
divsum *= divsum;
int *dv = new int[256*divsum];
for (i=0; i < 256*divsum; ++i)
/*
setStrokeMode(1);
setLineWidth(1.2);
if (sunken)
setPen(shade, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
else
setPen(light, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
int x1, y1, x2, y2, x3, y3;
x1 = r.x();
x2 = r.x();
x3 = r.x() + r.width();
y1 = r.y() + r.height();
y2 = r.y();
y3 = r.y();
for (int i = 0; i < lineWidth; i++)
{
dv[i] = (i/divsum);
newPath();
moveTo(x1++, y1--);
lineTo(x2++, y2++);
lineTo(x3--, y3++);
strokePath();
}
yw = yi = 0;
int **stack = new int*[div];
for(int i = 0; i < div; ++i)
if (sunken)
setPen(light, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
else
setPen(shade, 1.2, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
x1 = r.x();
x2 = r.x() + r.width();
x3 = r.x() + r.width();
y1 = r.y() + r.height();
y2 = r.y() + r.height();
y3 = r.y();
for (int i = 0; i < lineWidth; i++)
{
stack[i] = new int[1];
}
int stackpointer;
int stackstart;
int *sir;
int rbs;
int r1 = radius+1;
int aoutsum;
int ainsum;
for (y = 0; y < h; ++y)
{
ainsum = aoutsum = asum = 0;
for(i =- radius; i <= radius; ++i)
{
p = pix[yi+qMin(wm,qMax(i,0))];
sir = stack[i+radius];
sir[0] = qAlpha(p);
rbs = r1-abs(i);
asum += sir[0]*rbs;
if (i > 0)
ainsum += sir[0];
else
aoutsum += sir[0];
}
stackpointer = radius;
for (x=0; x < w; ++x)
{
a[yi] = dv[asum];
asum -= aoutsum;
stackstart = stackpointer-radius+div;
sir = stack[stackstart%div];
aoutsum -= sir[0];
if (y == 0)
vmin[x] = qMin(x+radius+1,wm);
p = pix[yw+vmin[x]];
sir[0] = qAlpha(p);
ainsum += sir[0];
asum += ainsum;
stackpointer = (stackpointer+1)%div;
sir = stack[(stackpointer)%div];
aoutsum += sir[0];
ainsum -= sir[0];
++yi;
}
yw += w;
}
for (x=0; x < w; ++x)
{
ainsum = aoutsum = asum = 0;
yp =- radius * w;
for(i=-radius; i <= radius; ++i)
{
yi=qMax(0,yp)+x;
sir = stack[i+radius];
sir[0] = a[yi];
rbs = r1-abs(i);
asum += a[yi]*rbs;
if (i > 0)
ainsum += sir[0];
else
aoutsum += sir[0];
if (i < hm)
{
yp += w;
}
}
yi = x;
stackpointer = radius;
for (y=0; y < h; ++y)
{
pix[yi] = qRgba(qRed(pix[yi]), qGreen(pix[yi]), qBlue(pix[yi]), dv[asum]);
asum -= aoutsum;
stackstart = stackpointer-radius+div;
sir = stack[stackstart%div];
aoutsum -= sir[0];
if (x==0)
{
vmin[y] = qMin(y+r1,hm)*w;
}
p = x+vmin[y];
sir[0] = a[p];
ainsum += sir[0];
asum += ainsum;
stackpointer = (stackpointer+1)%div;
sir = stack[stackpointer];
aoutsum += sir[0];
ainsum -= sir[0];
yi += w;
}
}
delete [] a;
delete [] vmin;
delete [] dv;
for(int i = 0; i < div; ++i)
{
delete [] stack[i];
}
delete [] stack;
cairo_surface_mark_dirty(data);
newPath();
moveTo(x1++, y1--);
lineTo(x2--, y2--);
lineTo(x3--, y3++);
strokePath();
} */
}
 
void ScPainter::blur(int radius)
{
if (radius < 1)
return;
cairo_surface_t *data = cairo_get_group_target(m_cr);
QRgb *pix = (QRgb*)cairo_image_surface_get_data(data);
int w = cairo_image_surface_get_width(data);
int h = cairo_image_surface_get_height(data);
int wm = w-1;
int hm = h-1;
int wh = w*h;
int div = radius+radius+1;
int *r = new int[wh];
int *g = new int[wh];
int *b = new int[wh];
int *a = new int[wh];
int rsum, gsum, bsum, asum, x, y, i, yp, yi, yw;
QRgb p;
int *vmin = new int[qMax(w,h)];
int divsum = (div+1)>>1;
divsum *= divsum;
int *dv = new int[256*divsum];
for (i=0; i < 256*divsum; ++i)
{
dv[i] = (i/divsum);
}
yw = yi = 0;
int **stack = new int*[div];
for(int i = 0; i < div; ++i)
{
stack[i] = new int[4];
}
int stackpointer;
int stackstart;
int *sir;
int rbs;
int r1 = radius+1;
int routsum, goutsum, boutsum, aoutsum;
int rinsum, ginsum, binsum, ainsum;
for (y = 0; y < h; ++y)
{
rinsum = ginsum = binsum = ainsum = routsum = goutsum = boutsum = aoutsum = rsum = gsum = bsum = asum = 0;
for(i =- radius; i <= radius; ++i)
{
p = pix[yi+qMin(wm,qMax(i,0))];
sir = stack[i+radius];
sir[0] = qRed(p);
sir[1] = qGreen(p);
sir[2] = qBlue(p);
sir[3] = qAlpha(p);
rbs = r1-abs(i);
rsum += sir[0]*rbs;
gsum += sir[1]*rbs;
bsum += sir[2]*rbs;
asum += sir[3]*rbs;
if (i > 0)
{
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
ainsum += sir[3];
}
else
{
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
aoutsum += sir[3];
}
}
stackpointer = radius;
for (x=0; x < w; ++x)
{
r[yi] = dv[rsum];
g[yi] = dv[gsum];
b[yi] = dv[bsum];
a[yi] = dv[asum];
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
asum -= aoutsum;
stackstart = stackpointer-radius+div;
sir = stack[stackstart%div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
aoutsum -= sir[3];
if (y == 0)
{
vmin[x] = qMin(x+radius+1,wm);
}
p = pix[yw+vmin[x]];
sir[0] = qRed(p);
sir[1] = qGreen(p);
sir[2] = qBlue(p);
sir[3] = qAlpha(p);
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
ainsum += sir[3];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
asum += ainsum;
stackpointer = (stackpointer+1)%div;
sir = stack[(stackpointer)%div];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
aoutsum += sir[3];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
ainsum -= sir[3];
++yi;
}
yw += w;
}
for (x=0; x < w; ++x)
{
rinsum = ginsum = binsum = ainsum = routsum = goutsum = boutsum = aoutsum = rsum = gsum = bsum = asum = 0;
yp =- radius * w;
for(i=-radius; i <= radius; ++i)
{
yi=qMax(0,yp)+x;
sir = stack[i+radius];
sir[0] = r[yi];
sir[1] = g[yi];
sir[2] = b[yi];
sir[3] = a[yi];
rbs = r1-abs(i);
rsum += r[yi]*rbs;
gsum += g[yi]*rbs;
bsum += b[yi]*rbs;
asum += a[yi]*rbs;
if (i > 0)
{
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
ainsum += sir[3];
}
else
{
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
aoutsum += sir[3];
}
if (i < hm)
{
yp += w;
}
}
yi = x;
stackpointer = radius;
for (y=0; y < h; ++y)
{
pix[yi] = qRgba(dv[rsum], dv[gsum], dv[bsum], dv[asum]);
rsum -= routsum;
gsum -= goutsum;
bsum -= boutsum;
asum -= aoutsum;
stackstart = stackpointer-radius+div;
sir = stack[stackstart%div];
routsum -= sir[0];
goutsum -= sir[1];
boutsum -= sir[2];
aoutsum -= sir[3];
if (x==0)
{
vmin[y] = qMin(y+r1,hm)*w;
}
p = x+vmin[y];
sir[0] = r[p];
sir[1] = g[p];
sir[2] = b[p];
sir[3] = a[p];
rinsum += sir[0];
ginsum += sir[1];
binsum += sir[2];
ainsum += sir[3];
rsum += rinsum;
gsum += ginsum;
bsum += binsum;
asum += ainsum;
stackpointer = (stackpointer+1)%div;
sir = stack[stackpointer];
routsum += sir[0];
goutsum += sir[1];
boutsum += sir[2];
aoutsum += sir[3];
rinsum -= sir[0];
ginsum -= sir[1];
binsum -= sir[2];
ainsum -= sir[3];
yi += w;
}
}
delete [] r;
delete [] g;
delete [] b;
delete [] a;
delete [] vmin;
delete [] dv;
for(int i = 0; i < div; ++i)
{
delete [] stack[i];
}
delete [] stack;
cairo_surface_mark_dirty(data);
}
/trunk/Scribus/scribus/scpainter.h
96,8 → 96,6
virtual void drawText(QRectF area, QString text, bool filled = true, int align = 0);
virtual void drawShadeCircle(const QRectF &re, const QColor color, bool sunken, int lineWidth);
virtual void drawShadePanel(const QRectF &r, const QColor color, bool sunken, int lineWidth);
virtual void blurAlpha(int radius);
virtual void blur(int radius);
 
// pen + brush
virtual QColor pen();
/trunk/Scribus/scribus/documentchecker.cpp
153,7 → 153,7
itemError.clear();
if (((currItem->isAnnotation()) || (currItem->isBookmark)) && (checkerSettings.checkAnnotations))
itemError.insert(PDFAnnotField, 0);
if ((currItem->hasSoftShadow() || (currItem->fillTransparency() != 0.0) || (currItem->lineTransparency() != 0.0) || (currItem->fillBlendmode() != 0) || (currItem->lineBlendmode() != 0)) && (checkerSettings.checkTransparency))
if (((currItem->fillTransparency() != 0.0) || (currItem->lineTransparency() != 0.0) || (currItem->fillBlendmode() != 0) || (currItem->lineBlendmode() != 0)) && (checkerSettings.checkTransparency))
itemError.insert(Transparency, 0);
if ((currItem->GrType != 0) && (checkerSettings.checkTransparency))
{
444,7 → 444,7
if (!(currDoc->layerPrintable(currItem->LayerID)) && (checkerSettings.ignoreOffLayers))
continue;
itemError.clear();
if ((currItem->hasSoftShadow() || (currItem->fillTransparency() != 0.0) || (currItem->lineTransparency() != 0.0) || (currItem->fillBlendmode() != 0) || (currItem->lineBlendmode() != 0)) && (checkerSettings.checkTransparency))
if (((currItem->fillTransparency() != 0.0) || (currItem->lineTransparency() != 0.0) || (currItem->fillBlendmode() != 0) || (currItem->lineBlendmode() != 0)) && (checkerSettings.checkTransparency))
itemError.insert(Transparency, 0);
if ((currItem->GrType != 0) && (checkerSettings.checkTransparency))
{
/trunk/Scribus/scribus/pageitem.h
261,7 → 261,6
QImage DrawObj_toImage(QList<PageItem*> &emG, double scaling);
void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
void DrawStrokePattern(ScPainter *p, QPainterPath &path);
void DrawSoftShadow(ScPainter *p);
/**
* @brief Set or get the redraw bounding box of the item, moved from the View
*/
645,31 → 644,6
bool overprint() const { return doOverprint; }
void setOverprint(bool val);
 
// soft shadow
void setHasSoftShadow(bool val) { m_hasSoftShadow = val; }
bool hasSoftShadow() { return m_hasSoftShadow; }
 
void setSoftShadowColor(const QString &newColor) { m_softShadowColor = newColor; }
QString softShadowColor() { return m_softShadowColor; }
 
void setSoftShadowShade(int val) { m_softShadowShade = val; }
int softShadowShade() { return m_softShadowShade; }
 
void setSoftShadowBlurRadius(double val) { m_softShadowBlurRadius = val; }
double softShadowBlurRadius() { return m_softShadowBlurRadius; }
 
void setSoftShadowXOffset(double val) { m_softShadowXOffset = val; }
double softShadowXOffset() { return m_softShadowXOffset; }
 
void setSoftShadowYOffset(double val) { m_softShadowYOffset = val; }
double softShadowYOffset() { return m_softShadowYOffset; }
 
void setSoftShadowOpacity(double val) { m_softShadowOpacity = val; }
double softShadowOpacity() { return m_softShadowOpacity; }
 
void setSoftShadowBlendMode(int val) { m_softShadowBlendMode = val; }
double softShadowBlendMode() { return m_softShadowBlendMode; }
 
int frameType() const { return FrameType; } ///< rect / oval / round / other
void setFrameType(int val) { FrameType = val; }
//
1281,14 → 1255,6
VGradient fill_gradient;
bool fillRule;
bool doOverprint;
bool m_hasSoftShadow;
QString m_softShadowColor;
int m_softShadowShade;
double m_softShadowBlurRadius;
double m_softShadowXOffset;
double m_softShadowYOffset;
double m_softShadowOpacity;
int m_softShadowBlendMode;
/* Additions for Table Support */
/* now deprecated with the new PageItem_Table */
PageItem* LeftLink;