/*
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.
13#ifndef INKSCAPE_DISPLAY_DRAWING_ITEM_H
14#define INKSCAPE_DISPLAY_DRAWING_ITEM_H
23#include <boost/operators.hpp>
24#include <boost/intrusive/list.hpp>
31namespace Glib {
class ustring; }
78 char const *
what() const noexcept
override {
return "Invalid item in drawing"; }
117 virtual int tag()
const {
return tag_of<
decltype(*this)>; }
165 Glib::ustring
name()
const;
191 void _setCached(
bool cached,
bool persistent =
false);
202 using ListHook = boost::intrusive::list_member_hook<>;
207 boost::intrusive::member_hook<DrawingItem, ListHook, &DrawingItem::_child_hook>
230 std::unique_ptr<Inkscape::Filters::Filter>
_filter;
3x3 affine transformation matrix.
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
3x3 matrix representing an affine transformation.
Axis-aligned generic rectangle that can be empty.
Axis aligned, non-empty, generic rectangle.
static CRect infinite()
Create infinite rectangle.
Axis-aligned rectangle that can be empty.
Two-dimensional point that doubles as a vector.
Minimal wrapper over Cairo.
SVG drawing item for display.
virtual void _clipItem(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const
unsigned _cached_persistent
If set, will always be cached regardless of score.
unsigned _background_accumulate
Whether this element accumulates background (has any ancestor with enable-background: new)
void clip(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const
Rasterize the clipping path.
DrawingPattern * _fill_pattern
SPItem * _item
Used to associate DrawingItems with SPItems that created them.
Geom::OptIntRect const & bbox() const
@ RENDER_FILTER_BACKGROUND
@ RENDER_VISIBLE_HAIRLINES
void appendChild(DrawingItem *item)
DrawingItem(DrawingItem const &)=delete
boost::intrusive::list_member_hook<> ListHook
boost::intrusive::list< DrawingItem, boost::intrusive::member_hook< DrawingItem, ListHook, &DrawingItem::_child_hook > > ChildrenList
void _setCached(bool cached, bool persistent=false)
Enable / disable storing the rendering in memory.
int getUpdateComplexity() const
Geom::OptIntRect _cacheRect() const
Antialiasing _antialias
antialiasing level (default is Good)
void setItem(SPItem *item)
CacheList::iterator _cache_iterator
unsigned render(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags=0, DrawingItem const *stop_at=nullptr) const
Rasterize items.
std::unique_ptr< CacheData > _cache
bool style_vector_effect_size
Geom::Affine const & ctm() const
DrawingItem * pick(Geom::Point const &p, double delta, unsigned flags=0)
Get the item under the specified point.
Geom::OptIntRect _drawbox
Full visual bounding box - enlarged by filters, shrunk by clips and masks.
Geom::OptIntRect const & drawbox() const
void setBlendMode(SPBlendMode blend_mode)
void setSensitive(bool sensitive)
Geom::OptIntRect _bbox
Bounding box in display (pixel) coords including stroke.
Drawing & drawing() const
virtual void _dropPatternCache()
void setOpacity(float opacity)
virtual void setStyle(SPStyle const *style, SPStyle const *context_style=nullptr)
Process information related to the new style.
unsigned _sensitive
Whether this item responds to events.
unsigned _has_cache_iterator
If set, _cache_iterator is valid.
std::unique_ptr< Inkscape::Filters::Filter > _filter
unsigned _propagate_state
double _cacheScore()
Compute the caching score.
bool unisolatedBlend() const
virtual unsigned _renderItem(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags, DrawingItem const *stop_at) const
Geom::OptRect _item_bbox
Geometric bounding box in item's user space.
void setVisible(bool visible)
void setZOrder(unsigned zorder)
Move this item to the given place in the Z order of siblings. Does nothing if the item is not a norma...
DrawingItem * parent() const
virtual DrawingItem * _pickItem(Geom::Point const &p, double delta, unsigned flags)
void setAntialiasing(Antialiasing antialias)
bool style_vector_effect_fixed
virtual void setChildrenStyle(SPStyle const *context_style)
Recursively update children style.
std::unique_ptr< Geom::Affine > _transform
Incremental transform from parent to this item's coords.
void _markForUpdate(unsigned state, bool propagate)
Marks the item as needing a recomputation of internal data.
virtual int tag() const
Unlink this node and its subtree from the rendering tree and destroy.
DrawingPattern * _stroke_pattern
void setFilterRenderer(std::unique_ptr< Filters::Filter > renderer)
Glib::ustring name() const
virtual bool _canClip() const
void setTransform(Geom::Affine const &trans)
void _renderOutline(DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags) const
unsigned _background_new
Whether enable-background: new is set for this element.
bool _contains_unisolated_blend
void setStrokePattern(DrawingPattern *pattern)
void update(Geom::IntRect const &area=Geom::IntRect::infinite(), UpdateContext const &ctx=UpdateContext(), unsigned flags=STATE_ALL, unsigned reset=0)
Update derived data before operations.
DrawingItem & operator=(DrawingItem const &)=delete
bool isAncestorOf(DrawingItem const *item) const
Returns true if item is among the descendants. Will return false if item == this.
unsigned _pick_children
For groups: if true, children are returned from pick(), otherwise the group is returned.
unsigned _key
Auxiliary key used by the object tree for showing clips/masks/patterns.
void prependChild(DrawingItem *item)
SPStyle const * _context_style
Geom::Affine _ctm
Total transform from item coords to display coords.
void setIsolation(bool isolation)
virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset)
void setFillPattern(DrawingPattern *pattern)
void _invalidateFilterBackground(Geom::IntRect const &area)
void _markForRendering()
Marks the current visual bounding box of the item for redrawing.
bool style_vector_effect_rotate
void setKey(unsigned key)
Geom::Affine transform() const
void setMask(DrawingItem *item)
void setItemBounds(Geom::OptRect const &bounds)
Geom::OptRect const & itemBounds() const
void setClip(DrawingItem *item)
void recursivePrintTree(unsigned level=0) const
Drawing tree node used for rendering paints.
Base class for visual SVG elements.
Affine identity()
Create an identity matrix.
Helper class to stream background task notifications as a series of messages.
void propagate_antialias(SPShapeRendering shape_rendering, DrawingItem &item)
Propagate element's shape rendering attribute into internal anti-aliasing setting of DrawingItem.
std::list< CacheRecord > CacheList
void apply_antialias(DrawingContext &dc, Antialiasing antialias)
Apply antialias setting to Cairo.
bool operator==(CacheRecord const &other) const
bool operator<(CacheRecord const &other) const
char const * what() const noexcept override
std::uint32_t outline_color
std::optional< Antialiasing > antialiasing_override
SPStyle enums: named public enums that correspond to SVG property values.