summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/cairo-render-context.cpp4
-rw-r--r--src/extension/internal/cairo-render-context.h2
-rw-r--r--src/extension/internal/emf-inout.cpp58
-rw-r--r--src/extension/internal/wmf-inout.cpp60
4 files changed, 64 insertions, 60 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index a1e5b91a8..4d02ec3e3 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -765,7 +765,7 @@ void CairoRenderContext::tagEnd(){
void
-CairoRenderContext::addClipPath(Geom::PathVector const &pv, SPIEnum const *fill_rule)
+CairoRenderContext::addClipPath(Geom::PathVector const &pv, SPIEnum<SPWindRule> const *fill_rule)
{
g_assert( _is_valid );
@@ -1837,7 +1837,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma
}
if (style->mix_blend_mode.set && style->mix_blend_mode.value) {
- cairo_set_operator(_cr, (cairo_operator_t)style->mix_blend_mode.value);
+ cairo_set_operator(_cr, ink_css_blend_to_cairo_operator(style->mix_blend_mode.value));
}
// Text never has markers
diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h
index 1ff5ddeec..12918e66b 100644
--- a/src/extension/internal/cairo-render-context.h
+++ b/src/extension/internal/cairo-render-context.h
@@ -156,7 +156,7 @@ public:
Geom::Affine getParentTransform() const;
/* Clipping methods */
- void addClipPath(Geom::PathVector const &pv, SPIEnum const *fill_rule);
+ void addClipPath(Geom::PathVector const &pv, SPIEnum<SPWindRule> const *fill_rule);
void addClippingRect(double x, double y, double width, double height);
/* Rendering methods */
diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp
index 4be021e9e..27c9cc181 100644
--- a/src/extension/internal/emf-inout.cpp
+++ b/src/extension/internal/emf-inout.cpp
@@ -903,7 +903,7 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType)
snprintf(
tmp, 1023,
"fill-rule:%s;",
- (d->dc[d->level].style.fill_rule.value == 0 ? "evenodd" : "nonzero")
+ (d->dc[d->level].style.fill_rule.value == SP_WIND_RULE_NONZERO ? "evenodd" : "nonzero")
);
tmp_style << tmp;
tmp_style << "fill-opacity:1;";
@@ -958,17 +958,17 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType)
tmp_style << "stroke-linecap:" <<
(
- d->dc[d->level].style.stroke_linecap.computed == 0 ? "butt" :
- d->dc[d->level].style.stroke_linecap.computed == 1 ? "round" :
- d->dc[d->level].style.stroke_linecap.computed == 2 ? "square" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_BUTT ? "butt" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_ROUND ? "round" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_SQUARE ? "square" :
"unknown"
) << ";";
tmp_style << "stroke-linejoin:" <<
(
- d->dc[d->level].style.stroke_linejoin.computed == 0 ? "miter" :
- d->dc[d->level].style.stroke_linejoin.computed == 1 ? "round" :
- d->dc[d->level].style.stroke_linejoin.computed == 2 ? "bevel" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_MITER ? "miter" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_ROUND ? "round" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_BEVEL ? "bevel" :
"unknown"
) << ";";
@@ -1114,30 +1114,30 @@ Emf::select_pen(PEMF_CALLBACK_DATA d, int index)
d->dc[d->level].style.stroke_dasharray.values.push_back(spilength);
}
- d->dc[d->level].style.stroke_dasharray.set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = true;
break;
}
case U_PS_SOLID:
default:
{
- d->dc[d->level].style.stroke_dasharray.set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = false;
break;
}
}
switch (pEmr->lopn.lopnStyle & U_PS_ENDCAP_MASK) {
- case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = 1; break; }
- case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = 2; break; }
+ case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_ROUND; break; }
+ case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE; break; }
case U_PS_ENDCAP_FLAT:
- default: { d->dc[d->level].style.stroke_linecap.computed = 0; break; }
+ default: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_BUTT; break; }
}
switch (pEmr->lopn.lopnStyle & U_PS_JOIN_MASK) {
- case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = 2; break; }
- case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = 0; break; }
+ case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_BEVEL; break; }
+ case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER; break; }
case U_PS_JOIN_ROUND:
- default: { d->dc[d->level].style.stroke_linejoin.computed = 1; break; }
+ default: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_ROUND; break; }
}
d->dc[d->level].stroke_set = true;
@@ -1191,9 +1191,9 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
double dash_length = pix_to_abs_size( d, pEmr->elp.elpStyleEntry[i] );
d->dc[d->level].style.stroke_dasharray.values.emplace_back("temp", dash_length);
}
- d->dc[d->level].style.stroke_dasharray.set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = true;
} else {
- d->dc[d->level].style.stroke_dasharray.set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = false;
}
break;
}
@@ -1228,7 +1228,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
d->dc[d->level].style.stroke_dasharray.values.push_back(spilength);
}
- d->dc[d->level].style.stroke_dasharray.set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = true;
break;
}
case U_PS_SOLID:
@@ -1240,7 +1240,7 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
*/
default:
{
- d->dc[d->level].style.stroke_dasharray.set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = false;
break;
}
}
@@ -1248,18 +1248,18 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
switch (pEmr->elp.elpPenStyle & U_PS_ENDCAP_MASK) {
case U_PS_ENDCAP_ROUND:
{
- d->dc[d->level].style.stroke_linecap.computed = 1;
+ d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_ROUND;
break;
}
case U_PS_ENDCAP_SQUARE:
{
- d->dc[d->level].style.stroke_linecap.computed = 2;
+ d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE;
break;
}
case U_PS_ENDCAP_FLAT:
default:
{
- d->dc[d->level].style.stroke_linecap.computed = 0;
+ d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_BUTT;
break;
}
}
@@ -1267,18 +1267,18 @@ Emf::select_extpen(PEMF_CALLBACK_DATA d, int index)
switch (pEmr->elp.elpPenStyle & U_PS_JOIN_MASK) {
case U_PS_JOIN_BEVEL:
{
- d->dc[d->level].style.stroke_linejoin.computed = 2;
+ d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_BEVEL;
break;
}
case U_PS_JOIN_MITER:
{
- d->dc[d->level].style.stroke_linejoin.computed = 0;
+ d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER;
break;
}
case U_PS_JOIN_ROUND:
default:
{
- d->dc[d->level].style.stroke_linejoin.computed = 1;
+ d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_ROUND;
break;
}
}
@@ -1431,7 +1431,7 @@ Emf::select_font(PEMF_CALLBACK_DATA d, int index)
pEmr->elfw.elfLogFont.lfWeight == U_FW_BOLD ? SP_CSS_FONT_WEIGHT_BOLD :
pEmr->elfw.elfLogFont.lfWeight == U_FW_EXTRALIGHT ? SP_CSS_FONT_WEIGHT_LIGHTER :
pEmr->elfw.elfLogFont.lfWeight == U_FW_EXTRABOLD ? SP_CSS_FONT_WEIGHT_BOLDER :
- U_FW_NORMAL;
+ SP_CSS_FONT_WEIGHT_NORMAL;
d->dc[d->level].style.font_style.value = (pEmr->elfw.elfLogFont.lfItalic ? SP_CSS_FONT_STYLE_ITALIC : SP_CSS_FONT_STYLE_NORMAL);
d->dc[d->level].style.text_decoration_line.underline = pEmr->elfw.elfLogFont.lfUnderline;
d->dc[d->level].style.text_decoration_line.line_through = pEmr->elfw.elfLogFont.lfStrikeOut;
@@ -2199,7 +2199,9 @@ std::cout << "BEFORE DRAW"
PU_EMRSETPOLYFILLMODE pEmr = (PU_EMRSETPOLYFILLMODE) lpEMFR;
d->dc[d->level].style.fill_rule.value =
- (pEmr->iMode == U_ALTERNATE ? 0 : (pEmr->iMode == U_WINDING ? 1 : 0));
+ (pEmr->iMode == U_ALTERNATE
+ ? SP_WIND_RULE_NONZERO
+ : (pEmr->iMode == U_WINDING ? SP_WIND_RULE_INTERSECT : SP_WIND_RULE_NONZERO));
break;
}
case U_EMR_SETROP2:
@@ -2542,7 +2544,7 @@ std::cout << "BEFORE DRAW"
case U_WHITE_PEN:
{
float val = index == U_BLACK_PEN ? 0 : 1;
- d->dc[d->level].style.stroke_dasharray.set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = false;
d->dc[d->level].style.stroke_width.value = 1.0;
d->dc[d->level].style.stroke.value.color.set( val, val, val );
diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp
index f62c41d44..b8c5d6341 100644
--- a/src/extension/internal/wmf-inout.cpp
+++ b/src/extension/internal/wmf-inout.cpp
@@ -808,7 +808,7 @@ Wmf::output_style(PWMF_CALLBACK_DATA d)
snprintf(
tmp, 1023,
"fill-rule:%s;",
- (d->dc[d->level].style.fill_rule.value == 0 ? "evenodd" : "nonzero")
+ (d->dc[d->level].style.fill_rule.value == SP_WIND_RULE_NONZERO ? "evenodd" : "nonzero")
);
tmp_style << tmp;
tmp_style << "fill-opacity:1;";
@@ -867,17 +867,17 @@ Wmf::output_style(PWMF_CALLBACK_DATA d)
tmp_style << "stroke-linecap:" <<
(
- d->dc[d->level].style.stroke_linecap.computed == 0 ? "butt" :
- d->dc[d->level].style.stroke_linecap.computed == 1 ? "round" :
- d->dc[d->level].style.stroke_linecap.computed == 2 ? "square" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_BUTT ? "butt" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_ROUND ? "round" :
+ d->dc[d->level].style.stroke_linecap.computed == SP_STROKE_LINECAP_SQUARE ? "square" :
"unknown"
) << ";";
tmp_style << "stroke-linejoin:" <<
(
- d->dc[d->level].style.stroke_linejoin.computed == 0 ? "miter" :
- d->dc[d->level].style.stroke_linejoin.computed == 1 ? "round" :
- d->dc[d->level].style.stroke_linejoin.computed == 2 ? "bevel" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_MITER ? "miter" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_ROUND ? "round" :
+ d->dc[d->level].style.stroke_linejoin.computed == SP_STROKE_LINEJOIN_BEVEL ? "bevel" :
"unknown"
) << ";";
@@ -1005,30 +1005,30 @@ Wmf::select_pen(PWMF_CALLBACK_DATA d, int index)
d->dc[d->level].style.stroke_dasharray.values.push_back(spilength);
}
- d->dc[d->level].style.stroke_dasharray.set = 1;
+ d->dc[d->level].style.stroke_dasharray.set = true;
break;
}
case U_PS_SOLID:
default:
{
- d->dc[d->level].style.stroke_dasharray.set = 0;
+ d->dc[d->level].style.stroke_dasharray.set = false;
break;
}
}
switch (up.Style & U_PS_ENDCAP_MASK) {
- case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = 1; break; }
- case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = 2; break; }
+ case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_ROUND; break; }
+ case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE; break; }
case U_PS_ENDCAP_FLAT:
- default: { d->dc[d->level].style.stroke_linecap.computed = 0; break; }
+ default: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_BUTT; break; }
}
switch (up.Style & U_PS_JOIN_MASK) {
- case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = 2; break; }
- case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = 0; break; }
+ case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_BEVEL; break; }
+ case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER; break; }
case U_PS_JOIN_ROUND:
- default: { d->dc[d->level].style.stroke_linejoin.computed = 1; break; }
+ default: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_ROUND; break; }
}
@@ -1202,7 +1202,7 @@ Wmf::select_font(PWMF_CALLBACK_DATA d, int index)
font.Weight == U_FW_BOLD ? SP_CSS_FONT_WEIGHT_BOLD :
font.Weight == U_FW_EXTRALIGHT ? SP_CSS_FONT_WEIGHT_LIGHTER :
font.Weight == U_FW_EXTRABOLD ? SP_CSS_FONT_WEIGHT_BOLDER :
- U_FW_NORMAL;
+ SP_CSS_FONT_WEIGHT_NORMAL;
d->dc[d->level].style.font_style.value = (font.Italic ? SP_CSS_FONT_STYLE_ITALIC : SP_CSS_FONT_STYLE_NORMAL);
d->dc[d->level].style.text_decoration_line.underline = font.Underline;
d->dc[d->level].style.text_decoration_line.line_through = font.StrikeOut;
@@ -1239,9 +1239,9 @@ Wmf::delete_object(PWMF_CALLBACK_DATA d, int index)
// If the active object is deleted set default draw values
if(index == d->dc[d->level].active_pen){ // Use default pen: solid, black, 1 pixel wide
d->dc[d->level].active_pen = -1;
- d->dc[d->level].style.stroke_dasharray.set = 0;
- d->dc[d->level].style.stroke_linecap.computed = 2; // U_PS_ENDCAP_SQUARE
- d->dc[d->level].style.stroke_linejoin.computed = 0; // U_PS_JOIN_MITER;
+ d->dc[d->level].style.stroke_dasharray.set = false;
+ d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE; // U_PS_ENDCAP_SQUARE
+ d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER; // U_PS_JOIN_MITER;
d->dc[d->level].stroke_set = true;
d->dc[d->level].style.stroke_width.value = 1.0;
d->dc[d->level].style.stroke.value.color.set( 0, 0, 0 );
@@ -1891,7 +1891,9 @@ std::cout << "BEFORE DRAW"
{
dbg_str << "<!-- U_WMR_SETPOLYFILLMODE -->\n";
nSize = U_WMRSETPOLYFILLMODE_get(contents, &utmp16);
- d->dc[d->level].style.fill_rule.value = (utmp16 == U_ALTERNATE ? 0 : utmp16 == U_WINDING ? 1 : 0);
+ d->dc[d->level].style.fill_rule.value =
+ (utmp16 == U_ALTERNATE ? SP_WIND_RULE_NONZERO
+ : utmp16 == U_WINDING ? SP_WIND_RULE_INTERSECT : SP_WIND_RULE_NONZERO);
break;
}
case U_WMR_SETSTRETCHBLTMODE:
@@ -2405,18 +2407,18 @@ std::cout << "BEFORE DRAW"
memcpy(&utmp4, text ,4);
if(Escape == U_MFE_SETLINECAP){
switch (utmp4 & U_PS_ENDCAP_MASK) {
- case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = 1; break; }
- case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = 2; break; }
+ case U_PS_ENDCAP_ROUND: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_ROUND; break; }
+ case U_PS_ENDCAP_SQUARE: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE; break; }
case U_PS_ENDCAP_FLAT:
- default: { d->dc[d->level].style.stroke_linecap.computed = 0; break; }
+ default: { d->dc[d->level].style.stroke_linecap.computed = SP_STROKE_LINECAP_BUTT; break; }
}
}
else if(Escape == U_MFE_SETLINEJOIN){
switch (utmp4 & U_PS_JOIN_MASK) {
- case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = 2; break; }
- case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = 0; break; }
+ case U_PS_JOIN_BEVEL: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_BEVEL; break; }
+ case U_PS_JOIN_MITER: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER; break; }
case U_PS_JOIN_ROUND:
- default: { d->dc[d->level].style.stroke_linejoin.computed = 1; break; }
+ default: { d->dc[d->level].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_ROUND; break; }
}
}
else if(Escape == U_MFE_SETMITERLIMIT){
@@ -3131,9 +3133,9 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri )
d.dc[0].style.baseline_shift.value = 0;
// Default pen, WMF files that do not specify a pen are unlikely to look very good!
- d.dc[0].style.stroke_dasharray.set = 0;
- d.dc[0].style.stroke_linecap.computed = 2; // U_PS_ENDCAP_SQUARE;
- d.dc[0].style.stroke_linejoin.computed = 0; // U_PS_JOIN_MITER;
+ d.dc[0].style.stroke_dasharray.set = false;
+ d.dc[0].style.stroke_linecap.computed = SP_STROKE_LINECAP_SQUARE; // U_PS_ENDCAP_SQUARE;
+ d.dc[0].style.stroke_linejoin.computed = SP_STROKE_LINEJOIN_MITER; // U_PS_JOIN_MITER;
d.dc[0].style.stroke_width.value = 1.0; // will be reset to something reasonable once WMF drawing size is known
d.dc[0].style.stroke.value.color.set( 0, 0, 0 );
d.dc[0].stroke_set = true;