Inkscape
Vector Graphics Editor
|
Gradient. More...
#include <sp-gradient.h>
Public Member Functions | |
SPGradient () | |
~SPGradient () override | |
int | tag () const override |
SPGradientVector const & | getGradientVector () const |
bool | hasStops () const |
SPStop * | getFirstStop () |
int | getStopCount () const |
bool | isEquivalent (SPGradient *b) |
return true if this gradient is "equivalent" to that gradient. | |
bool | isAligned (SPGradient *b) |
return true if this gradient is "aligned" to that gradient. | |
bool | hasPatches () const |
bool | isUnitsSet () const |
All Gradients. | |
SPGradientUnits | getUnits () const |
void | setUnits (SPGradientUnits units) |
Set units property of gradient and emit modified. | |
bool | isSpreadSet () const |
SPGradientSpread | getSpread () const |
SPGradient * | getVector (bool force_private=false) |
Returns private vector of given gradient (the gradient at the end of the href chain which has stops), optionally normalizing it. | |
SPGradient const * | getVector (bool force_private=false) const |
SPGradient * | getArray (bool force_private=false) |
Returns private mesh of given gradient (the gradient at the end of the href chain which has patches), optionally normalizing it. | |
void | ensureVector () |
Forces vector to be built, if not present (i.e. | |
void | ensureArray () |
Forces array (mesh) to be built, if not present (i.e. | |
void | setSpread (SPGradientSpread spread) |
Set spread property of gradient and emit modified. | |
SPGradientSpread | fetchSpread () const |
Returns the effective spread of given gradient (climbing up the refs chain if needed). | |
SPGradientUnits | fetchUnits () |
Returns the effective units of given gradient (climbing up the refs chain if needed). | |
void | setSwatch (bool swatch=true) |
void | setPinned (bool pinned=true) |
bool | isPinned () const |
bool | isSolid () const |
void | repr_write_vector () |
Writes the gradient's internal vector (whether from its own stops, or inherited from refs) into the gradient repr as svg:stop elements. | |
void | repr_clear_vector () |
Clears the gradient's svg:stop children from its repr. | |
cairo_pattern_t * | create_preview_pattern (double width) |
Geom::Affine | get_g2d_matrix (Geom::Affine const &ctm, Geom::Rect const &bbox) const |
Transforms to/from gradient position space in given environment. | |
Geom::Affine | get_gs2d_matrix (Geom::Affine const &ctm, Geom::Rect const &bbox) const |
void | set_gs2d_matrix (Geom::Affine const &ctm, Geom::Rect const &bbox, Geom::Affine const &gs2d) |
Geom::OptRect | getAllItemsBox () const |
Return a visual bounding box that covers every item this gradient would paint added together. | |
![]() | |
SPPaintServer () | |
~SPPaintServer () override | |
int | tag () const override |
bool | isSwatch () const |
virtual bool | isValid () const |
virtual std::unique_ptr< Inkscape::DrawingPaintServer > | create_drawing_paintserver () |
virtual Inkscape::DrawingPattern * | show (Inkscape::Drawing &drawing, unsigned key, Geom::OptRect const &bbox) |
virtual void | hide (unsigned key) |
virtual void | setBBox (unsigned key, Geom::OptRect const &bbox) |
![]() | |
SPObject () | |
Constructor, sets all attributes to default values. | |
SPObject (SPObject const &)=delete | |
SPObject & | operator= (SPObject const &)=delete |
~SPObject () override | |
Destructor, frees the used memory and unreferences a potential successor of the object. | |
char const * | getId () const |
Returns the objects current ID string. | |
void | getIds (std::set< std::string > &ret) const |
Accumulate this id and all it's descendants ids. | |
std::string | getUrl () const |
Get the id in a URL format. | |
Inkscape::XML::Node * | getRepr () |
Returns the XML representation of tree. | |
Inkscape::XML::Node const * | getRepr () const |
Returns the XML representation of tree. | |
void | releaseReferences () |
Cleans up an SPObject, releasing its references and requesting that references to it be released. | |
sigc::connection | connectRelease (sigc::slot< void(SPObject *)> slot) |
Connects to the release request signal. | |
bool | isSiblingOf (SPObject const *object) const |
virtual void | getLinked (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Get objects which are linked to this object as either a source or a target. | |
std::vector< SPObject * > | getLinked (LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Get objects which are linked, like above. | |
bool | isAncestorOf (SPObject const *object) const |
True if object is non-NULL and this is some in/direct parent of object. | |
SPObject const * | nearestCommonAncestor (SPObject const *object) const |
Returns youngest object being parent to this and object. | |
SPObject const * | getTopAncestorNonLayer () const |
Returns ancestor non layer. | |
SPObject * | getNext () |
SPObject * | getPrev () |
Returns previous object in sibling list or NULL. | |
bool | hasChildren () const |
SPObject * | firstChild () |
SPObject const * | firstChild () const |
SPObject * | lastChild () |
SPObject const * | lastChild () const |
SPObject * | nthChild (unsigned index) |
SPObject const * | nthChild (unsigned index) const |
std::vector< SPObject * > | childList (bool add_ref, Action action=ActionGeneral) |
Retrieves the children as a std vector object, optionally ref'ing the children in the process, if add_ref is specified. | |
std::vector< SPObject * > | ancestorList (bool root_to_tip) |
Retrieves a list of ancestors of the object, as an easy to use vector. | |
SPObject * | appendChildRepr (Inkscape::XML::Node *repr) |
Append repr as child of this object. | |
char const * | label () const |
Gets the author-visible label property for the object or a default if no label is defined. | |
char const * | defaultLabel () const |
Returns a default label property for this object. | |
void | setLabel (char const *label) |
Sets the author-visible label for this object. | |
char * | title () const |
Returns the title of this object, or NULL if there is none. | |
bool | setTitle (char const *title, bool verbatim=false) |
Sets the title of this object. | |
char * | desc () const |
Returns the description of this object, or NULL if there is none. | |
bool | setDesc (char const *desc, bool verbatim=false) |
Sets the description of this object. | |
Glib::ustring | getExportFilename () const |
Get and set the exportable filename on this object. | |
void | setExportFilename (Glib::ustring filename) |
Geom::Point | getExportDpi () const |
Get and set the exported DPI for this objet, if available. | |
void | setExportDpi (Geom::Point dpi) |
CollectionPolicy | collectionPolicy () const |
Set the policy under which this object will be orphan-collected. | |
void | setCollectionPolicy (CollectionPolicy policy) |
Sets the orphan-collection policy in effect for this object. | |
void | requestOrphanCollection () |
Requests a later automatic call to collectOrphan(). | |
void | collectOrphan () |
Unconditionally delete the object if it is not referenced. | |
void | hrefObject (SPObject *owner=nullptr) |
Increase weak refcount. | |
void | unhrefObject (SPObject *owner=nullptr) |
Decrease weak refcount. | |
bool | isReferenced () |
Check if object is referenced by any other object. | |
void | deleteObject (bool propagate, bool propagate_descendants) |
Deletes an object, unparenting it from its parent. | |
void | deleteObject (bool propagate=true) |
Deletes on object. | |
void | cropToObject (SPObject *except) |
Removes all children except for the given object, it's children and it's ancesstors. | |
void | cropToObjects (std::vector< SPObject * > except_objects) |
Removes objects which are not related to given list of objects. | |
void | getObjectsExcept (std::vector< SPObject * > &objects, const std::vector< SPObject * > &except) |
Get all child objects except for any in the list. | |
void | getLinkedRecursive (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Grows the input list with all linked items recursively in both child nodes and links of links. | |
sigc::connection | connectDelete (sigc::slot< void(SPObject *)> slot) |
Connects a slot to be called when an object is deleted. | |
sigc::connection | connectPositionChanged (sigc::slot< void(SPObject *)> slot) |
SPObject * | successor () |
Returns the object which supercedes this one (if any). | |
void | setSuccessor (SPObject *successor) |
Indicates that another object supercedes this one. | |
void | setTmpSuccessor (SPObject *tmpsuccessor) |
Indicates that another object supercedes temporaty this one. | |
void | unsetTmpSuccessor () |
Unset object supercedes. | |
void | fixTmpSuccessors () |
Fix temporary successors in duple stamp. | |
Inkscape::XML::Node * | updateRepr (unsigned int flags=SP_OBJECT_WRITE_EXT) |
Updates the object's repr based on the object's state. | |
Inkscape::XML::Node * | updateRepr (Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) |
Updates the given repr based on the object's state. | |
void | requestDisplayUpdate (unsigned int flags) |
Queues an deferred update of this object's display. | |
void | updateDisplay (SPCtx *ctx, unsigned int flags) |
Updates the object's display immediately. | |
void | requestModified (unsigned int flags) |
Requests that a modification notification signal be emitted later (e.g. | |
void | emitModified (unsigned int flags) |
Emits the MODIFIED signal with the object's flags. | |
sigc::connection | connectModified (sigc::slot< void(SPObject *, unsigned int)> slot) |
Connects to the modification notification signal. | |
void | _sendDeleteSignalRecursive () |
Sends the delete signal to all children of this object recursively. | |
void | _updateTotalHRefCount (int increment) |
Adds increment to _total_hrefcount of object and its parents. | |
void | _requireSVGVersion (unsigned major, unsigned minor) |
void | _requireSVGVersion (Inkscape::Version version) |
Lifts SVG version of all root objects to version. | |
void | attach (SPObject *object, SPObject *prev) |
Put object into object tree, under parent, and behind prev; also update object's XML space. | |
void | reorder (SPObject *obj, SPObject *prev) |
In list of object's children, move object behind prev. | |
void | detach (SPObject *object) |
Remove object from parent's children, release and unref it. | |
SPObject * | get_child_by_repr (Inkscape::XML::Node *repr) |
Return object's child whose node pointer equals repr. | |
void | invoke_build (SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) |
int | getIntAttribute (char const *key, int def) |
unsigned | getPosition () |
char const * | getAttribute (char const *name) const |
void | appendChild (Inkscape::XML::Node *child) |
void | addChild (Inkscape::XML::Node *child, Inkscape::XML::Node *prev=nullptr) |
void | setKeyValue (SPAttr key, char const *value) |
Call virtual set() function of object. | |
void | setAttribute (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | setAttributeDouble (Inkscape::Util::const_char_ptr key, double value) |
void | setAttributeOrRemoveIfEmpty (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | readAttr (char const *key) |
Read value of key attribute from XML node into object. | |
void | readAttr (SPAttr keyid) |
char const * | getTagName () const |
void | removeAttribute (char const *key) |
void | setCSS (SPCSSAttr *css, char const *attr) |
void | changeCSS (SPCSSAttr *css, char const *attr) |
bool | storeAsDouble (char const *key, double *val) const |
virtual void | read_content () |
void | recursivePrintTree (unsigned level=0) |
void | objectTrace (std::string const &, bool in=true, unsigned flags=0) |
std::string | generate_unique_id (char const *default_id=nullptr) const |
Generate a document-wide unique id for this object. | |
Static Public Member Functions | |
static void | gradientRefModified (SPObject *href, unsigned int flags, SPGradient *gradient) |
static void | gradientRefChanged (SPObject *old_ref, SPObject *ref, SPGradient *gr) |
Gets called when the gradient is (re)attached to another gradient. | |
Public Attributes | |
Geom::Affine | gradientTransform |
gradientTransform attribute | |
unsigned int | gradientTransform_set: 1 |
SPGradientReference * | ref |
Reference (href) | |
unsigned int | state |
State in Inkscape gradient system. | |
SPGradientVector | vector |
Linear and Radial Gradients. | |
sigc::connection | modified_connection |
SPMeshNodeArray | array |
Mesh Gradients. | |
SPMeshNodeArray | array_smoothed |
![]() | |
unsigned int | cloned: 1 |
SPObject * | clone_original {nullptr} |
unsigned int | uflags: 16 |
unsigned int | mflags: 16 |
SPIXmlSpace | xml_space |
Glib::ustring | lang |
unsigned int | hrefcount {0} |
unsigned int | _total_hrefcount {0} |
SPDocument * | document {nullptr} |
SPObject * | parent {nullptr} |
int | refCount {1} |
std::list< SPObject * > | hrefList |
SPStyle * | style |
Represents the style properties, whether from presentation attributes, the style attribute, or inherited. | |
SPStyle * | context_style |
Represents the style that should be used to resolve 'context-fill' and 'context-stroke'. | |
sigc::signal< void(SPObject *)> | _release_signal |
sigc::signal< void(SPObject *)> | _delete_signal |
sigc::signal< void(SPObject *)> | _position_changed_signal |
sigc::signal< void(SPObject *, unsigned int)> | _modified_signal |
SPObject * | _successor {nullptr} |
SPObject * | _tmpsuccessor {nullptr} |
CollectionPolicy | _collection_policy {SPObject::COLLECT_WITH_PARENT} |
char * | _label {nullptr} |
char * | _default_label {nullptr} |
ChildrenList | children |
Protected Member Functions | |
void | build (SPDocument *document, Inkscape::XML::Node *repr) override |
Virtual build: set gradient attributes from its associated repr. | |
void | release () override |
Virtual release of SPGradient members before destruction. | |
void | modified (unsigned int flags) override |
Callback for modified event. | |
Inkscape::XML::Node * | write (Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override |
Write gradient attributes to repr. | |
void | child_added (Inkscape::XML::Node *child, Inkscape::XML::Node *ref) override |
Callback for child_added event. | |
void | remove_child (Inkscape::XML::Node *child) override |
Callback for remove_child event. | |
void | set (SPAttr key, char const *value) override |
Set gradient attribute to value. | |
![]() | |
virtual void | order_changed (Inkscape::XML::Node *child, Inkscape::XML::Node *old_repr, Inkscape::XML::Node *new_repr) |
virtual void | tag_name_changed (gchar const *oldname, gchar const *newname) |
virtual void | update (SPCtx *ctx, unsigned int flags) |
Private Member Functions | |
bool | invalidateVector () |
Return true if change made. | |
bool | invalidateArray () |
Return true if change made. | |
void | rebuildVector () const |
Creates normalized color vector. | |
void | rebuildArray () |
Creates normalized color mesh patch array. | |
Private Attributes | |
SPGradientUnits | units |
gradientUnits attribute | |
unsigned int | units_set: 1 |
SPGradientSpread | spread |
spreadMethod attribute | |
unsigned int | spread_set: 1 |
unsigned int | has_stops: 1 |
Gradient stops. | |
unsigned int | has_patches: 1 |
Gradient patches. | |
bool | _pinned = false |
Pinned in swatches dialog. | |
Additional Inherited Members | |
![]() | |
enum | CollectionPolicy { COLLECT_WITH_PARENT , ALWAYS_COLLECT } |
enum class | LinkedObjectNature { DEPENDENT = -1 , ANY = 0 , DEPENDENCY = 1 } |
enum | Action { ActionGeneral , ActionBBox , ActionUpdate , ActionShow } |
typedef Inkscape::Util::ForwardPointerIterator< SPObject, ParentIteratorStrategy > | ParentIterator |
typedef Inkscape::Util::ForwardPointerIterator< SPObject const, ParentIteratorStrategy > | ConstParentIterator |
using | ChildrenList = boost::intrusive::list< SPObject, boost::intrusive::member_hook< SPObject, ListHook, &SPObject::_child_hook > > |
![]() | |
typedef boost::intrusive::list_member_hook | ListHook |
![]() | |
bool | swatch = false |
![]() | |
ListHook | _child_hook |
Gradient.
Implement spread, stops list
Definition at line 84 of file sp-gradient.h.
SPGradient::SPGradient | ( | ) |
Definition at line 238 of file sp-gradient.cpp.
References SPGradientVector::built, Inkscape::URIReference::changedSignal(), gradientRefChanged(), gradientTransform, gradientTransform_set, has_patches, has_stops, Geom::identity(), ref, SP_GRADIENT_SPREAD_PAD, SP_GRADIENT_STATE_UNKNOWN, SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX, spread, spread_set, state, SPGradientVector::stops, units, units_set, and vector.
|
overridedefault |
|
overrideprotectedvirtual |
Virtual build: set gradient attributes from its associated repr.
Reimplemented from SPObject.
Reimplemented in SPLinearGradient, SPMeshGradient, and SPRadialGradient.
Definition at line 274 of file sp-gradient.cpp.
References SPDocument::addResource(), Inkscape::XML::Node::attribute(), SPObject::build(), SPObject::children, GRADIENTTRANSFORM, GRADIENTUNITS, has_patches, has_stops, INKSCAPE_PINNED, INKSCAPE_SWATCH, SPObject::readAttr(), Inkscape::XML::Node::removeAttribute(), SPObject::repr, SPREADMETHOD, STYLE, and XLINK_HREF.
Referenced by SPLinearGradient::build(), SPMeshGradient::build(), and SPRadialGradient::build().
|
overrideprotectedvirtual |
Callback for child_added event.
Reimplemented from SPObject.
Definition at line 486 of file sp-gradient.cpp.
References SPObject::child_added(), SPObject::get_child_by_repr(), SPObject::getAttribute(), getStopCount(), has_patches, has_stops, invalidateVector(), ref, SPObject::requestModified(), and SPObject::setAttribute().
cairo_pattern_t * SPGradient::create_preview_pattern | ( | double | width | ) |
Definition at line 1185 of file sp-gradient.cpp.
References array, ensureVector(), ink_cairo_pattern_add_color_stop(), node, SPMeshNodeArray::node(), offset, SPMeshNodeArray::patch_columns(), SPGradientVector::stops, vector, and width.
Referenced by sp_gradient_draw().
void SPGradient::ensureArray | ( | ) |
Forces array (mesh) to be built, if not present (i.e.
Forces the array to be built, if not present (i.e., changed).
changed)
Definition at line 730 of file sp-gradient.cpp.
References array, SPMeshNodeArray::built, and rebuildArray().
Referenced by GrDrag::addDraggersMesh(), SPMeshGradient::create_drawing_paintserver(), modified(), and GrDrag::refreshDraggersMesh().
void SPGradient::ensureVector | ( | ) |
Forces vector to be built, if not present (i.e.
Forces the vector to be built, if not present (i.e., changed).
changed)
Definition at line 710 of file sp-gradient.cpp.
References SPGradientVector::built, rebuildVector(), and vector.
Referenced by Inkscape::UI::Widget::SwatchSelector::_changedCb(), GrDrag::addDraggersLinear(), GrDrag::addDraggersRadial(), GrDrag::addStopNearPoint(), Inkscape::Extension::Internal::PrintEmf::create_brush(), Inkscape::Extension::Internal::PrintWmf::create_brush(), SPLinearGradient::create_drawing_paintserver(), SPRadialGradient::create_drawing_paintserver(), create_preview_pattern(), modified(), rebuildVector(), Inkscape::UI::Widget::GradientEditor::set_gradient(), and sp_gradient_ensure_vector_normalized().
SPGradientSpread SPGradient::fetchSpread | ( | ) | const |
Returns the effective spread of given gradient (climbing up the refs chain if needed).
Definition at line 865 of file sp-gradient.cpp.
References chase_hrefs(), has_spread_set(), SP_GRADIENT_SPREAD_PAD, and spread.
Referenced by Inkscape::Extension::Internal::PdfBuilder::Document::get_radial_pattern(), gradientRefChanged(), and sp_item_gradient_get_spread().
SPGradientUnits SPGradient::fetchUnits | ( | ) |
Returns the effective units of given gradient (climbing up the refs chain if needed).
Definition at line 879 of file sp-gradient.cpp.
References chase_hrefs(), has_units_set(), SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX, and units.
Referenced by gradientRefChanged().
Geom::Affine SPGradient::get_g2d_matrix | ( | Geom::Affine const & | ctm, |
Geom::Rect const & | bbox | ||
) | const |
Transforms to/from gradient position space in given environment.
Definition at line 1088 of file sp-gradient.cpp.
References Geom::GenericRect< C >::dimensions(), getUnits(), Geom::GenericRect< C >::min(), and SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX.
Geom::Affine SPGradient::get_gs2d_matrix | ( | Geom::Affine const & | ctm, |
Geom::Rect const & | bbox | ||
) | const |
Definition at line 1100 of file sp-gradient.cpp.
References Geom::GenericRect< C >::dimensions(), getUnits(), gradientTransform, Geom::GenericRect< C >::min(), and SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX.
Geom::OptRect SPGradient::getAllItemsBox | ( | ) | const |
Return a visual bounding box that covers every item this gradient would paint added together.
Definition at line 1131 of file sp-gradient.cpp.
References SPObject::DEPENDENT, SPObject::getLinkedRecursive(), Geom::identity(), item, Geom::GenericOptRect< C >::unionWith(), and SPItem::visualBounds().
Referenced by Inkscape::Extension::Internal::PdfBuilder::Document::get_mesh_pattern(), and Inkscape::Extension::Internal::PdfBuilder::Document::get_radial_pattern().
SPGradient * SPGradient::getArray | ( | bool | force_private = false | ) |
Returns private mesh of given gradient (the gradient at the end of the href chain which has patches), optionally normalizing it.
Definition at line 851 of file sp-gradient.cpp.
References chase_hrefs(), and has_patchesFN().
Referenced by SPMeshNodeArray::read(), sp_gradient_convert_to_userspace(), and SPMeshNodeArray::write().
SPStop * SPGradient::getFirstStop | ( | ) |
Definition at line 597 of file sp-gradient.cpp.
References SPObject::children.
Referenced by Inkscape::UI::Widget::SwatchSelector::_changedCb(), GrDrag::addStopNearPoint(), GrDrag::deleteSelected(), get_before_after_stops(), getStopCount(), gr_knot_clicked_handler(), isEquivalent(), GrDrag::makeStopSafeColor(), Inkscape::UI::Widget::GradientWithStops::modified(), Inkscape::Extension::Internal::OdfOutput::processGradient(), Inkscape::UI::Toolbar::GradientToolbar::select_stop_by_draggers(), Inkscape::UI::Widget::PaintSelector::set_mode_color(), Inkscape::UI::Widget::SwatchSelector::setVector(), sp_get_nth_stop(), sp_get_stop_i(), sp_gradient_to_hhssll(), sp_item_gradient_get_stop(), sp_item_gradient_stop_query_style(), sp_item_gradient_stop_set_style(), sp_last_stop(), and sp_number_of_stops_before_stop().
SPGradientVector const & SPGradient::getGradientVector | ( | ) | const |
Definition at line 717 of file sp-gradient.cpp.
References SPGradientVector::built, rebuildVector(), and vector.
Referenced by Inkscape::Extension::Internal::PdfBuilder::Document::get_radial_pattern().
SPGradientSpread SPGradient::getSpread | ( | ) | const |
Definition at line 84 of file sp-gradient.cpp.
References spread.
Referenced by SPLinearGradient::create_drawing_paintserver(), SPMeshGradient::create_drawing_paintserver(), SPRadialGradient::create_drawing_paintserver(), Inkscape::UI::Widget::GradientEditor::set_gradient(), sp_gradient_pattern_common_setup(), and Inkscape::UI::Tools::tweak_colors_in_gradient().
int SPGradient::getStopCount | ( | ) | const |
Definition at line 609 of file sp-gradient.cpp.
References getFirstStop(), and SPStop::getNextStop().
Referenced by GrDrag::addStopNearPoint(), child_added(), isEquivalent(), isSolid(), remove_child(), set(), and sp_gradient_delete_stop().
SPGradientUnits SPGradient::getUnits | ( | ) | const |
Definition at line 74 of file sp-gradient.cpp.
References units.
Referenced by SPLinearGradient::create_drawing_paintserver(), SPMeshGradient::create_drawing_paintserver(), SPRadialGradient::create_drawing_paintserver(), get_g2d_matrix(), get_gs2d_matrix(), Inkscape::Extension::Internal::PdfBuilder::Document::get_radial_pattern(), getGradientCoords(), set_gs2d_matrix(), sp_gradient_convert_to_userspace(), sp_gradient_pattern_common_setup(), SPLinearGradient::update(), and SPRadialGradient::update().
SPGradient * SPGradient::getVector | ( | bool | force_private = false | ) |
Returns private vector of given gradient (the gradient at the end of the href chain which has stops), optionally normalizing it.
Definition at line 838 of file sp-gradient.cpp.
References chase_hrefs(), has_stopsFN(), and sp_gradient_ensure_vector_normalized().
Referenced by Inkscape::UI::Widget::PaintSelector::getGradientVector(), getVector(), gr_knot_clicked_handler(), isEquivalent(), GrDrag::makeStopSafeColor(), objects_query_fillstroke(), Inkscape::Extension::Internal::OdfOutput::processGradient(), Inkscape::UI::Toolbar::GradientToolbar::select_stop_by_draggers(), GrDrag::selectByStop(), Inkscape::UI::Widget::GradientEditor::set_gradient(), Inkscape::UI::Widget::PaintSelector::set_mode_color(), sp_get_same_fill_or_stroke_color(), sp_gradient_convert_to_userspace(), sp_gradient_get_forked_vector_if_necessary(), sp_gradient_reverse_vector(), sp_item_gradient_get_stop(), sp_item_gradient_get_vector(), sp_item_gradient_invert_vector_color(), sp_item_gradient_stop_query_style(), sp_item_gradient_stop_set_style(), and sp_item_set_gradient().
|
inline |
Definition at line 165 of file sp-gradient.h.
References getVector().
|
static |
Gets called when the gradient is (re)attached to another gradient.
Definition at line 457 of file sp-gradient.cpp.
References fetchSpread(), fetchUnits(), gradientRefModified(), modified_connection, ref, spread, spread_set, units, and units_set.
Referenced by SPGradient().
|
static |
Definition at line 950 of file sp-gradient.cpp.
References invalidateVector(), and SPObject::requestModified().
Referenced by gradientRefChanged().
bool SPGradient::hasPatches | ( | ) | const |
Definition at line 64 of file sp-gradient.cpp.
References has_patches.
Referenced by has_patchesFN(), sp_gradient_fork_private_if_necessary(), and sp_gradient_get_private_normalized().
bool SPGradient::hasStops | ( | ) | const |
Definition at line 59 of file sp-gradient.cpp.
References has_stops.
Referenced by has_stopsFN(), isEquivalent(), isSolid(), rebuildVector(), set(), Inkscape::UI::Widget::GradientVectorSelector::set_gradient(), Inkscape::UI::Widget::GradientEditor::set_gradient(), Inkscape::UI::Widget::GradientSelector::setVector(), sp_gradient_ensure_vector_normalized(), sp_gradient_fork_private_if_necessary(), sp_gradient_get_private_normalized(), and Inkscape::UI::Toolbar::GradientToolbar::update_stop_list().
|
private |
Return true if change made.
Definition at line 973 of file sp-gradient.cpp.
References array, and SPMeshNodeArray::built.
Referenced by modified().
|
private |
Return true if change made.
Definition at line 959 of file sp-gradient.cpp.
References SPGradientVector::built, SPGradientVector::stops, and vector.
Referenced by child_added(), gradientRefModified(), modified(), and remove_child().
bool SPGradient::isAligned | ( | SPGradient * | that | ) |
return true if this gradient is "aligned" to that gradient.
Aligned means that they have exactly the same coordinates and transform.
that | - A gradient to compare this to |
Definition at line 163 of file sp-gradient.cpp.
References gradientTransform, and gradientTransform_set.
Referenced by isEquivalent().
bool SPGradient::isEquivalent | ( | SPGradient * | that | ) |
return true if this gradient is "equivalent" to that gradient.
Equivalent meaning they have the same stop count, same stop colors and same stop opacity
that | - A gradient to compare this to |
Definition at line 114 of file sp-gradient.cpp.
References bs, SPStop::getColor(), getFirstStop(), SPStop::getNextStop(), getStopCount(), getVector(), hasStops(), isAligned(), Inkscape::Colors::Color::isClose(), SPPaintServer::isSwatch(), and SPStop::offset.
|
inline |
bool SPGradient::isSolid | ( | ) | const |
Definition at line 1216 of file sp-gradient.cpp.
References getStopCount(), hasStops(), and SPPaintServer::swatch.
Referenced by setSwatch(), Inkscape::UI::Widget::SwatchSelector::setVector(), Inkscape::UI::Widget::GradientSelector::setVector(), sp_gradient_convert_to_userspace(), and write().
bool SPGradient::isSpreadSet | ( | ) | const |
Definition at line 79 of file sp-gradient.cpp.
References spread_set.
Referenced by has_spread_set(), and Inkscape::UI::Widget::GradientEditor::set_gradient().
bool SPGradient::isUnitsSet | ( | ) | const |
All Gradients.
Definition at line 69 of file sp-gradient.cpp.
References units_set.
Referenced by has_units_set().
|
overrideprotectedvirtual |
Callback for modified event.
Reimplemented from SPObject.
Definition at line 554 of file sp-gradient.cpp.
References child, SPObject::children, ensureArray(), ensureVector(), invalidateArray(), invalidateVector(), SPObject::objectTrace(), sp_object_ref(), and sp_object_unref().
Referenced by set().
|
private |
Creates normalized color mesh patch array.
Definition at line 1074 of file sp-gradient.cpp.
References array, has_patches, SPMeshNodeArray::patch_columns(), and SPMeshNodeArray::read().
Referenced by ensureArray().
|
private |
Creates normalized color vector.
Definition at line 987 of file sp-gradient.cpp.
References SPGradientVector::built, child, SPObject::children, SPGradientStop::color, ensureVector(), SPGradientReference::getObject(), hasStops(), len, MAX, SPGradientStop::offset, ref, SPGradientVector::stops, and vector.
Referenced by ensureVector(), and getGradientVector().
|
overrideprotectedvirtual |
Virtual release of SPGradient members before destruction.
Reimplemented from SPObject.
Definition at line 317 of file sp-gradient.cpp.
References Inkscape::URIReference::detach(), SPObject::document, SPObject::getId(), modified_connection, ref, SPObject::release(), and SPDocument::removeResource().
|
overrideprotectedvirtual |
Callback for remove_child event.
Reimplemented from SPObject.
Definition at line 513 of file sp-gradient.cpp.
References SPObject::children, SPObject::getAttribute(), getStopCount(), has_patches, has_stops, invalidateVector(), SPObject::remove_child(), SPObject::requestModified(), and SPObject::setAttribute().
void SPGradient::repr_clear_vector | ( | ) |
Clears the gradient's svg:stop children from its repr.
Definition at line 892 of file sp-gradient.cpp.
References child, Inkscape::XML::Node::firstChild(), SPObject::getRepr(), SPObject::repr, and sp_repr_unparent().
Referenced by repr_write_vector().
void SPGradient::repr_write_vector | ( | ) |
Writes the gradient's internal vector (whether from its own stops, or inherited from refs) into the gradient repr as svg:stop elements.
Definition at line 918 of file sp-gradient.cpp.
References Inkscape::XML::Node::addChild(), child, Inkscape::XML::Document::createElement(), SPObject::document, SPDocument::getObjectByRepr(), SPObject::getRepr(), SPDocument::getReprDoc(), Inkscape::GC::release(), SPObject::repr, repr_clear_vector(), Inkscape::XML::Node::setAttributeCssDouble(), SPGradientVector::stops, and vector.
Referenced by sp_gradient_ensure_vector_normalized().
|
overrideprotectedvirtual |
Set gradient attribute to value.
Reimplemented from SPObject.
Reimplemented in SPLinearGradient, SPMeshGradient, and SPRadialGradient.
Definition at line 342 of file sp-gradient.cpp.
References _pinned, Inkscape::URIReference::attach(), Inkscape::URIReference::detach(), getStopCount(), GRADIENTTRANSFORM, gradientTransform, gradientTransform_set, GRADIENTUNITS, hasStops(), Geom::identity(), INKSCAPE_PINNED, INKSCAPE_SWATCH, key, modified(), SPObject::objectTrace(), ref, SPObject::requestModified(), SPObject::set(), SPObject::setAttribute(), sp_attribute_name(), SP_GRADIENT_SPREAD_PAD, SP_GRADIENT_SPREAD_REFLECT, SP_GRADIENT_SPREAD_REPEAT, SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX, SP_GRADIENT_UNITS_USERSPACEONUSE, sp_svg_transform_read(), spread, spread_set, SPREADMETHOD, SPPaintServer::swatch, units, units_set, and XLINK_HREF.
Referenced by SPLinearGradient::set(), SPMeshGradient::set(), SPRadialGradient::set(), and Inkscape::UI::Widget::PaintSelector::set_mode_color().
void SPGradient::set_gs2d_matrix | ( | Geom::Affine const & | ctm, |
Geom::Rect const & | bbox, | ||
Geom::Affine const & | gs2d | ||
) |
Definition at line 1113 of file sp-gradient.cpp.
References Geom::GenericRect< C >::dimensions(), getUnits(), gradientTransform, gradientTransform_set, Geom::Affine::inverse(), Geom::Scale::inverse(), Geom::GenericRect< C >::min(), SPObject::requestModified(), and SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX.
void SPGradient::setPinned | ( | bool | pinned = true | ) |
Definition at line 100 of file sp-gradient.cpp.
References isPinned(), SPObject::requestModified(), and SPObject::setAttribute().
void SPGradient::setSpread | ( | SPGradientSpread | spread | ) |
Set spread property of gradient and emit modified.
Definition at line 753 of file sp-gradient.cpp.
References SPObject::requestModified(), spread, and spread_set.
Referenced by Inkscape::UI::Widget::PaintSelector::pushAttrsToGradient(), and Inkscape::UI::Widget::GradientEditor::set_repeat_mode().
void SPGradient::setSwatch | ( | bool | swatch = true | ) |
Definition at line 89 of file sp-gradient.cpp.
References isSolid(), SPPaintServer::isSwatch(), SPObject::requestModified(), SPObject::setAttribute(), and SPPaintServer::swatch.
Referenced by Inkscape::UI::Dialog::ColorItem::action_convert(), and Inkscape::UI::Widget::FillNStroke::updateFromPaint().
void SPGradient::setUnits | ( | SPGradientUnits | units | ) |
Set units property of gradient and emit modified.
Definition at line 741 of file sp-gradient.cpp.
References SPObject::requestModified(), units, and units_set.
Referenced by Inkscape::UI::Widget::PaintSelector::pushAttrsToGradient().
|
inlineoverridevirtual |
Reimplemented from SPObject.
Reimplemented in SPLinearGradient, SPMeshGradient, and SPRadialGradient.
Definition at line 90 of file sp-gradient.h.
References tag_of.
|
overrideprotectedvirtual |
Write gradient attributes to repr.
Reimplemented from SPObject.
Reimplemented in SPLinearGradient, SPMeshGradient, and SPRadialGradient.
Definition at line 625 of file sp-gradient.cpp.
References Inkscape::XML::Node::addChild(), c, child, SPObject::children, Inkscape::getHrefAttribute(), Inkscape::URIReference::getURI(), gradientTransform, gradientTransform_set, isSolid(), SPPaintServer::isSwatch(), SPObject::objectTrace(), ref, Inkscape::GC::release(), Inkscape::XML::Node::removeAttribute(), SPObject::repr, Inkscape::XML::Node::setAttribute(), Inkscape::XML::Node::setAttributeOrRemoveIfEmpty(), SP_GRADIENT_SPREAD_REFLECT, SP_GRADIENT_SPREAD_REPEAT, SP_GRADIENT_UNITS_USERSPACEONUSE, sp_svg_transform_write(), spread, spread_set, Inkscape::URI::str(), units, units_set, and SPObject::write().
Referenced by SPLinearGradient::write(), SPMeshGradient::write(), and SPRadialGradient::write().
|
private |
Pinned in swatches dialog.
Definition at line 114 of file sp-gradient.h.
Referenced by isPinned(), and set().
SPMeshNodeArray SPGradient::array |
Mesh Gradients.
Composed array (for mesh gradients)
Definition at line 142 of file sp-gradient.h.
Referenced by GrDrag::addDraggersMesh(), Inkscape::UI::Tools::MeshTool::corner_operation(), SPMeshGradient::create_drawing_paintserver(), create_preview_pattern(), ensureArray(), invalidateArray(), Inkscape::UI::Tools::MeshTool::new_default(), rebuildArray(), GrDrag::refreshDraggersMesh(), and Inkscape::UI::Widget::FillNStroke::updateFromPaint().
SPMeshNodeArray SPGradient::array_smoothed |
Definition at line 143 of file sp-gradient.h.
Referenced by SPMeshGradient::create_drawing_paintserver().
Geom::Affine SPGradient::gradientTransform |
gradientTransform attribute
Definition at line 99 of file sp-gradient.h.
Referenced by SPMeshNodeArray::color_pick(), SPLinearGradient::create_drawing_paintserver(), SPMeshGradient::create_drawing_paintserver(), SPRadialGradient::create_drawing_paintserver(), SPMeshNodeArray::fill_box(), get_gs2d_matrix(), Inkscape::Extension::Internal::PdfBuilder::Document::get_mesh_pattern(), Inkscape::Extension::Internal::PdfBuilder::Document::get_radial_pattern(), getGradientCoords(), Inkscape::Extension::Internal::PrintMetafile::hold_gradient(), isAligned(), GrDragger::moveMeshHandles(), set(), set_gs2d_matrix(), sp_gradient_convert_to_userspace(), sp_gradient_pattern_common_setup(), sp_gradient_reset_to_userspace(), sp_gradient_transform_multiply(), sp_item_gradient_set_coords(), SPGradient(), Inkscape::UI::Tools::tweak_colors_in_gradient(), and write().
unsigned int SPGradient::gradientTransform_set |
Definition at line 100 of file sp-gradient.h.
Referenced by SPMeshNodeArray::fill_box(), Inkscape::Extension::Internal::PrintMetafile::hold_gradient(), isAligned(), set(), set_gs2d_matrix(), sp_gradient_transform_multiply(), sp_item_gradient_set_coords(), SPGradient(), and write().
|
private |
Gradient patches.
Definition at line 111 of file sp-gradient.h.
Referenced by build(), child_added(), hasPatches(), rebuildArray(), remove_child(), and SPGradient().
|
private |
Gradient stops.
Definition at line 108 of file sp-gradient.h.
Referenced by build(), child_added(), hasStops(), remove_child(), and SPGradient().
sigc::connection SPGradient::modified_connection |
Definition at line 129 of file sp-gradient.h.
Referenced by gradientRefChanged(), and release().
SPGradientReference* SPGradient::ref |
Reference (href)
Definition at line 118 of file sp-gradient.h.
Referenced by chase_hrefs(), child_added(), gradientRefChanged(), rebuildVector(), release(), set(), sp_gradient_ensure_vector_normalized(), sp_gradient_fork_private_if_necessary(), sp_gradient_get_forked_vector_if_necessary(), sp_gradient_reverse_vector(), sp_item_gradient_invert_vector_color(), sp_item_gradient_stop_set_style(), SPGradient(), and write().
|
private |
spreadMethod attribute
Definition at line 104 of file sp-gradient.h.
Referenced by fetchSpread(), getSpread(), gradientRefChanged(), set(), setSpread(), SPGradient(), and write().
|
private |
Definition at line 105 of file sp-gradient.h.
Referenced by gradientRefChanged(), isSpreadSet(), set(), setSpread(), SPGradient(), and write().
unsigned int SPGradient::state |
State in Inkscape gradient system.
Definition at line 121 of file sp-gradient.h.
Referenced by sp_document_default_gradient_vector(), sp_gradient_ensure_vector_normalized(), sp_gradient_fork_private_if_necessary(), sp_item_set_gradient(), and SPGradient().
|
private |
gradientUnits attribute
Definition at line 94 of file sp-gradient.h.
Referenced by fetchUnits(), getUnits(), gradientRefChanged(), set(), setUnits(), SPGradient(), and write().
|
private |
Definition at line 95 of file sp-gradient.h.
Referenced by gradientRefChanged(), isUnitsSet(), set(), setUnits(), SPGradient(), and write().
|
mutable |
Linear and Radial Gradients.
Composed vector
Definition at line 126 of file sp-gradient.h.
Referenced by GrDrag::addDraggersLinear(), GrDrag::addDraggersRadial(), Inkscape::Extension::Internal::PrintMetafile::avg_stop_color(), SPLinearGradient::create_drawing_paintserver(), SPRadialGradient::create_drawing_paintserver(), create_preview_pattern(), ensureVector(), Inkscape::Extension::Internal::PrintEmf::fill(), Inkscape::Extension::Internal::PrintWmf::fill(), getGradientVector(), gr_knot_clicked_handler(), invalidateVector(), rebuildVector(), repr_write_vector(), sp_gradient_ensure_vector_normalized(), sp_gradient_pattern_common_setup(), and SPGradient().