/*
7 * Krzysztof KosiĆski <tweenk.pl@gmail.com>
9 * Copyright (C) 2010 Authors
10 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
52 if (server && server->
isValid()) {
61 }
else if (paint->
isNone()) {
68 g_assert_not_reached();
114 style_fill = &context_style->
fill;
121 style_fill = &context_style->
stroke;
138 g_assert_not_reached();
144 style_stroke = &context_style->
fill;
150 style_stroke = &context_style->
stroke;
171 g_assert_not_reached();
184 g_assert_not_reached();
192 for (
int i = 0; i <
n_dash; ++i) {
249 auto style_td = style;
258 if (style_td->text_decoration_fill.set) {
260 }
else if (style_td->text_decoration_color.set) {
261 if(style->
fill.isPaintserver() || style->
fill.isColor()) {
273 if (style_td->text_decoration_stroke.set) {
275 }
else if (style_td->text_decoration_color.set) {
276 if(style->
stroke.isPaintserver() || style->
stroke.isColor()) {
310 return CairoPatternUniqPtr(pattern->renderPattern(
rc, area, paint.opacity, dc.surface()->device_scale()));
316 switch (paint.type) {
317 case NRStyleData::PaintType::SERVER:
319 cp.pattern = CairoPatternUniqPtr(paint.server->create_pattern(dc.raw(), paintbox, paint.opacity));
320 ink_cairo_pattern_set_dither(cp.pattern.get(), rc.dithering && paint.server->ditherable());
322 std::cerr <<
"Null pattern detected" << std::endl;
323 cp.pattern = CairoPatternUniqPtr(cairo_pattern_create_rgba(0, 0, 0, 0));
336 return copy(cp.pattern);
341 data = std::move(data_);
347 return preparePaint(dc,
rc, area, paintbox, pattern,
data.fill, fill_pattern);
352 return preparePaint(dc,
rc, area, paintbox, pattern,
data.stroke, stroke_pattern);
357 return preparePaint(dc,
rc, area, paintbox, pattern,
data.text_decoration_fill, text_decoration_fill_pattern);
362 return preparePaint(dc,
rc, area, paintbox, pattern,
data.text_decoration_stroke, text_decoration_stroke_pattern);
402 cairo_set_dash(dc.
raw(),
nullptr, 0, 0.0);
cairo_pattern_t * ink_cairo_pattern_create(Colors::Color const &color, bool to_srgb)
Cairo integration helpers.
Axis aligned, non-empty, generic rectangle.
Axis-aligned rectangle that can be empty.
Minimal wrapper over Cairo.
void setLineCap(cairo_line_cap_t cap)
void setSource(cairo_pattern_t *source)
void setFillRule(cairo_fill_rule_t rule)
void setLineWidth(double w)
void setMiterLimit(double miter)
void setLineJoin(cairo_line_join_t join)
Drawing tree node used for rendering paints.
CachedPattern text_decoration_stroke_pattern
CachedPattern text_decoration_fill_pattern
void applyTextDecorationFill(DrawingContext &dc, CairoPatternUniqPtr const &cp) const
CachedPattern stroke_pattern
void applyStroke(DrawingContext &dc, CairoPatternUniqPtr const &cp) const
CairoPatternUniqPtr prepareFill(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, Geom::OptRect const &paintbox, DrawingPattern const *pattern) const
CairoPatternUniqPtr prepareStroke(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, Geom::OptRect const &paintbox, DrawingPattern const *pattern) const
CairoPatternUniqPtr preparePaint(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, Geom::OptRect const &paintbox, DrawingPattern const *pattern, NRStyleData::Paint const &paint, CachedPattern const &cp) const
void applyTextDecorationStroke(DrawingContext &dc, CairoPatternUniqPtr const &cp) const
CairoPatternUniqPtr prepareTextDecorationFill(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, Geom::OptRect const &paintbox, DrawingPattern const *pattern) const
CairoPatternUniqPtr prepareTextDecorationStroke(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, Geom::OptRect const &paintbox, DrawingPattern const *pattern) const
CachedPattern fill_pattern
void applyFill(DrawingContext &dc, CairoPatternUniqPtr const &cp) const
void set(NRStyleData &&data)
Paint type internal to SPStyle.
bool isPaintserver() const
std::shared_ptr< SPPaintServerReference > href
SPPaintOrigin paintOrigin
Colors::Color const & getColor() const
virtual bool isValid() const
virtual std::unique_ptr< Inkscape::DrawingPaintServer > create_drawing_paintserver()
T< SPAttr::TEXT_DECORATION_LINE, SPITextDecorationLine > text_decoration_line
CSS 3 2.1, 2.2, 2.3.
T< SPAttr::TEXT_DECORATION_STYLE, SPITextDecorationStyle > text_decoration_style
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE_DASHARRAY, SPIDashArray > stroke_dasharray
stroke-dasharray
T< SPAttr::STROKE, SPIPaint > stroke
stroke
SPITextDecorationData text_decoration_data
T< SPAttr::PAINT_ORDER, SPIPaintOrder > paint_order
T< SPAttr::STROKE_WIDTH, SPILength > stroke_width
stroke-width
T< SPAttr::TEXT_DECORATION_COLOR, SPIColor > text_decoration_color
T< SPAttr::TEXT_DECORATION, SPITextDecoration > text_decoration
text decoration (css2 16.3.1)
T< SPAttr::DIRECTION, SPIEnum< SPCSSDirection > > direction
text direction (svg1.1)
T< SPAttr::FILL_RULE, SPIEnum< SPWindRule > > fill_rule
fill-rule: 0 nonzero, 1 evenodd
T< SPAttr::FILL_OPACITY, SPIScale24 > fill_opacity
fill-opacity
T< SPAttr::STROKE_LINEJOIN, SPIEnum< SPStrokeJoinType > > stroke_linejoin
stroke-linejoin
T< SPAttr::STROKE_OPACITY, SPIScale24 > stroke_opacity
stroke-opacity
T< SPAttr::STROKE_MITERLIMIT, SPIFloat > stroke_miterlimit
stroke-miterlimit
T< SPAttr::STROKE_LINECAP, SPIEnum< SPStrokeCapType > > stroke_linecap
stroke-linecap
T< SPAttr::STROKE_DASHOFFSET, SPILength > stroke_dashoffset
stroke-dashoffset
T< SPAttr::STROKE_EXTENSIONS, SPIStrokeExtensions > stroke_extensions
-inkscape-stroke
T< SPAttr::FONT_SIZE, SPIFontSize > font_size
Size of the font.
Cairo drawing context with Inkscape extensions.
Canvas belonging to SVG pattern.
Cairo surface that remembers its origin.
Helper class to stream background task notifications as a series of messages.
std::unique_ptr< cairo_pattern_t, CairoPatternFreer > CairoPatternUniqPtr
Style information for rendering.
void set(Colors::Color const &c)
std::unique_ptr< DrawingPaintServer > server
float line_through_thickness
@ TEXT_DECORATION_LINE_UNDERLINE
@ TEXT_DECORATION_LINE_BLINK
@ TEXT_DECORATION_LINE_CLEAR
@ TEXT_DECORATION_LINE_SET
@ TEXT_DECORATION_LINE_LINETHROUGH
@ TEXT_DECORATION_LINE_OVERLINE
@ TEXT_DECORATION_LINE_INHERIT
std::array< PaintOrderType, 3 > paint_order_layer
cairo_line_cap_t line_cap
@ TEXT_DECORATION_STYLE_INHERIT
@ TEXT_DECORATION_STYLE_SOLID
@ TEXT_DECORATION_STYLE_ISDOUBLE
@ TEXT_DECORATION_STYLE_DOTTED
@ TEXT_DECORATION_STYLE_CLEAR
@ TEXT_DECORATION_STYLE_SET
@ TEXT_DECORATION_STYLE_DASHED
@ TEXT_DECORATION_STYLE_WAVY
Paint text_decoration_fill
float line_through_position
cairo_fill_rule_t fill_rule
int text_decoration_style
float text_decoration_stroke_width
float underline_thickness
Paint text_decoration_stroke
std::vector< double > dash
cairo_line_join_t line_join
float line_through_position
float underline_thickness
float line_through_thickness
@ SP_STROKE_LINEJOIN_MITER
@ SP_STROKE_LINEJOIN_BEVEL
@ SP_STROKE_LINEJOIN_ROUND
@ SP_STROKE_LINECAP_SQUARE
@ SP_STROKE_LINECAP_ROUND
constexpr size_t PAINT_ORDER_LAYERS
@ SP_CSS_PAINT_ORIGIN_CONTEXT_STROKE
@ SP_CSS_PAINT_ORIGIN_CONTEXT_FILL
@ SP_CSS_PAINT_ORDER_STROKE
@ SP_CSS_PAINT_ORDER_MARKER
@ SP_CSS_PAINT_ORDER_FILL
@ SP_CSS_PAINT_ORDER_NORMAL
SPStyle - a style object for SPItem objects.