r14324 by jghali - #8592, incorrect postscript separations : fix quite some issues, now our separations looks more like Ghostscript ones
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 21 20:20:45 CET 2009
Revision: 14324
Author: jghali
Date: 2009-11-21T10:26:37.181067Z
Commit message: #8592, incorrect postscript separations : fix quite some issues, now our separations looks more like Ghostscript ones
Changeset:
M /trunk/Scribus/scribus/pslib.cpp
M /trunk/Scribus/scribus/pslib.h
Diffs:
Index: scribus/pslib.h
===================================================================
--- scribus/pslib.h (revision 14323)
+++ scribus/pslib.h (revision 14324)
@@ -114,7 +114,7 @@
virtual void PS_show(double x, double y);
virtual void PS_showSub(uint chr, QString font, double size, bool stroke);
- virtual void PS_show_xyG(QString font, uint gl, double x, double y, bool stop);
+ virtual void PS_show_xyG(QString font, uint gl, double x, double y, QString colorName, double shade);
virtual bool PS_image(PageItem *c, double x, double y, QString fn, double scalex, double scaley, QString Prof, bool UseEmbedded, bool UseProf, QString Name = "");
virtual bool PS_ImageData(PageItem *c, QString fn, QString Name, QString Prof, bool UseEmbedded, bool UseProf);
virtual void PS_plate(int nr, QString name = "");
@@ -132,6 +132,7 @@
virtual bool ProcessPageLayer(ScribusDoc* Doc, Page* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true);
virtual void drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex, bool gcr);
virtual void putColor(const QString& color, double shade, bool fill);
+ virtual void putColorNoDraw(const QString& color, double shade, bool gcr);
virtual void GetBleeds(Page* page, double& left, double& right);
virtual void GetBleeds(Page* page, double& left, double& right, double& bottom, double& top);
virtual void SetClipPath(FPointArray *c, bool poly = true);
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp (revision 14323)
+++ scribus/pslib.cpp (revision 14324)
@@ -1358,14 +1358,42 @@
PutStream("cliprestore\n");
}
-void PSLib::PS_show_xyG(QString font, uint glyph, double x, double y, bool spot)
+void PSLib::PS_show_xyG(QString font, uint glyph, double x, double y, QString colorName, double shade)
{
- QString Name;
- Name = GlyphsOfFont[font].contains(glyph) ? GlyphsOfFont[font][glyph].second : QString(".notdef");
+ QString glyphName;
+ glyphName = GlyphsOfFont[font].contains(glyph) ? GlyphsOfFont[font][glyph].second : QString(".notdef");
+
+ QString colorString;
+ ScColor& color(colorsToUse[colorName]);
+ bool spot = false;
+ if (((color.isSpotColor()) || (color.isRegistrationColor())) && (useSpotColors))
+ {
+ if (!DoSep)
+ {
+ colorString = ToStr(shade / 100.0)+" "+spotMap[colorName];
+ spot = true;
+ }
+ else if ((colorName == currentSpot) || (color.isRegistrationColor()))
+ colorString = "0 0 0 "+ToStr(shade / 100.0);
+ else
+ colorString = "0 0 0 0";
+ }
+ else
+ {
+ int c, m, y, k;
+ SetColor(color, shade, &c, &m, &y, &k, Options.doGCR);
+ if (!DoSep || (Plate == 0 || Plate == 1 || Plate == 2 || Plate == 3))
+ colorString = ToStr(c / 255.0) + " " + ToStr(m / 255.0) + " " + ToStr(y / 255.0) + " " + ToStr(k / 255.0);
+ else
+ colorString = "0 0 0 0";
+ }
if (spot)
- PutStream("/"+Name+" "+ToStr(x)+" "+ToStr(y)+" shgsp\n");
+ {
+ PutStream(colorString + "\n");
+ PutStream("/"+glyphName+" "+ToStr(x)+" "+ToStr(y)+" shgsp\n");
+ }
else
- PutStream("/"+Name+" "+ToStr(x)+" "+ToStr(y)+" "+StrokeColor+" shg\n");
+ PutStream("/"+glyphName+" "+ToStr(x)+" "+ToStr(y)+" "+colorString+" shg\n");
}
void PSLib::PS_show(double x, double y)
@@ -2680,21 +2708,11 @@
{
PS_save();
PS_translate(style.fontSize() * style.shadowXOffset() / 10000.0, style.fontSize() * style.shadowYOffset() / 10000.0);
- SetColor(style.strokeColor(), style.strokeShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[style.strokeColor()].isSpotColor()) && (!DoSep))
- PutStream(ToStr(style.strokeShade() / 100.0)+" "+spotMap[style.strokeColor()]);
- else
- PutStream(FillColor + " cmyk");
+ putColorNoDraw(style.strokeColor(), style.strokeShade(), gcr);
PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, false);
PS_restore();
}
- SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[style.fillColor()].isSpotColor()) && (!DoSep))
- PutStream(ToStr(style.fillShade() / 100.0)+" "+spotMap[style.fillColor()]);
- else
- PutStream(FillColor + " cmyk");
+ putColorNoDraw(style.fillColor(), style.fillShade(), gcr);
PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, false);
if ((style.effects() & ScStyle_Outline))
{
@@ -2702,12 +2720,7 @@
{
PS_save();
PS_setlinewidth(tsz * style.outlineWidth() / 10000.0);
- SetColor(style.strokeColor(), style.strokeShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[style.strokeColor()].isSpotColor()) && (!DoSep))
- PutStream(ToStr(style.strokeShade() / 100.0)+" "+spotMap[style.strokeColor()]);
- else
- PutStream(StrokeColor + " cmyk");
+ putColorNoDraw(style.strokeColor(), style.strokeShade(), gcr);
PS_showSub(chr, FontSubsetMap[style.font().scName()], tsz / 10.0, true);
PS_restore();
}
@@ -2843,26 +2856,10 @@
{
PS_save();
PS_translate(style.fontSize() * style.shadowXOffset() / 10000.0, style.fontSize() * style.shadowYOffset() / 10000.0);
- SetColor(style.strokeColor(), style.strokeShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[style.strokeColor()].isSpotColor()) && (!DoSep))
- {
- PutStream(ToStr(style.strokeShade() / 100.0)+" "+spotMap[style.strokeColor()]);
- PS_show_xyG(style.font().replacementName(), glyph, 0, 0, true);
- }
- else
- PS_show_xyG(style.font().replacementName(), glyph, 0, 0, false);
+ PS_show_xyG(style.font().replacementName(), glyph, 0, 0, style.strokeColor(), style.strokeShade());
PS_restore();
}
- SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[style.fillColor()].isSpotColor()) && (!DoSep))
- {
- PutStream(ToStr(style.fillShade() / 100.0)+" "+spotMap[style.fillColor()]);
- PS_show_xyG(style.font().replacementName(), glyph, 0, 0, true);
- }
- else
- PS_show_xyG(style.font().replacementName(), glyph, 0, 0, false);
+ PS_show_xyG(style.font().replacementName(), glyph, 0, 0, style.fillColor(), style.fillShade());
if ((style.effects() & ScStyle_Outline))
{
if ((style.strokeColor() != CommonStrings::None) && ((tsz * style.outlineWidth() / 10000.0) != 0))
@@ -4350,12 +4347,7 @@
}
if (cstyle.fillColor() != CommonStrings::None)
{
- SetColor(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_fill(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[cstyle.fillColor()].isSpotColor()) && (!DoSep) && (useSpotColors))
- PutStream(ToStr(cstyle.fillShade() / 100.0)+" "+spotMap[cstyle.fillColor()]);
- else
- PutStream(FillColor + " cmyk");
+ putColorNoDraw(cstyle.fillColor(), cstyle.fillShade(), gcr);
PS_showSub(glyph, FontSubsetMap[cstyle.font().scName()], tsz / 10.0, false);
}
PS_restore();
@@ -4377,15 +4369,7 @@
PS_scale(glyphs.scaleH, glyphs.scaleV);
if (cstyle.fillColor() != CommonStrings::None)
{
- SetColor(cstyle.fillColor(), cstyle.fillShade(), &h, &s, &v, &k, gcr);
- PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
- if ((colorsToUse[cstyle.fillColor()].isSpotColor()) && (!DoSep) && (useSpotColors))
- {
- PutStream(ToStr(cstyle.fillShade() / 100.0)+" "+spotMap[cstyle.fillColor()]);
- PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, true);
- }
- else
- PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, false);
+ PS_show_xyG(cstyle.font().replacementName(), glyph, 0, 0, cstyle.fillColor(), cstyle.fillShade());
}
PS_restore();
}
@@ -4502,61 +4486,88 @@
}*/
}
-void PSLib::putColor(const QString& color, double shade, bool fill)
+void PSLib::putColor(const QString& colorName, double shade, bool fill)
{
+ ScColor& color(colorsToUse[colorName]);
if (fill)
{
- if (((colorsToUse[color].isSpotColor()) || (colorsToUse[color].isRegistrationColor())) && (useSpotColors))
+ if (((color.isSpotColor()) || (color.isRegistrationColor())) && (useSpotColors))
{
if (!DoSep)
- PS_fillspot(color, shade);
+ PS_fillspot(colorName, shade);
else
{
- if ((color == currentSpot) || (colorsToUse[color].isRegistrationColor()))
+ if ((colorName == currentSpot) || (color.isRegistrationColor()))
{
if (fillRule)
PutStream("0 0 0 "+ToStr(shade / 100.0)+" cmyk eofill\n");
else
PutStream("0 0 0 "+ToStr(shade / 100.0)+" cmyk fill\n");
}
+ else
+ {
+ if (fillRule)
+ PutStream("0 0 0 0 cmyk eofill\n");
+ else
+ PutStream("0 0 0 0 cmyk fill\n");
+ }
}
}
else
{
- if (DoSep)
- {
- if ((Plate == 0) || (Plate == 1) || (Plate == 2) || (Plate == 3))
- PS_fill();
- }
+ if (!DoSep || (Plate == 0) || (Plate == 1) || (Plate == 2) || (Plate == 3))
+ PS_fill();
+ else if (fillRule)
+ PutStream("0 0 0 0 cmyk eofill\n");
else
- PS_fill();
+ PutStream("0 0 0 0 cmyk fill\n");
}
}
else
{
- if (((colorsToUse[color].isSpotColor()) || (colorsToUse[color].isRegistrationColor())) && (useSpotColors))
+ if (((color.isSpotColor()) || (color.isRegistrationColor())) && (useSpotColors))
{
if (!DoSep)
- PS_strokespot(color, shade);
+ PS_strokespot(colorName, shade);
else
{
- if ((color == currentSpot) || (colorsToUse[color].isRegistrationColor()))
+ if ((colorName == currentSpot) || (color.isRegistrationColor()))
PutStream("0 0 0 "+ToStr(shade / 100.0)+" cmyk st\n");
}
}
else
{
- if (DoSep)
- {
- if ((Plate == 0) || (Plate == 1) || (Plate == 2) || (Plate == 3))
- PS_stroke();
- }
+ if (!DoSep || (Plate == 0) || (Plate == 1) || (Plate == 2) || (Plate == 3))
+ PS_stroke();
else
- PS_stroke();
+ PutStream("0 0 0 0 cmyk st\n");
}
}
}
+void PSLib::putColorNoDraw(const QString& colorName, double shade, bool gcr)
+{
+ ScColor& color(colorsToUse[colorName]);
+ if (((color.isSpotColor()) || (color.isRegistrationColor())) && (useSpotColors))
+ {
+ if (!DoSep)
+ PutStream(ToStr(shade / 100.0)+" "+spotMap[colorName] + "\n");
+ else if ((colorName == currentSpot) || (color.isRegistrationColor()))
+ PutStream("0 0 0 "+ToStr(shade / 100.0)+" cmyk\n");
+ else
+ PutStream("0 0 0 0 cmyk\n");
+ }
+ else
+ {
+ int c, m, y, k;
+ SetColor(color, shade, &c, &m, &y, &k, gcr);
+ if (!DoSep || (Plate == 0 || Plate == 1 || Plate == 2 || Plate == 3))
+ PutStream(ToStr(c / 255.0) + " " + ToStr(m / 255.0) + " " + ToStr(y / 255.0) + " " + ToStr(k / 255.0) + " cmyk\n");
+ else
+ PutStream("0 0 0 0 cmyk\n");
+ }
+}
+
void PSLib::GetBleeds(Page* page, double& left, double& right)
{
MarginStruct values;
More information about the scribus-commit
mailing list