58 _curve.emplace(std::move(pv));
84 if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
85 flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B;
88 if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
93 double const aw = (ictx) ? 1.0 / ictx->
i2vp.
descrim() : 1.0;
96 for (
auto &v :
views) {
97 v.drawingitem->setStyle(
style);
102 if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
103 for (
auto &v :
views) {
116 views.emplace_back(make_drawingitem<Inkscape::DrawingShape>(drawing), extents,
key);
117 auto &v =
views.back();
118 auto s = v.drawingitem.get();
127 auto it = std::find_if(
views.begin(),
views.end(), [=] (
auto &v) {
131 if (it !=
views.end()) {
136 g_assert_not_reached();
141 for (
auto &v :
views) {
165 result.setMin(bbox->left() - stroke_width / 2);
166 result.setMax(bbox->right() + stroke_width / 2);
172 for (
auto const &v :
views) {
177 g_assert_not_reached();
200 view.
drawingitem->setPath(std::make_shared<SPCurve>(std::move(calculated_curve)));
208 return calculated_curve;
217 if (repeatLength > 0) {
218 gdouble initial_y =
floor(view.
extents->min() / repeatLength) * repeatLength;
219 int segment_cnt = ceil((view.
extents->extent()) / repeatLength) + 1;
225 for (
int i = 0; i < segment_cnt; ++i) {
229 calculated_curve.
append(segment);
231 segment.transform(step_transform);
235 return calculated_curve;
246 if (!pathv.
empty()) {
247 continous_join =
false;
249 Glib::ustring str2 = Glib::ustring::compose(
"M0,0 %1", str);
257 stream << last_point_x;
258 Glib::ustring str3 = Glib::ustring::compose(
"M%1,0 %2", stream.
str(), str);
267 continous_join =
true;
272 : drawingitem(
std::move(drawingitem))
Path - a sequence of contiguous curves.
bool SP_ATTRIBUTE_IS_CSS(SPAttr k)
True iff k is a property in SVG, i.e.
Lookup dictionary for attributes/properties.
3x3 matrix representing an affine transformation.
Coord descrim() const
Calculate the descriminant.
Range of real numbers that is never empty.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
bool empty() const
Check whether the vector contains any paths.
Point finalPoint() const
Get the last point in the path.
Two-dimensional point that doubles as a vector.
constexpr Coord y() const noexcept
constexpr Coord x() const noexcept
A thin wrapper around std::ostringstream, but writing floating point numbers in the format required b...
SVG drawing item for display.
Interface for refcounted XML nodes.
Wrapper around a Geom::PathVector object.
void append(Geom::PathVector const &, bool use_lineto=false)
void moveto(Geom::Point const &p)
Perform a moveto to a point, thus starting a new subpath.
void lineto(Geom::Point const &p)
Adds a line to the current subpath.
std::optional< Geom::Point > last_point() const
Return last point of last subpath or nothing when the curve is empty.
bool append_continuous(SPCurve const &c1, double tolerance=0.0625)
Append c1 to this with possible fusing of close endpoints.
Typed SVG document implementation.
std::optional< SPCurve > _curve
void set(SPAttr key, const gchar *value) override
SPCurve calculateRenderCurve(unsigned key) const
void _readHatchPathVector(char const *str, Geom::PathVector &pathv, bool &continous_join)
SPCurve _calculateRenderCurve(View const &view) const
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Inkscape::DrawingItem * show(Inkscape::Drawing &drawing, unsigned int key, Geom::OptInterval extents)
gdouble _repeatLength() const
void setStripExtents(unsigned int key, Geom::OptInterval const &extents)
void update(SPCtx *ctx, unsigned int flags) override
void hide(unsigned int key)
void _updateView(View &view)
std::vector< View > views
Geom::Interval bounds() const
Inkscape::XML::Node * repr
virtual void set(SPAttr key, const char *value)
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
void readAttr(char const *key)
Read value of key attribute from XML node into object.
virtual void build(SPDocument *doc, Inkscape::XML::Node *repr)
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
T< SPAttr::FILL, SPIPaint > fill
fill
T< SPAttr::STROKE_WIDTH, SPILength > stroke_width
stroke-width
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
TODO: insert short description here.
std::unique_ptr< T, UnlinkDeleter > DrawingItemPtr
Smart pointer used by the Object Tree to hold items in the Display Tree, like std::unique_ptr.
Group belonging to an SVG drawing element.
Geom::OptRect bounds_exact_transformed(Geom::PathVector const &pv, Geom::Affine const &t)
Specific geometry functions for Inkscape, not provided my lib2geom.
auto floor(Geom::Rect const &rect)
static cairo_user_data_key_t key
SVG <hatchPath> implementation.
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
DrawingItemPtr< Inkscape::DrawingShape > drawingitem
View(DrawingItemPtr< Inkscape::DrawingShape > drawingitem, Geom::OptInterval const &extents, unsigned key)
Geom::OptInterval extents
Contains transformations to document/viewport and the viewport size.
Geom::Affine i2vp
Item to viewport transformation.
SPStyle - a style object for SPItem objects.
Geom::PathVector sp_svg_read_pathv(char const *str)