summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 373b0de)
raw | patch | inline | side by side (parent: 373b0de)
author | ulferikson <ulferikson@users.sourceforge.net> | |
Sun, 2 Jul 2006 12:50:47 +0000 (12:50 +0000) | ||
committer | ulferikson <ulferikson@users.sourceforge.net> | |
Sun, 2 Jul 2006 12:50:47 +0000 (12:50 +0000) |
not only for those with an opacity set.
src/extension/internal/pdf.cpp | patch | blob | history |
index 0951d97f2b34006e22cc76b7b0b73948b47e41de..796e410cbfe2df2b21a30191a22b9bbbe9f83af5 100644 (file)
@@ -480,30 +480,14 @@ PrintPDF::bind(Inkscape::Extension::Print *mod, NRMatrix const *transform, float
<< transform->c[4] << " "\r
<< transform->c[5] << " cm\n";\r
\r
- if (opacity!=1.0) {\r
- float alpha = opacity * _pushed_alphas[_curr_alpha];\r
-\r
- fprintf(stderr, "bind: opacity=%f, pushed=%f, alpha=%f\n",\r
- opacity, _pushed_alphas[_curr_alpha], alpha);\r
- \r
- _curr_alpha++;\r
- if (_curr_alpha >= _num_alphas) {\r
- _num_alphas = _num_alphas*2;\r
- _pushed_alphas = (float *) realloc(_pushed_alphas, _num_alphas*sizeof(float));\r
- }\r
- _pushed_alphas[_curr_alpha] = alpha;\r
- \r
- PdfObject *pdf_alpha = pdf_file->begin_resource(pdf_extgstate);\r
- *pdf_alpha << "<< /Type /ExtGState\n";\r
- *pdf_alpha << " /ca " << alpha << "\n";\r
- *pdf_alpha << " /AIS false\n";\r
- *pdf_alpha << ">>\n";\r
- \r
- *page_stream << pdf_alpha->get_name()\r
- << " gs\n";\r
+ float alpha = opacity * _pushed_alphas[_curr_alpha];\r
\r
- pdf_file->end_resource(pdf_alpha);\r
+ _curr_alpha++;\r
+ if (_curr_alpha >= _num_alphas) {\r
+ _num_alphas = _num_alphas*2;\r
+ _pushed_alphas = (float *) realloc(_pushed_alphas, _num_alphas*sizeof(float));\r
}\r
+ _pushed_alphas[_curr_alpha] = alpha;\r
\r
return 1;\r
}\r
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.\r
if (_bitmap) return 0;\r
\r
- _curr_alpha--;\r
+ if (_curr_alpha > 0)\r
+ _curr_alpha--;\r
\r
*page_stream << "Q\n";\r
\r
@@ -542,23 +527,17 @@ PrintPDF::print_fill_alpha(SVGOStringStream &/*os*/, SPStyle const *const style,
if (style->fill.type == SP_PAINT_TYPE_COLOR) {\r
float alpha = 1.0;\r
alpha *= SP_SCALE24_TO_FLOAT(style->fill_opacity.value);\r
+ alpha *= _pushed_alphas[_curr_alpha];\r
\r
if (alpha != 1.0) {\r
PdfObject *pdf_alpha = pdf_file->begin_resource(pdf_extgstate);\r
*pdf_alpha << "<< /Type /ExtGState\n";\r
- *pdf_alpha << " /ca " << alpha*_pushed_alphas[_curr_alpha] << "\n";\r
+ *pdf_alpha << " /ca " << alpha << "\n";\r
*pdf_alpha << " /AIS false\n";\r
*pdf_alpha << ">>\n";\r
\r
*page_stream << pdf_alpha->get_name()\r
<< " gs\n";\r
- \r
- \r
- fprintf(stderr, "print_fill_alpha: opacity=%f, fill-opacity=%f, pushed_alphas=%f ==> %f\n",\r
- SP_SCALE24_TO_FLOAT(style->opacity.value),\r
- SP_SCALE24_TO_FLOAT(style->fill_opacity.value),\r
- _pushed_alphas[_curr_alpha],\r
- alpha*_pushed_alphas[_curr_alpha]);\r
\r
pdf_file->end_resource(pdf_alpha);\r
}\r
@@ -586,7 +565,7 @@ PrintPDF::print_fill_alpha(SVGOStringStream &/*os*/, SPStyle const *const style,
alpha *= lg->vector.stops[i].opacity;\r
}\r
\r
- if (alpha != 1.0) {\r
+ if (alpha != 1.0 || _pushed_alphas[_curr_alpha] != 1.0) {\r
PdfObject *pdf_gstate = pdf_file->begin_resource(pdf_extgstate);\r
*pdf_gstate << "<< /Type /ExtGState\n";\r
\r
@@ -715,7 +694,7 @@ PrintPDF::print_fill_alpha(SVGOStringStream &/*os*/, SPStyle const *const style,
alpha *= rg->vector.stops[i].opacity;\r
}\r
\r
- if (alpha != 1.0) {\r
+ if (alpha != 1.0 || _pushed_alphas[_curr_alpha] != 1.0) {\r
PdfObject *pdf_gstate = pdf_file->begin_resource(pdf_extgstate);\r
*pdf_gstate << "<< /Type /ExtGState\n";\r
\r
\r
float alpha = 1.0;\r
alpha *= SP_SCALE24_TO_FLOAT(style->stroke_opacity.value);\r
+ alpha *= _pushed_alphas[_curr_alpha];\r
\r
if (alpha != 1.0) {\r
PdfObject *pdf_alpha = pdf_file->begin_resource(pdf_extgstate);\r
*pdf_alpha << "<< /Type /ExtGState\n";\r
- *pdf_alpha << " /CA " << alpha*_pushed_alphas[_curr_alpha] << "\n";\r
+ *pdf_alpha << " /CA " << alpha << "\n";\r
*pdf_alpha << " /AIS false\n";\r
*pdf_alpha << ">>\n";\r
\r