/*
7 * Krzysztof Kosiński <tweenk.pl@gmail.com>
9 * Copyright (C) 2011 Authors
10 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
35 , style_vector_effect_stroke(false)
36 , style_stroke_extensions_hairline(false)
58 auto vector_effect_stroke =
false;
59 auto stroke_extensions_hairline =
false;
94 c.update(area, ctx, flags, reset);
112 float stroke_max = 0.0f;
126 stroke_max = std::max(stroke_max, 0.5f);
132 stroke_max = std::max(stroke_max, 0.5f);
135 if (stroke_max > 0.0f) {
142 if (stroke_max > 0.01) {
143 rect->expandBy(stroke_max);
147 return rect->roundOutwards();
151 _bbox = calc_curve_bbox();
198 double dx = 1.0, dy = 0.0;
200 auto pixel_size = std::hypot(dx, dy);
215 i.render(dc,
rc, area, flags, stop_at);
229 auto rgba =
rc.outline_color;
282 double dx = 1.0, dy = 0.0;
284 auto half_pixel_size = std::hypot(dx, dy) * 0.5;
345 if (!
_curve)
return nullptr;
354 gint64 tstart = g_get_monotonic_time();
366 width = std::max(0.125f, stroke_width *
scale) / 2;
385 gint64 tfinish = g_get_monotonic_time();
386 gint64 this_pick = tfinish - tstart;
388 if (this_pick > 10000) {
409 if (needfill ||
width > 0) {
Axis-aligned generic rectangle that can be empty.
void unionWith(CRect const &b)
Enlarge the rectangle to contain the argument.
Axis aligned, non-empty, generic rectangle.
void expandBy(C amount)
Expand the rectangle in both directions by the specified amount.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
UI::Widget::Canvas * get_canvas() const
RAII idiom for saving the state of DrawingContext.
Minimal wrapper over Cairo.
void path(Geom::PathVector const &pv)
void setSource(cairo_pattern_t *source)
void transform(Geom::Affine const &trans)
void setTolerance(double tol)
void device_to_user_distance(double &dx, double &dy)
void setFillRule(cairo_fill_rule_t rule)
void setLineWidth(double w)
SVG drawing item for display.
DrawingPattern * _fill_pattern
@ RENDER_VISIBLE_HAIRLINES
DrawingItem * pick(Geom::Point const &p, double delta, unsigned flags=0)
Get the item under the specified point.
Geom::OptIntRect _bbox
Bounding box in display (pixel) coords including stroke.
virtual void setStyle(SPStyle const *style, SPStyle const *context_style=nullptr)
Process information related to the new style.
Geom::OptRect _item_bbox
Geometric bounding box in item's user space.
virtual void setChildrenStyle(SPStyle const *context_style)
Recursively update children style.
void _markForUpdate(unsigned state, bool propagate)
Marks the item as needing a recomputation of internal data.
DrawingPattern * _stroke_pattern
SPStyle const * _context_style
Geom::Affine _ctm
Total transform from item coords to display coords.
void _markForRendering()
Marks the current visual bounding box of the item for redrawing.
DrawingShape(Drawing &drawing)
unsigned _renderItem(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags, DrawingItem const *stop_at) const override
void _clipItem(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const override
void setPath(std::shared_ptr< SPCurve const > curve)
unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset) override
bool style_vector_effect_stroke
void _renderStroke(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags) const
bool style_stroke_extensions_hairline
void setChildrenStyle(SPStyle const *context_style) override
Recursively update children style.
SPWindRule style_fill_rule
DrawingItem * _pickItem(Geom::Point const &p, double delta, unsigned flags) override
SPWindRule style_clip_rule
void setStyle(SPStyle const *style, SPStyle const *context_style=nullptr) override
Process information related to the new style.
void _renderMarkers(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags, DrawingItem const *stop_at) const
std::shared_ptr< SPCurve const > _curve
void _renderFill(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const
CanvasItemDrawing * getCanvasItemDrawing()
RenderMode renderMode() const
bool selectZeroOpacity() const
bool outlineOverlay() const
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
void applyFill(DrawingContext &dc, CairoPatternUniqPtr const &cp) const
void set(NRStyleData &&data)
T< SPAttr::CLIP_RULE, SPIEnum< SPWindRule > > clip_rule
clip-rule: 0 nonzero, 1 evenodd
T< SPAttr::FILL_RULE, SPIEnum< SPWindRule > > fill_rule
fill-rule: 0 nonzero, 1 evenodd
T< SPAttr::OPACITY, SPIScale24 > opacity
opacity
T< SPAttr::STROKE_EXTENSIONS, SPIStrokeExtensions > stroke_extensions
-inkscape-stroke
T< SPAttr::VECTOR_EFFECT, SPIVectorEffect > vector_effect
vector effect
Cairo drawing context with Inkscape extensions.
Group belonging to an SVG drawing element.
static bool has_fill(SPObject *source)
static bool has_stroke(SPObject *source)
constexpr Coord infinity()
Get a value representing infinity.
Geom::OptRect bounds_exact_transformed(Geom::PathVector const &pv, Geom::Affine const &t)
void pathv_matrix_point_bbox_wind_distance(Geom::PathVector const &pathv, Geom::Affine const &m, Geom::Point const &pt, Geom::Rect *bbox, int *wind, Geom::Coord *dist, Geom::Coord tolerance, Geom::Rect const *viewbox)
Specific geometry functions for Inkscape, not provided my lib2geom.
double max_expansion(Geom::Affine const &affine)
Compute the maximum factor by which affine can increase a vector's length.
Helper class to stream background task notifications as a series of messages.
Geom::PathVector outline(Geom::Path const &input, double width, double miter, LineJoinType join, LineCapType butt, double tolerance)
Strokes the path given by input.
callback interface for SVG path data
PathVector - a sequence of subpaths.
std::array< PaintOrderType, 3 > paint_order_layer
cairo_line_join_t line_join
static const unsigned SP_SCALE24_MAX
SPStyle - a style object for SPItem objects.
parse SVG path specifications