Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::DrawingItem Class Reference

SVG drawing item for display. More...

#include <drawing-item.h>

Inheritance diagram for Inkscape::DrawingItem:
Inkscape::DrawingGlyphs Inkscape::DrawingGroup Inkscape::DrawingImage Inkscape::DrawingShape Inkscape::DrawingPattern Inkscape::DrawingText

Public Types

enum  RenderFlags {
  RENDER_DEFAULT = 0 , RENDER_CACHE_ONLY = 1 << 0 , RENDER_BYPASS_CACHE = 1 << 1 , RENDER_FILTER_BACKGROUND = 1 << 2 ,
  RENDER_OUTLINE = 1 << 3 , RENDER_NO_FILTERS = 1 << 4 , RENDER_VISIBLE_HAIRLINES = 1 << 5
}
 
enum  StateFlags {
  STATE_NONE = 0 , STATE_BBOX = 1 << 0 , STATE_CACHE = 1 << 1 , STATE_PICK = 1 << 2 ,
  STATE_RENDER = 1 << 3 , STATE_BACKGROUND = 1 << 4 , STATE_ALL = (1 << 5) - 1 , STATE_TOTAL_INV = 1 << 5
}
 
enum  PickFlags { PICK_NORMAL = 0 , PICK_STICKY = 1 << 0 , PICK_AS_CLIP = 1 << 1 , PICK_OUTLINE = 1 << 2 }
 

Public Member Functions

 DrawingItem (Drawing &drawing)
 
 DrawingItem (DrawingItem const &)=delete
 
DrawingItemoperator= (DrawingItem const &)=delete
 
void unlink ()
 
virtual int tag () const
 Unlink this node and its subtree from the rendering tree and destroy.
 
Geom::OptIntRect const & bbox () const
 
Geom::OptIntRect const & drawbox () const
 
Geom::OptRect const & itemBounds () const
 
Geom::Affine const & ctm () const
 
Geom::Affine transform () const
 
Drawingdrawing () const
 
DrawingItemparent () const
 
bool isAncestorOf (DrawingItem const *item) const
 Returns true if item is among the descendants. Will return false if item == this.
 
int getUpdateComplexity () const
 
bool unisolatedBlend () const
 
void appendChild (DrawingItem *item)
 
void prependChild (DrawingItem *item)
 
void clearChildren ()
 
bool visible () const
 
void setVisible (bool visible)
 
bool sensitive () const
 
void setSensitive (bool sensitive)
 
virtual void setStyle (SPStyle const *style, SPStyle const *context_style=nullptr)
 Process information related to the new style.
 
virtual void setChildrenStyle (SPStyle const *context_style)
 Recursively update children style.
 
void setOpacity (float opacity)
 
void setAntialiasing (Antialiasing antialias)
 
void setIsolation (bool isolation)
 
void setBlendMode (SPBlendMode blend_mode)
 
void setTransform (Geom::Affine const &trans)
 
void setClip (DrawingItem *item)
 
void setMask (DrawingItem *item)
 
void setFillPattern (DrawingPattern *pattern)
 
void setStrokePattern (DrawingPattern *pattern)
 
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 normal child.
 
void setItemBounds (Geom::OptRect const &bounds)
 
void setFilterRenderer (std::unique_ptr< Filters::Filter > renderer)
 
void setKey (unsigned key)
 
unsigned key () const
 
void setItem (SPItem *item)
 
SPItemgetItem () const
 
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.
 
unsigned render (DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags=0, DrawingItem const *stop_at=nullptr) const
 Rasterize items.
 
unsigned render (DrawingContext &dc, Geom::IntRect const &area, unsigned flags=0) const
 A stand alone render, ignoring all other objects in the document.
 
