nr-style.cpp revision f5c649a1cb88ab13fe7abd4d1f178a773425b820
/**
* @file
* Style information for rendering.
*//*
* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 2010 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "display/nr-style.h"
#include "style.h"
#include "sp-paint-server.h"
#include "display/canvas-bpath.h" // contains SPStrokeJoinType, SPStrokeCapType etc. (WTF!)
#include "display/drawing-context.h"
{
if (server) {
}
type = PAINT_NONE;
}
{
clear();
type = PAINT_COLOR;
color = c;
}
{
clear();
if (ps) {
type = PAINT_SERVER;
}
}
: fill()
, stroke()
, stroke_width(0.0)
, miter_limit(0.0)
, n_dash(0)
, dash_offset(0.0)
, fill_pattern(NULL)
, text_decoration_stroke_width(0.0)
, phase_length(0.0)
, tspan_line_start(false)
, tspan_line_end(false)
, tspan_width(0)
, ascender(0)
, descender(0)
, line_gap(0)
, underline_thickness(0)
, underline_position(0)
, font_size(0)
{
}
{
if (dash){
delete [] dash;
}
}
{
} else {
}
} else {
}
case SP_WIND_RULE_EVENODD:
break;
case SP_WIND_RULE_NONZERO:
break;
default:
}
} else {
}
} else {
}
case SP_STROKE_LINECAP_ROUND:
break;
case SP_STROKE_LINECAP_SQUARE:
break;
case SP_STROKE_LINECAP_BUTT:
break;
default:
}
case SP_STROKE_LINEJOIN_ROUND:
break;
case SP_STROKE_LINEJOIN_BEVEL:
break;
case SP_STROKE_LINEJOIN_MITER:
break;
default:
}
if (dash){
delete [] dash;
}
if (n_dash != 0) {
for (unsigned int i = 0; i < n_dash; ++i) {
}
} else {
dash_offset = 0.0;
}
for( unsigned i = 0; i < PAINT_ORDER_LAYERS; ++i) {
break;
case SP_CSS_PAINT_ORDER_FILL:
break;
break;
break;
}
}
if(style->text_decoration_line.underline ){ text_decoration_line |= TEXT_DECORATION_LINE_UNDERLINE + TEXT_DECORATION_LINE_SET; }
if(style->text_decoration_line.overline ){ text_decoration_line |= TEXT_DECORATION_LINE_OVERLINE + TEXT_DECORATION_LINE_SET; }
if(style->text_decoration_line.line_through){ text_decoration_line |= TEXT_DECORATION_LINE_LINETHROUGH + TEXT_DECORATION_LINE_SET; }
if(style->text_decoration_line.blink ){ text_decoration_line |= TEXT_DECORATION_LINE_BLINK + TEXT_DECORATION_LINE_SET; }
if(style->text_decoration_style.inherit ){ text_decoration_style |= TEXT_DECORATION_STYLE_INHERIT; }
if(style->text_decoration_style.solid ){ text_decoration_style |= TEXT_DECORATION_STYLE_SOLID + TEXT_DECORATION_STYLE_SET; }
if(style->text_decoration_style.isdouble ){ text_decoration_style |= TEXT_DECORATION_STYLE_ISDOUBLE + TEXT_DECORATION_STYLE_SET; }
if(style->text_decoration_style.dotted ){ text_decoration_style |= TEXT_DECORATION_STYLE_DOTTED + TEXT_DECORATION_STYLE_SET; }
if(style->text_decoration_style.dashed ){ text_decoration_style |= TEXT_DECORATION_STYLE_DASHED + TEXT_DECORATION_STYLE_SET; }
if(style->text_decoration_style.wavy ){ text_decoration_style |= TEXT_DECORATION_STYLE_WAVY + TEXT_DECORATION_STYLE_SET; }
/* FIXME
The meaning of text-decoration-color in CSS3 for SVG is ambiguous (2014-05-06). Set
it for fill, for stroke, for both? Both would seem like the obvious choice but what happens
is that for text which is just fill (very common) it makes the lines fatter because it
enables stroke on the decorations when it wasn't present on the text. That contradicts the
The behavior here is that if color is defined it is applied to text_decoration_fill/stroke
Hopefully the standard will be clarified to resolve this issue.
*/
// SVG sets color specifically
} else {
// No decoration fill because no text fill
}
// SVG sets color specifically
} else {
// No decoration stroke because no text stroke
}
} else {
} else {
}
} else {
}
}
}
update();
}
{
// update fill pattern
if (!fill_pattern) {
case PAINT_SERVER: {
} break;
case PAINT_COLOR: {
} break;
default: break;
}
}
if (!fill_pattern) return false;
return true;
}
{
}
bool NRStyle::prepareTextDecorationFill(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox)
{
// update text decoration pattern
if (!text_decoration_fill_pattern) {
switch (text_decoration_fill.type) {
case PAINT_SERVER: {
text_decoration_fill_pattern = text_decoration_fill.server->pattern_new(dc.raw(), paintbox, text_decoration_fill.opacity);
} break;
case PAINT_COLOR: {
} break;
default: break;
}
}
if (!text_decoration_fill_pattern) return false;
return true;
}
{
// Fill rule does not matter, no intersections.
}
{
if (!stroke_pattern) {
case PAINT_SERVER: {
} break;
case PAINT_COLOR: {
} break;
default: break;
}
}
if (!stroke_pattern) return false;
return true;
}
{
}
bool NRStyle::prepareTextDecorationStroke(Inkscape::DrawingContext &dc, Geom::OptRect const &paintbox)
{
if (!text_decoration_stroke_pattern) {
switch (text_decoration_stroke.type) {
case PAINT_SERVER: {
text_decoration_stroke_pattern = text_decoration_stroke.server->pattern_new(dc.raw(), paintbox, text_decoration_stroke.opacity);
} break;
case PAINT_COLOR: {
} break;
default: break;
}
}
if (!text_decoration_stroke_pattern) return false;
return true;
}
{
}
{
// force pattern update
fill_pattern = NULL;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :