diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2007-09-10 06:33:47 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2007-09-10 06:33:47 +0000 |
| commit | 16888ce63e21b83d94595055150072ef3037ca1d (patch) | |
| tree | 649a9f640d4f0354e59196404833e6d1ae9833cb /src/extension/internal | |
| parent | rearrange, disable fidelity for color modes (diff) | |
| download | inkscape-16888ce63e21b83d94595055150072ef3037ca1d.tar.gz inkscape-16888ce63e21b83d94595055150072ef3037ca1d.zip | |
Purged fill type enum
(bzr r3706)
Diffstat (limited to 'src/extension/internal')
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 28 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/pdf-cairo.cpp | 46 | ||||
| -rw-r--r-- | src/extension/internal/pov-out.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/ps.cpp | 28 |
6 files changed, 57 insertions, 57 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index b13b95643..61d40ea4e 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -157,13 +157,13 @@ CairoRenderContext::setStateForStyle(SPStyle const *style) _state->opacity = SP_SCALE24_TO_FLOAT(style->opacity.value); _state->has_overflow = (style->overflow.set && style->overflow.value != SP_CSS_OVERFLOW_VISIBLE); - if (style->fill.type == SP_PAINT_TYPE_PAINTSERVER || style->stroke.type == SP_PAINT_TYPE_PAINTSERVER) + if (style->fill.isPaintserver() || style->stroke.isPaintserver()) _state->merge_opacity = FALSE; // disable rendering of opacity if there's a stroke on the fill if (_state->merge_opacity - && style->fill.type != SP_PAINT_TYPE_NONE - && style->stroke.type != SP_PAINT_TYPE_NONE) + && !style->fill.isNone() + && !style->stroke.isNone()) _state->merge_opacity = FALSE; } @@ -1059,8 +1059,8 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain void CairoRenderContext::_setFillStyle(SPStyle const *const style, NRRect const *pbox) { - g_return_if_fail( style->fill.type == SP_PAINT_TYPE_COLOR - || style->fill.type == SP_PAINT_TYPE_PAINTSERVER ); + g_return_if_fail( style->fill.isColor() + || style->fill.isPaintserver() ); float alpha = SP_SCALE24_TO_FLOAT(style->fill_opacity.value); if (_state->merge_opacity) { @@ -1068,13 +1068,13 @@ CairoRenderContext::_setFillStyle(SPStyle const *const style, NRRect const *pbox TRACE(("merged op=%f\n", alpha)); } - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { float rgb[3]; sp_color_get_rgb_floatv(&style->fill.value.color, rgb); cairo_set_source_rgba(_cr, rgb[0], rgb[1], rgb[2], alpha); } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() || SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) || SP_IS_PATTERN(SP_STYLE_FILL_SERVER(style)) ); @@ -1094,13 +1094,13 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, NRRect const *pbox) if (_state->merge_opacity) alpha *= _state->opacity; - if (style->stroke.type == SP_PAINT_TYPE_COLOR) { + if (style->stroke.isColor()) { float rgb[3]; sp_color_get_rgb_floatv(&style->stroke.value.color, rgb); cairo_set_source_rgba(_cr, rgb[0], rgb[1], rgb[2], alpha); } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() || SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style)) || SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style)) ); @@ -1175,7 +1175,7 @@ CairoRenderContext::renderPath(NRBPath const *bpath, SPStyle const *style, NRRec return true; } - if (style->fill.type == SP_PAINT_TYPE_NONE && style->stroke.type == SP_PAINT_TYPE_NONE) + if (style->fill.isNone() && style->stroke.isNone()) return true; bool need_layer = ( !_state->merge_opacity && !_state->need_layer && @@ -1186,7 +1186,7 @@ CairoRenderContext::renderPath(NRBPath const *bpath, SPStyle const *style, NRRec else pushLayer(); - if (style->fill.type != SP_PAINT_TYPE_NONE) { + if (!style->fill.isNone()) { _setFillStyle(style, pbox); setBpath(bpath->path); @@ -1196,15 +1196,15 @@ CairoRenderContext::renderPath(NRBPath const *bpath, SPStyle const *style, NRRec cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING); } - if (style->stroke.type == SP_PAINT_TYPE_NONE) + if (style->stroke.isNone()) cairo_fill(_cr); else cairo_fill_preserve(_cr); } - if (style->stroke.type != SP_PAINT_TYPE_NONE) { + if (!style->stroke.isNone()) { _setStrokeStyle(style, pbox); - if (style->fill.type == SP_PAINT_TYPE_NONE) + if (style->fill.isNone()) setBpath(bpath->path); cairo_stroke(_cr); diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 990c094a4..116cccb3b 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -206,7 +206,7 @@ PrintLatex::fill(Inkscape::Extension::Print *mod, { if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { Inkscape::SVGOStringStream os; float rgb[3]; @@ -233,7 +233,7 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, const NRBPath *bpath, const { if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. - if (style->stroke.type == SP_PAINT_TYPE_COLOR) { + if (style->stroke.isColor()) { Inkscape::SVGOStringStream os; float rgb[3]; NR::Matrix tr_stack = m_tr_stack.top(); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index f67800ca5..61e3e593e 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -1557,7 +1557,7 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, StyleInfo si; //## FILL - if (style->fill.type == SP_PAINT_TYPE_COLOR) + if (style->fill.isColor()) { guint32 fillCol = sp_color_get_rgba32_ualpha(&style->fill.value.color, 0); @@ -1576,7 +1576,7 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, } //## STROKE - if (style->stroke.type == SP_PAINT_TYPE_COLOR) + if (style->stroke.isColor()) { guint32 strokeCol = sp_color_get_rgba32_ualpha(&style->stroke.value.color, 0); @@ -1658,7 +1658,7 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, if (!style) return false; - if (style->fill.type != SP_PAINT_TYPE_PAINTSERVER) + if (!style->fill.isPaintserver()) return false; //## Gradient. Look in writeStyle() below to see what info diff --git a/src/extension/internal/pdf-cairo.cpp b/src/extension/internal/pdf-cairo.cpp index 0b500864d..e1a168c27 100644 --- a/src/extension/internal/pdf-cairo.cpp +++ b/src/extension/internal/pdf-cairo.cpp @@ -533,11 +533,11 @@ PrintCairoPDF::create_pattern_for_paint(SPPaintServer const *const paintserver, void PrintCairoPDF::print_fill_style(cairo_t *cr, SPStyle const *const style, NRRect const *pbox) { - g_return_if_fail( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_return_if_fail( style->fill.isColor() + || ( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ); - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { float rgb[3]; sp_color_get_rgb_floatv(&style->fill.value.color, rgb); @@ -545,7 +545,7 @@ PrintCairoPDF::print_fill_style(cairo_t *cr, SPStyle const *const style, NRRect cairo_set_source_rgba(cr, rgb[0], rgb[1], rgb[2], alpha); } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ); cairo_pattern_t *pattern = create_pattern_for_paint(SP_STYLE_FILL_SERVER(style), pbox, 1.0); @@ -564,14 +564,14 @@ PrintCairoPDF::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMat if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. if (_bitmap) return 0; - if ( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER - && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ) { - + if ( style->fill.isColor() + || ( style->fill.isPaintserver() + && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ) { + float alpha = SP_SCALE24_TO_FLOAT(style->fill_opacity.value); - + cairo_save(cr); - + print_fill_style(cr, style, pbox); print_bpath(cr, bpath->path); if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { @@ -580,7 +580,7 @@ PrintCairoPDF::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMat cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING); } if (alpha != 1.0 && - style->fill.type != SP_PAINT_TYPE_COLOR) { + !style->fill.isColor()) { cairo_clip (cr); cairo_paint_with_alpha (cr, alpha); @@ -599,12 +599,12 @@ PrintCairoPDF::print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect cons { float alpha = SP_SCALE24_TO_FLOAT(style->stroke_opacity.value); - if ( style->stroke.type == SP_PAINT_TYPE_COLOR ) { + if ( style->stroke.isColor() ) { float rgb[3]; sp_color_get_rgb_floatv(&style->stroke.value.color, rgb); cairo_set_source_rgba(cr, rgb[0], rgb[1], rgb[2], alpha); - } else if ( style->stroke.type == SP_PAINT_TYPE_PAINTSERVER + } else if ( style->stroke.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style)) ) { cairo_pattern_t *pattern = create_pattern_for_paint(SP_STYLE_STROKE_SERVER(style), pbox, alpha); @@ -664,16 +664,16 @@ PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRM if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. if (_bitmap) return 0; - if ( style->stroke.type == SP_PAINT_TYPE_COLOR || - ( style->stroke.type == SP_PAINT_TYPE_PAINTSERVER + if ( style->stroke.isColor() || + ( style->stroke.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style)) ) ) { - cairo_save(cr); - - print_stroke_style(cr, style, pbox); + cairo_save(cr); + + print_stroke_style(cr, style, pbox); print_bpath(cr, bpath->path); cairo_stroke(cr); - + cairo_restore(cr); } @@ -884,8 +884,8 @@ PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point cairo_set_font_matrix(cr, &matrix); #endif - if ( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + if ( style->fill.isColor() + || ( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ) { // set fill style @@ -904,8 +904,8 @@ PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point #endif } - if (style->stroke.type == SP_PAINT_TYPE_COLOR - || ( style->stroke.type == SP_PAINT_TYPE_PAINTSERVER + if (style->stroke.isColor() + || ( style->stroke.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_STROKE_SERVER(style)) ) ) { // set stroke style diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index 7318fa784..c915de75b 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -328,7 +328,7 @@ void PovOutput::doCurves(SPDocument *doc) SPStyle *style = SP_OBJECT_STYLE(shape); /* fixme: Handle other fill types, even if this means translating gradients to a single flat colour. */ - if (style && (style->fill.type == SP_PAINT_TYPE_COLOR)) + if (style && (style->fill.isColor())) { // see color.h for how to parse SPColor float rgb[3]; diff --git a/src/extension/internal/ps.cpp b/src/extension/internal/ps.cpp index 8cf284536..ac424e85e 100644 --- a/src/extension/internal/ps.cpp +++ b/src/extension/internal/ps.cpp @@ -646,18 +646,18 @@ PrintPS::comment(Inkscape::Extension::Print *mod, char const *comment) void PrintPS::print_fill_style(SVGOStringStream &os, SPStyle const *const style, NRRect const *pbox) { - g_return_if_fail( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_return_if_fail( style->fill.isColor() + || ( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ); - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { float rgb[3]; sp_color_get_rgb_floatv(&style->fill.value.color, rgb); os << rgb[0] << " " << rgb[1] << " " << rgb[2] << " setrgbcolor\n"; } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ); if (SP_IS_LINEARGRADIENT(SP_STYLE_FILL_SERVER(style))) { @@ -799,8 +799,8 @@ PrintPS::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMatrix co if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. if (_bitmap) return 0; - if ( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + if ( style->fill.isColor() + || ( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ) { Inkscape::SVGOStringStream os; @@ -812,10 +812,10 @@ PrintPS::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMatrix co print_bpath(os, bpath->path); if (style->fill_rule.value == SP_WIND_RULE_EVENODD) { - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { os << "eofill\n"; } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ); SPGradient const *g = SP_GRADIENT(SP_STYLE_FILL_SERVER(style)); os << "eoclip\n"; @@ -830,10 +830,10 @@ PrintPS::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMatrix co } } } else { - if (style->fill.type == SP_PAINT_TYPE_COLOR) { + if (style->fill.isColor()) { os << "fill\n"; } else { - g_assert( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + g_assert( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ); SPGradient const *g = SP_GRADIENT(SP_STYLE_FILL_SERVER(style)); os << "clip\n"; @@ -865,7 +865,7 @@ PrintPS::stroke(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMatrix if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. if (_bitmap) return 0; - if (style->stroke.type == SP_PAINT_TYPE_COLOR) { + if (style->stroke.isColor()) { Inkscape::SVGOStringStream os; print_stroke_style(os, style); @@ -1367,8 +1367,8 @@ PrintPS::text(Inkscape::Extension::Print *mod, char const *text, NR::Point p, //The commented line beneath causes Inkscape to crash under Linux but not under Windows //g_free((void*) fn); - if ( style->fill.type == SP_PAINT_TYPE_COLOR - || ( style->fill.type == SP_PAINT_TYPE_PAINTSERVER + if ( style->fill.isColor() + || ( style->fill.isPaintserver() && SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)) ) ) { // set fill style @@ -1385,7 +1385,7 @@ PrintPS::text(Inkscape::Extension::Print *mod, char const *text, NR::Point p, os << ") show\n"; } - if (style->stroke.type == SP_PAINT_TYPE_COLOR) { + if (style->stroke.isColor()) { // set stroke style print_stroke_style(os, style); |