void clip (DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const
 Rasterize the clipping path.
 
DrawingItempick (Geom::Point const &p, double delta, unsigned flags=0)
 Get the item under the specified point.
 
Glib::ustring name () const
 
void recursivePrintTree (unsigned level=0) const
 

Protected Types

enum class  ChildType : unsigned char {
  ORPHAN = 0 , NORMAL = 1 , CLIP = 2 , MASK = 3 ,
  FILL = 4 , STROKE = 5 , ROOT = 6
}
 
enum  RenderResult { RENDER_OK = 0 , RENDER_STOP = 1 }
 
using ListHook = boost::intrusive::list_member_hook<>
 
using ChildrenList = boost::intrusive::list< DrawingItem, boost::intrusive::member_hook< DrawingItem, ListHook, &DrawingItem::_child_hook > >
 

Protected Member Functions

virtual ~DrawingItem ()
 
void _renderOutline (DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags) const
 
void _markForUpdate (unsigned state, bool propagate)
 Marks the item as needing a recomputation of internal data.
 
void _markForRendering ()
 Marks the current visual bounding box of the item for redrawing.
 
void _invalidateFilterBackground (Geom::IntRect const &area)
 
double _cacheScore ()
 Compute the caching score.
 
Geom::OptIntRect _cacheRect () const
 
void _setCached (bool cached, bool persistent=false)
 Enable / disable storing the rendering in memory.
 
virtual unsigned _updateItem (Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset)
 
virtual unsigned _renderItem (DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area, unsigned flags, DrawingItem const *stop_at) const
 
virtual void _clipItem (DrawingContext &dc, RenderContext &rc, Geom::IntRect const &area) const
 
virtual DrawingItem_pickItem (Geom::Point const &p, double delta, unsigned flags)
 
virtual bool _canClip () const
 
virtual void _dropPatternCache ()
 
template<typename F >
void defer (F &&f)
 

Protected Attributes

Drawing_drawing
 
DrawingItem_parent
 
ListHook _child_hook
 
ChildrenList _children
 
unsigned _key
 Auxiliary key used by the object tree for showing clips/masks/patterns.
 
SPItem_item
 Used to associate DrawingItems with SPItems that created them.
 
SPStyle const * _style
 
SPStyle const * _context_style
 
float _opacity
 
std::unique_ptr< Geom::Affine_transform
 Incremental transform from parent to this item's coords.
 
Geom::Affine _ctm
 Total transform from item coords to display coords.
 
Geom::OptIntRect _bbox
 Bounding box in display (pixel) coords including stroke.
 
Geom::OptIntRect _drawbox
 Full visual bounding box - enlarged by filters, shrunk by clips and masks.
 
Geom::OptRect _item_bbox
 Geometric bounding box in item's user space.
 
DrawingItem_clip
 
DrawingItem_mask
 
DrawingPattern_fill_pattern
 
DrawingPattern_stroke_pattern
 
std::unique_ptr< Inkscape::Filters::Filter_filter
 
std::unique_ptr< CacheData > _cache
 
int _update_complexity = 0
 
bool _contains_unisolated_blend: 1
 
CacheList::iterator _cache_iterator
 
bool style_vector_effect_size: 1
 
bool style_vector_effect_rotate: 1
 
bool style_vector_effect_fixed: 1
 
unsigned _state: 8
 
unsigned _propagate_state: 8
 
ChildType _child_type: 3
 
unsigned _background_new: 1
 Whether enable-background: new is set for this element.
 
unsigned _background_accumulate: 1
 Whether this element accumulates background (has any ancestor with enable-background: new)
 
unsigned _visible: 1
 
unsigned _sensitive: 1
 Whether this item responds to events.
 
unsigned _cached_persistent: 1
 If set, will always be cached regardless of score.
 
unsigned _has_cache_iterator: 1
 If set, _cache_iterator is valid.
 
unsigned _pick_children: 1
 For groups: if true, children are returned from pick(), otherwise the group is returned.
 
Antialiasing _antialias: 2
 antialiasing level (default is Good)
 
bool _isolation: 1
 
SPBlendMode _blend_mode
 

Friends

class Drawing
 

Detailed Description

SVG drawing item for display.

This class represents the renderable portion of the SVG document. Typically this is created by the SP tree, in particular the invoke_show() virtual function.

Object lifetime

Deleting a DrawingItem will cause all of its children to be deleted as well. This can lead to nasty surprises if you hold references to things which are children of what is being deleted. Therefore, in the SP tree, you always need to delete the item views of children before deleting the view of the parent. Do not call delete on things returned from invoke_show()

  • this will cause dangling pointers inside the SPItem and lead to a crash. Use the corresponding invoke_hide() method.

Outside of the SP tree, you should not use any references after the root node has been deleted.

Definition at line 81 of file drawing-item.h.

Member Typedef Documentation

◆ ChildrenList

using Inkscape::DrawingItem::ChildrenList = boost::intrusive::list< DrawingItem, boost::intrusive::member_hook<DrawingItem, ListHook, &DrawingItem::_child_hook> >
protected

Definition at line 205 of file drawing-item.h.

◆ ListHook

using Inkscape::DrawingItem::ListHook = boost::intrusive::list_member_hook<>
protected

Definition at line 202 of file drawing-item.h.

Member Enumeration Documentation

◆ ChildType

enum class Inkscape::DrawingItem::ChildType : unsigned char
strongprotected
Enumerator
ORPHAN 
NORMAL 
CLIP 
MASK 
FILL 
STROKE 
ROOT 

Definition at line 169 of file drawing-item.h.

◆ PickFlags

Enumerator
PICK_NORMAL 
PICK_STICKY 
PICK_AS_CLIP 
PICK_OUTLINE 

Definition at line 105 of file drawing-item.h.

◆ RenderFlags

Enumerator
RENDER_DEFAULT 
RENDER_CACHE_ONLY 
RENDER_BYPASS_CACHE 
RENDER_FILTER_BACKGROUND 
RENDER_OUTLINE 
RENDER_NO_FILTERS 
RENDER_VISIBLE_HAIRLINES 

Definition at line 84 of file drawing-item.h.

◆ RenderResult

Enumerator
RENDER_OK 
RENDER_STOP 

Definition at line 179 of file drawing-item.h.

◆ StateFlags

Enumerator
STATE_NONE 
STATE_BBOX 
STATE_CACHE 
STATE_PICK 
STATE_RENDER 
STATE_BACKGROUND 
STATE_ALL 
STATE_TOTAL_INV 

Definition at line 94 of file drawing-item.h.

Constructor & Destructor Documentation

◆ DrawingItem() [1/2]

Inkscape::DrawingItem::DrawingItem ( Drawing drawing)

Definition at line 64 of file drawing-item.cpp.

◆ DrawingItem() [2/2]

Inkscape::DrawingItem::DrawingItem ( DrawingItem const &  )
delete

◆ ~DrawingItem()

Member Function Documentation

◆ _cacheRect()

Geom::OptIntRect Inkscape::DrawingItem::_cacheRect ( ) const
protected

Definition at line 1231 of file drawing-item.cpp.

References _drawbox, _drawing, and Inkscape::Drawing::cacheLimit().

Referenced by _cacheScore(), render(), and update().

◆ _cacheScore()

double Inkscape::DrawingItem::_cacheScore ( )
protected

Compute the caching score.

Higher scores mean the item is more aggressively prioritized for automatic caching by Inkscape::Drawing.

Definition at line 1202 of file drawing-item.cpp.

References _bbox, _cacheRect(), _cacheScore(), _clip, _ctm, _drawing, _filter, _mask, Geom::GenericRect< C >::area(), Geom::GenericOptRect< C >::area(), Geom::GenericRect< C >::from_xywh(), Inkscape::NO_FILTERS, and Inkscape::Drawing::renderMode().

Referenced by _cacheScore(), and update().

◆ _canClip()

virtual bool Inkscape::DrawingItem::_canClip ( ) const
inlineprotectedvirtual

Reimplemented in Inkscape::DrawingGroup, Inkscape::DrawingShape, and Inkscape::DrawingText.

Definition at line 196 of file drawing-item.h.

Referenced by clip().

◆ _clipItem()

virtual void Inkscape::DrawingItem::_clipItem ( DrawingContext dc,
RenderContext rc,
Geom::IntRect const &  area 
) const
inlineprotectedvirtual

Reimplemented in Inkscape::DrawingGroup, Inkscape::DrawingShape, and Inkscape::DrawingText.

Definition at line 194 of file drawing-item.h.

Referenced by clip().

◆ _dropPatternCache()

virtual void Inkscape::DrawingItem::_dropPatternCache ( )
inlineprotectedvirtual

Reimplemented in Inkscape::DrawingPattern.

Definition at line 197 of file drawing-item.h.

Referenced by update().

◆ _invalidateFilterBackground()

void Inkscape::DrawingItem::_invalidateFilterBackground ( Geom::IntRect const &  area)
protected

Definition at line 1142 of file drawing-item.cpp.

References _cache, _children, _drawbox, _filter, and Geom::GenericOptRect< C >::intersects().

Referenced by _markForRendering().

◆ _markForRendering()

◆ _markForUpdate()

void Inkscape::DrawingItem::_markForUpdate ( unsigned  flags,
bool  propagate 
)
protected

Marks the item as needing a recomputation of internal data.

This mechanism avoids traversing the entire rendering tree (which could be vast) on every trivial state changed in any item. Only items marked as needing an update (having some bits in their _state unset) will be traversed during the update call.

The _propagate variable is another optimization. We use it to specify that all children should also have the corresponding flags unset before checking whether they need to be traversed. This way there is one less traversal of the tree. Without this we would need to unset state bits in all children. With _propagate we do this during the update call, when we have to recurse into children anyway.

Definition at line 1170 of file drawing-item.cpp.

References _markForUpdate(), _parent, _propagate_state, _state, drawing(), Inkscape::Drawing::getCanvasItemDrawing(), and Inkscape::CanvasItem::request_update().

Referenced by _markForUpdate(), clearChildren(), Inkscape::Drawing::setAntialiasingOverride(), Inkscape::Drawing::setBlurQuality(), Inkscape::DrawingGroup::setChildTransform(), setClip(), Inkscape::DrawingImage::setClipbox(), Inkscape::Drawing::setDithering(), setFillPattern(), Inkscape::Drawing::setFilterQuality(), Inkscape::DrawingGlyphs::setGlyph(), setMask(), Inkscape::DrawingImage::setOrigin(), Inkscape::Drawing::setOutlineOverlay(), Inkscape::DrawingShape::setPath(), Inkscape::DrawingPattern::setPatternToUserTransform(), Inkscape::DrawingImage::setPixbuf(), Inkscape::Drawing::setRenderMode(), Inkscape::DrawingImage::setScale(), setStrokePattern(), setStyle(), Inkscape::DrawingPattern::setTileRect(), setTransform(), and unlink().

◆ _pickItem()

virtual DrawingItem * Inkscape::DrawingItem::_pickItem ( Geom::Point const &  p,
double  delta,
unsigned  flags 
)
inlineprotectedvirtual

◆ _renderItem()

virtual unsigned Inkscape::DrawingItem::_renderItem ( DrawingContext dc,
RenderContext rc,
Geom::IntRect const &  area,
unsigned  flags,
DrawingItem const *  stop_at 
) const
inlineprotectedvirtual

Reimplemented in Inkscape::DrawingGroup, Inkscape::DrawingImage, Inkscape::DrawingShape, and Inkscape::DrawingText.

Definition at line 193 of file drawing-item.h.

References RENDER_OK.

Referenced by _renderOutline(), and render().

◆ _renderOutline()

void Inkscape::DrawingItem::_renderOutline ( DrawingContext dc,
RenderContext rc,
Geom::IntRect const &  area,
unsigned  flags 
) const
protected

◆ _setCached()

void Inkscape::DrawingItem::_setCached ( bool  cached,
bool  persistent = false 
)
protected

Enable / disable storing the rendering in memory.

Calling setCached(false, true) will also remove the persistent status

Definition at line 256 of file drawing-item.cpp.

References _cache, Inkscape::Drawing::_cached_items, _cached_persistent, and _drawing.

Referenced by update(), and ~DrawingItem().

◆ _updateItem()

virtual unsigned Inkscape::DrawingItem::_updateItem ( Geom::IntRect const &  area,
UpdateContext const &  ctx,
unsigned  flags,
unsigned  reset 
)
inlineprotectedvirtual

◆ appendChild()

◆ bbox()

Geom::OptIntRect const & Inkscape::DrawingItem::bbox ( ) const
inline

Definition at line 119 of file drawing-item.h.

References _bbox.

◆ clearChildren()

void Inkscape::DrawingItem::clearChildren ( )

◆ clip()

void Inkscape::DrawingItem::clip ( DrawingContext dc,
Inkscape::RenderContext rc,
Geom::IntRect const &  area 
) const

Rasterize the clipping path.

This method submits drawing operations required to draw a basic filled shape of the item to the supplied drawing context. Rendering is limited to the given area. The rendering of the clipped object is composited into the result of this call using the IN operator. See the implementation of render() for details.

Definition at line 988 of file drawing-item.cpp.

References _bbox, _canClip(), _clip, _clipItem(), _visible, clip(), Geom::GenericRect< C >::intersects(), Inkscape::DrawingContext::paint(), Inkscape::DrawingContext::popGroupToSource(), Inkscape::DrawingContext::pushGroup(), rc, Inkscape::DrawingContext::setOperator(), and Inkscape::DrawingContext::setSource().

Referenced by clip(), and render().

◆ ctm()

Geom::Affine const & Inkscape::DrawingItem::ctm ( ) const
inline

Definition at line 122 of file drawing-item.h.

References _ctm.

Referenced by update().

◆ defer()

◆ drawbox()

Geom::OptIntRect const & Inkscape::DrawingItem::drawbox ( ) const
inline

Definition at line 120 of file drawing-item.h.

References _drawbox.

Referenced by Inkscape::Filters::FilterImage::render_cairo().

◆ drawing()

Drawing & Inkscape::DrawingItem::drawing ( ) const
inline

Definition at line 124 of file drawing-item.h.

References _drawing.

Referenced by _markForRendering(), _markForUpdate(), and defer().

◆ getItem()

SPItem * Inkscape::DrawingItem::getItem ( ) const
inline

Definition at line 157 of file drawing-item.h.

References _item.

Referenced by SPDesktop::drawing_handler(), and Inkscape::UI::View::SVGViewWidget::event().

◆ getUpdateComplexity()

int Inkscape::DrawingItem::getUpdateComplexity ( ) const
inline

Definition at line 127 of file drawing-item.h.

References _update_complexity.

◆ isAncestorOf()

bool Inkscape::DrawingItem::isAncestorOf ( DrawingItem const *  item) const

Returns true if item is among the descendants. Will return false if item == this.

Definition at line 123 of file drawing-item.cpp.

References c, and item.

◆ itemBounds()

Geom::OptRect const & Inkscape::DrawingItem::itemBounds ( ) const
inline

Definition at line 121 of file drawing-item.h.

References _item_bbox.

◆ key()

unsigned Inkscape::DrawingItem::key ( ) const
inline

Definition at line 155 of file drawing-item.h.

References _key.

Referenced by SPItem::ensure_key(), setKey(), SPShape::show(), and sp_marker_show_instance().

◆ name()

Glib::ustring Inkscape::DrawingItem::name ( ) const

Definition at line 1077 of file drawing-item.cpp.

References _item, and SPObject::getId().

Referenced by recursivePrintTree().

◆ operator=()

DrawingItem & Inkscape::DrawingItem::operator= ( DrawingItem const &  )
delete

◆ parent()

DrawingItem * Inkscape::DrawingItem::parent ( ) const
inline

Definition at line 125 of file drawing-item.h.

References _parent.

◆ pick()

DrawingItem * Inkscape::DrawingItem::pick ( Geom::Point const &  p,
double  delta,
unsigned  flags = 0 
)

Get the item under the specified point.

Searches the tree for the first item in the Z-order which is closer than delta to the given point. The pick should be visual - for example an object with a thick stroke should pick on the entire area of the stroke.

Parameters
pSearch point
deltaMaximum allowed distance from the point
stickyWhether the pick should ignore visibility and sensitivity. When false, only visible and sensitive objects are considered. When true, invisible and insensitive objects can also be picked.

Definition at line 1026 of file drawing-item.cpp.

References _bbox, _clip, _drawbox, _mask, _pickItem(), _sensitive, _state, _visible, Geom::GenericRect< C >::contains(), delta, Geom::GenericRect< C >::expandBy(), Inkscape::outline(), pick(), PICK_AS_CLIP, PICK_OUTLINE, PICK_STICKY, STATE_BBOX, and STATE_PICK.

Referenced by Inkscape::DrawingGroup::_pickItem(), Inkscape::DrawingImage::_pickItem(), Inkscape::DrawingShape::_pickItem(), Inkscape::CanvasItemDrawing::contains(), Inkscape::CanvasItemDrawing::handle_event(), Inkscape::Drawing::pick(), and pick().

◆ prependChild()

void Inkscape::DrawingItem::prependChild ( DrawingItem item)

◆ recursivePrintTree()

void Inkscape::DrawingItem::recursivePrintTree ( unsigned  level = 0) const

Definition at line 1090 of file drawing-item.cpp.

References _children, and name().

◆ render() [1/2]

unsigned Inkscape::DrawingItem::render ( DrawingContext dc,
Geom::IntRect const &  area,
unsigned  flags = 0 
) const

A stand alone render, ignoring all other objects in the document.

Definition at line 944 of file drawing-item.cpp.

References Inkscape::Drawing::_antialiasing_override, _drawing, Inkscape::Drawing::_use_dithering, Inkscape::RenderContext::outline_color, rc, and render().

◆ render() [2/2]

unsigned Inkscape::DrawingItem::render ( DrawingContext dc,
RenderContext rc,
Geom::IntRect const &  area,
unsigned  flags = 0,
DrawingItem const *  stop_at = nullptr 
) const

Rasterize items.

This method submits the drawing operations required to draw this item to the supplied DrawingContext, restricting drawing the specified area.

This method does some common tasks and calls the item-specific rendering function, _renderItem(), to render e.g. paths or bitmaps.

Parameters
flagsRendering options. This deals mainly with cache control.

Definition at line 703 of file drawing-item.cpp.

References _antialias, _background_accumulate, _blend_mode, _cache, _cacheRect(), _child_type, _clip, _contains_unisolated_blend, _ctm, _drawbox, _drawing, _filter, _isolation, _mask, _opacity, _renderItem(), _renderOutline(), _visible, Inkscape::apply_antialias(), clip(), Inkscape::Drawing::colorMode(), Inkscape::DrawingSurface::device_scale(), Inkscape::DrawingContext::fill(), Inkscape::GRAYSCALE, Inkscape::Drawing::grayscaleMatrix(), ink_cairo_surface_filter(), ink_css_blend_to_cairo_operator(), Geom::GenericOptRect< C >::intersectWith(), Geom::Affine::isSingular(), Inkscape::outline(), Inkscape::DrawingContext::paint(), Inkscape::DrawingContext::popGroupToSource(), Inkscape::DrawingContext::pushGroup(), Inkscape::DrawingContext::raw(), Inkscape::DrawingContext::rawTarget(), rc, Inkscape::DrawingContext::rectangle(), render(), RENDER_BYPASS_CACHE, RENDER_FILTER_BACKGROUND, RENDER_NO_FILTERS, RENDER_OK, RENDER_OUTLINE, RENDER_STOP, ROOT, Inkscape::DrawingContext::setOperator(), Inkscape::DrawingContext::setSource(), SP_CSS_BLEND_NORMAL, SP_CSS_ISOLATION_ISOLATE, and Inkscape::DrawingContext::surface().

Referenced by _renderOutline(), render(), Inkscape::Drawing::render(), render(), Inkscape::Filters::FilterImage::render_cairo(), and Inkscape::DrawingPattern::renderPattern().

◆ sensitive()

bool Inkscape::DrawingItem::sensitive ( ) const
inline

Definition at line 136 of file drawing-item.h.

References _sensitive.

Referenced by setSensitive().

◆ setAntialiasing()

void Inkscape::DrawingItem::setAntialiasing ( Antialiasing  antialias)

Definition at line 209 of file drawing-item.cpp.

References _antialias, _markForRendering(), and defer().

◆ setBlendMode()

void Inkscape::DrawingItem::setBlendMode ( SPBlendMode  blend_mode)

Definition at line 227 of file drawing-item.cpp.

References _blend_mode, _markForRendering(), and defer().

◆ setChildrenStyle()

void Inkscape::DrawingItem::setChildrenStyle ( SPStyle const *  context_style)
virtual

Recursively update children style.

The purpose of this call is to update fill and stroke for markers that have elements with fill/stroke property values of 'context-fill' or 'context-stroke'. Marker styling is not updated like other 'clones' as marker instances are not included the SP object tree. Note: this is a virtual function.

Reimplemented in Inkscape::DrawingShape, and Inkscape::DrawingText.

Definition at line 333 of file drawing-item.cpp.

References _children, and _context_style.

Referenced by Inkscape::DrawingShape::setChildrenStyle(), and Inkscape::DrawingText::setChildrenStyle().

◆ setClip()

void Inkscape::DrawingItem::setClip ( DrawingItem item)

Definition at line 341 of file drawing-item.cpp.

References _clip, _markForRendering(), _markForUpdate(), CLIP, defer(), item, ORPHAN, and STATE_ALL.

◆ setFillPattern()

void Inkscape::DrawingItem::setFillPattern ( DrawingPattern pattern)

◆ setFilterRenderer()

void Inkscape::DrawingItem::setFilterRenderer ( std::unique_ptr< Filters::Filter renderer)

Definition at line 428 of file drawing-item.cpp.

References _filter, _markForRendering(), and defer().

◆ setIsolation()

void Inkscape::DrawingItem::setIsolation ( bool  isolation)

Definition at line 218 of file drawing-item.cpp.

References _isolation, _markForRendering(), and defer().

◆ setItem()

void Inkscape::DrawingItem::setItem ( SPItem item)
inline

Definition at line 156 of file drawing-item.h.

References _item, and item.

◆ setItemBounds()

void Inkscape::DrawingItem::setItemBounds ( Geom::OptRect const &  bounds)

Definition at line 421 of file drawing-item.cpp.

References _item_bbox, bounds, and defer().

◆ setKey()

void Inkscape::DrawingItem::setKey ( unsigned  key)
inline

Definition at line 154 of file drawing-item.h.

References _key, and key().

Referenced by SPItem::ensure_key().

◆ setMask()

void Inkscape::DrawingItem::setMask ( DrawingItem item)

Definition at line 357 of file drawing-item.cpp.

References _markForRendering(), _markForUpdate(), _mask, defer(), item, MASK, ORPHAN, and STATE_ALL.

◆ setOpacity()

◆ setSensitive()

void Inkscape::DrawingItem::setSensitive ( bool  sensitive)

Definition at line 245 of file drawing-item.cpp.

References _sensitive, defer(), and sensitive().

◆ setStrokePattern()

void Inkscape::DrawingItem::setStrokePattern ( DrawingPattern pattern)

◆ setStyle()

◆ setTransform()

◆ setVisible()

void Inkscape::DrawingItem::setVisible ( bool  visible)

Definition at line 236 of file drawing-item.cpp.

References _markForRendering(), _visible, defer(), and visible().

◆ setZOrder()

void Inkscape::DrawingItem::setZOrder ( unsigned  zorder)

Move this item to the given place in the Z order of siblings. Does nothing if the item is not a normal child.

Definition at line 406 of file drawing-item.cpp.

References _child_type, _children, _markForRendering(), _parent, defer(), and NORMAL.

Referenced by SPPattern::order_changed().

◆ tag()

virtual int Inkscape::DrawingItem::tag ( ) const
inlinevirtual

Unlink this node and its subtree from the rendering tree and destroy.

Reimplemented in Inkscape::DrawingGroup, Inkscape::DrawingImage, Inkscape::DrawingPattern, Inkscape::DrawingShape, Inkscape::DrawingGlyphs, and Inkscape::DrawingText.

Definition at line 117 of file drawing-item.h.

References tag_of.

◆ transform()

Geom::Affine Inkscape::DrawingItem::transform ( ) const
inline

◆ unisolatedBlend()

bool Inkscape::DrawingItem::unisolatedBlend ( ) const

◆ unlink()

◆ update()

void Inkscape::DrawingItem::update ( Geom::IntRect const &  area = Geom::IntRect::infinite(),
UpdateContext const &  ctx = UpdateContext(),
unsigned  flags = STATE_ALL,
unsigned  reset = 0 
)

Update derived data before operations.

The purpose of this call is to recompute internal data which depends on the attributes of the object, but is not directly settable by the user. Precomputing this data speeds up later rendering, because some items can be omitted.

Currently this method handles updating the visual and geometric bounding boxes in pixels, storing the total transformation from item space to the screen and cache invalidation.

Parameters
areaArea to which the update should be restricted. Only takes effect if the bounding box is known.
ctxA structure to store cascading state.
flagsWhich internal data should be recomputed. This can be any combination of StateFlags.
resetState fields that should be reset before processing them. This is a means to force a recomputation of internal data even if the item considers it up to date. Mainly for internal use, such as propagating bounding box recomputation to children when the item's transform changes.

Definition at line 458 of file drawing-item.cpp.

References _background_accumulate, _background_new, _bbox, _blend_mode, _cache, _cache_iterator, _cacheRect(), _cacheScore(), Inkscape::Drawing::_candidate_items, _child_type, _clip, _contains_unisolated_blend, _ctm, _drawbox, _drawing, _dropPatternCache(), _fill_pattern, _filter, _has_cache_iterator, _isolation, _item_bbox, _markForRendering(), _mask, _opacity, _parent, _propagate_state, _setCached(), _state, _stroke_pattern, _transform, _update_complexity, _updateItem(), _visible, Geom::are_near(), Geom::GenericOptRect< C >::area(), c, CACHE_SCORE_THRESHOLD, Inkscape::CacheRecord::cache_size, Inkscape::UpdateContext::ctm, ctm(), Geom::Affine::descrim(), Geom::GenericRect< C >::intersects(), Geom::GenericOptRect< C >::intersectWith(), Geom::Affine::inverse(), Inkscape::CacheRecord::item, Inkscape::NO_FILTERS, NORMAL, Inkscape::OUTLINE, Inkscape::outline(), Inkscape::Drawing::outlineOverlay(), Inkscape::Drawing::renderMode(), ROOT, Inkscape::CacheRecord::score, Geom::Affine::setTranslation(), SP_CSS_BLEND_NORMAL, SP_CSS_ISOLATION_ISOLATE, STATE_ALL, STATE_BACKGROUND, STATE_BBOX, STATE_CACHE, STATE_RENDER, STATE_TOTAL_INV, style_vector_effect_fixed, style_vector_effect_rotate, style_vector_effect_size, Geom::GenericOptRect< C >::unionWith(), and update().

Referenced by Inkscape::Filters::FilterImage::update(), Inkscape::Drawing::update(), and update().

◆ visible()

bool Inkscape::DrawingItem::visible ( ) const
inline

Friends And Related Symbol Documentation

◆ Drawing

friend class Drawing
friend

Definition at line 266 of file drawing-item.h.

Member Data Documentation

◆ _antialias

Antialiasing Inkscape::DrawingItem::_antialias
protected

antialiasing level (default is Good)

Definition at line 253 of file drawing-item.h.

Referenced by Inkscape::Drawing::render(), render(), and setAntialiasing().

◆ _background_accumulate

unsigned Inkscape::DrawingItem::_background_accumulate
protected

Whether this element accumulates background (has any ancestor with enable-background: new)

Definition at line 245 of file drawing-item.h.

Referenced by render(), and update().

◆ _background_new

unsigned Inkscape::DrawingItem::_background_new
protected

Whether enable-background: new is set for this element.

Definition at line 244 of file drawing-item.h.

Referenced by setStyle(), and update().

◆ _bbox

◆ _blend_mode

SPBlendMode Inkscape::DrawingItem::_blend_mode
protected

Definition at line 256 of file drawing-item.h.

Referenced by render(), setBlendMode(), unisolatedBlend(), and update().

◆ _cache

std::unique_ptr<CacheData> Inkscape::DrawingItem::_cache
protected

Definition at line 231 of file drawing-item.h.

Referenced by _invalidateFilterBackground(), _setCached(), render(), and update().

◆ _cache_iterator

CacheList::iterator Inkscape::DrawingItem::_cache_iterator
protected

Definition at line 235 of file drawing-item.h.

Referenced by update(), and ~DrawingItem().

◆ _cached_persistent

unsigned Inkscape::DrawingItem::_cached_persistent
protected

If set, will always be cached regardless of score.

Definition at line 249 of file drawing-item.h.

Referenced by _setCached().

◆ _child_hook

ListHook Inkscape::DrawingItem::_child_hook
protected

Definition at line 203 of file drawing-item.h.

◆ _child_type

ChildType Inkscape::DrawingItem::_child_type
protected

◆ _children

◆ _clip

DrawingItem* Inkscape::DrawingItem::_clip
protected

◆ _contains_unisolated_blend

bool Inkscape::DrawingItem::_contains_unisolated_blend
protected

◆ _context_style

◆ _ctm

◆ _drawbox

Geom::OptIntRect Inkscape::DrawingItem::_drawbox
protected

Full visual bounding box - enlarged by filters, shrunk by clips and masks.

Definition at line 221 of file drawing-item.h.

Referenced by _cacheRect(), _invalidateFilterBackground(), _markForRendering(), drawbox(), pick(), render(), and update().

◆ _drawing

◆ _fill_pattern

◆ _filter

std::unique_ptr<Inkscape::Filters::Filter> Inkscape::DrawingItem::_filter
protected

◆ _has_cache_iterator

unsigned Inkscape::DrawingItem::_has_cache_iterator
protected

If set, _cache_iterator is valid.

Definition at line 250 of file drawing-item.h.

Referenced by update(), and ~DrawingItem().

◆ _isolation

bool Inkscape::DrawingItem::_isolation
protected

Definition at line 255 of file drawing-item.h.

Referenced by render(), setIsolation(), unisolatedBlend(), and update().

◆ _item

SPItem* Inkscape::DrawingItem::_item
protected

Used to associate DrawingItems with SPItems that created them.

Definition at line 213 of file drawing-item.h.

Referenced by getItem(), name(), and setItem().

◆ _item_bbox

Geom::OptRect Inkscape::DrawingItem::_item_bbox
protected

Geometric bounding box in item's user space.

This is used to compute the filter effect region and render in objectBoundingBox units.

Definition at line 222 of file drawing-item.h.

Referenced by Inkscape::DrawingShape::_renderFill(), Inkscape::DrawingShape::_renderItem(), Inkscape::DrawingText::_renderItem(), Inkscape::DrawingShape::_renderStroke(), itemBounds(), setItemBounds(), and update().

◆ _key

unsigned Inkscape::DrawingItem::_key
protected

Auxiliary key used by the object tree for showing clips/masks/patterns.

Definition at line 212 of file drawing-item.h.

Referenced by key(), and setKey().

◆ _mask

DrawingItem* Inkscape::DrawingItem::_mask
protected

◆ _opacity

float Inkscape::DrawingItem::_opacity
protected

◆ _parent

◆ _pick_children

unsigned Inkscape::DrawingItem::_pick_children
protected

For groups: if true, children are returned from pick(), otherwise the group is returned.

Definition at line 251 of file drawing-item.h.

Referenced by Inkscape::DrawingGroup::_pickItem(), Inkscape::DrawingGroup::pickChildren(), and Inkscape::DrawingGroup::setPickChildren().

◆ _propagate_state

unsigned Inkscape::DrawingItem::_propagate_state
protected

Definition at line 242 of file drawing-item.h.

Referenced by _markForUpdate(), and update().

◆ _sensitive

unsigned Inkscape::DrawingItem::_sensitive
protected

Whether this item responds to events.

Definition at line 248 of file drawing-item.h.

Referenced by pick(), sensitive(), and setSensitive().

◆ _state

unsigned Inkscape::DrawingItem::_state
protected

Definition at line 241 of file drawing-item.h.

Referenced by _markForUpdate(), Inkscape::DrawingShape::_updateItem(), pick(), and update().

◆ _stroke_pattern

◆ _style

◆ _transform

std::unique_ptr<Geom::Affine> Inkscape::DrawingItem::_transform
protected

Incremental transform from parent to this item's coords.

Definition at line 218 of file drawing-item.h.

Referenced by Inkscape::DrawingGlyphs::_updateItem(), setTransform(), transform(), and update().

◆ _update_complexity

int Inkscape::DrawingItem::_update_complexity = 0
protected

◆ _visible

unsigned Inkscape::DrawingItem::_visible
protected

Definition at line 247 of file drawing-item.h.

Referenced by clip(), pick(), render(), setVisible(), update(), and visible().

◆ style_vector_effect_fixed

bool Inkscape::DrawingItem::style_vector_effect_fixed
protected

Definition at line 239 of file drawing-item.h.

Referenced by setStyle(), and update().

◆ style_vector_effect_rotate

bool Inkscape::DrawingItem::style_vector_effect_rotate
protected

Definition at line 238 of file drawing-item.h.

Referenced by setStyle(), and update().

◆ style_vector_effect_size

bool Inkscape::DrawingItem::style_vector_effect_size
protected

Definition at line 237 of file drawing-item.h.

Referenced by setStyle(), and update().


The documentation for this class was generated from the following files: